Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Dec 13, 2017 5:15 am

All times are UTC




Post new topic  Reply to topic  [ 91 posts ]  Go to page 1 2 3 4 5 Next
Author Message
 Post subject: Landscape generator
PostPosted: Mon Sep 27, 2004 11:44 am 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
This program generates a locomotion landscape from a greyscale 24bit 384x384 pixel BMP file.
http://www.brolinembedded.se/projects/mapgen/mapgen.zip
Sea level is fixed at level 4 (this corresponds to a greyscale pixelvalue of 25)

Tip: If your generated landscape looks a bit rough, try bluring the BMP image slightly. It does wounders for the landscape.


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 11:54 am 
Offline
Engineer
Engineer

Joined: Sat Sep 25, 2004 7:34 pm
Posts: 15
This sounds extremely useful. I can't wait to try it out. ( I'm so sick of the squared landscapes the game creates... )


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 11:58 am 
Offline
TTDPatch Developer
TTDPatch Developer
User avatar

Joined: Tue Apr 13, 2004 1:35 pm
Posts: 417
Location: Eindhoven, Netherlands
Damn.. i was just about to release my own program that would do almost the same... (but with many more options, such as specifying the water height, using any tpye of image (bmp/png/gif/jpg), using any size of image (not anly 382x382))... i only was working on a nice GUI...

But.. there are a couple of bugs in your program...
- You are using 384x384 bitmaps, while only the middle 382x382 tiles should be used... the others form an invisible border...
- You are using land-height 0 as a base height... But you shouldn't use this height (except perhaps for the 1 tile border). The lowest height that can normally be used is 4..[/list]


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 12:03 pm 
Offline
Engineer
Engineer

Joined: Sun May 16, 2004 8:04 pm
Posts: 30
Location: Norway
Do I need any basicskills to use that program? It may be because of my computer, but the program exits as fast as I open it.


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 12:04 pm 
Offline
TTDPatch Developer
TTDPatch Developer
User avatar

Joined: Tue Apr 13, 2004 1:35 pm
Posts: 417
Location: Eindhoven, Netherlands
Slangen wrote:
Do I need any basicskills to use that program? It may be because of my computer, but the program exits as fast as I open it.
this one you need to start from commandline, but the one i will release soon (hopefully today, but surely tomorrow) will have a nice GUI...

Code:
Locomotion landscape generator. (c) 2004 Timmy Brolin
This tool generates a Locomotion landscape based on a BMP image.

Usage: mapgen image.bmp [output.sc5]
If the output filename is omitted, the landscape will be written to the default file 'landscape.sc5'

BMP file requirements:
The size must be 384x384 pixels and the colordepth must be 24bit.
Greyscale recommended. Landscape is generated based on the red color component in case of color images.


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 12:26 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
Slangen wrote:
Do I need any basicskills to use that program? It may be because of my computer, but the program exits as fast as I open it.

It is a command line tool.
Open a DOS box (or command prompt) and go to the directory where mapgen is located, then type: mapgen image.bmp


Mek wrote:
Damn.. i was just about to release my own program that would do almost the same... (but with many more options, such as specifying the water height, using any tpye of image (bmp/png/gif/jpg), using any size of image (not anly 382x382))... i only was working on a nice GUI...

But.. there are a couple of bugs in your program...
- You are using 384x384 bitmaps, while only the middle 382x382 tiles should be used... the others form an invisible border...

This is not a bug, this is a feature.
The outermost rows of pixels in the BMP image are not used in the landscape, but they affect how slopes are generated along the border of the map. Without thoose outermost pixelrows, some slopeconfigurations would not be possible to generate.

Quote:
- You are using land-height 0 as a base height... But you shouldn't use this height (except perhaps for the 1 tile border). The lowest height that can normally be used is 4..

EDIT The Locomotion built in scenario editor as well as the game itself actually allow height 0 land, why should'nt I?

The sealevel is simply defined by a constant in my program. I could easily make it variable if someone wants it. But sealevel 4 is usually appropriate.


Last edited by ampz on Mon Sep 27, 2004 12:47 pm, edited 2 times in total.

Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 12:35 pm 
Offline
TTDPatch Developer
TTDPatch Developer
User avatar

Joined: Tue Apr 13, 2004 1:35 pm
Posts: 417
Location: Eindhoven, Netherlands
ampz wrote:
Yes, I know the lowest normal height is 4, but I have not yet found any problems when using height 0 so I figured there is no reason not to use it.

There is a problem with it... If you want to raise a tile with the create nice smooth hills tool (what is it called?), the tiles with height 0 won't get raised.. (i tried to make a screenshot, but locomotion crashed.. so this is a serious problem...)


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 12:58 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
Mek wrote:
There is a problem with it... If you want to raise a tile with the create nice smooth hills tool (what is it called?), the tiles with height 0 won't get raised.. (i tried to make a screenshot, but locomotion crashed.. so this is a serious problem...)

I tried what you said. Kind of weird.
mapgen is updated to not use height level 0.
Just download the zip file again.


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 12:58 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 21, 2004 11:08 am
Posts: 7
:D
This sounds good guys. After seeing a similar thing on Sim City 3000 the first thing i thought when looking at the maps for Loco was that i wanted something like this. It will be great to convert some actual maps of coastlines and stuff. I will look forward to the one with the GUI!

Just to put things straight if i do a square of land in grayscale under pixelvalue 25 will it be under the water? If i do a square of land at pixelvalue 25 will it be below the water or visible? In general will i need to keep any land i want generated above the 25 pixel mark?
Also when i go into loco do i load the landscape in the editor? Will the landscape be written into the loco landscapes folder?

Ta.


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 1:21 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
Stubblychin wrote:
:D
This sounds good guys. After seeing a similar thing on Sim City 3000 the first thing i thought when looking at the maps for Loco was that i wanted something like this. It will be great to convert some actual maps of coastlines and stuff. I will look forward to the one with the GUI!
It just loads a bmp file and outputs a scenario file. Not much reason to add a GUI. It would only slow down things :)

Quote:
Just to put things straight if i do a square of land in grayscale under pixelvalue 25 will it be under the water?
Yes. (Actually, the pixelvalue is 20 now since I just updated mapgen to not use height 0)
Also, keep in mind that there are not 256 valid height levels in locomotion, so the pixelvalue is rounded to the closest valid height. The valid heights occur at approximately every 6.4th pixelvalue. So, a pixelvalue of 19 would still be rounded to 20 (sealevel).

Quote:
If i do a square of land at pixelvalue 25 will it be below the water or visible?
(pixelvalue 20 now)
It will become a piece of green land at sealevel. (just like in the built in scenario editor)

Quote:
In general will i need to keep any land i want generated above the 25 pixel mark?
Everything at or above sealevel becomes dry land. Everything below sealevel ends up under water. Just like in the built in scenario editor.

Quote:
Also when i go into loco do i load the landscape in the editor? Will the landscape be written into the loco landscapes folder?
The landscape file is written to the location you specify at the command line. It is written to the directory where mapgen is located if no directory path is specified.
Just use the file->open menu in the locomotion scenario editor and locate the scenario file created by mapgen.

If you want to see an example of a generated scenario, I created this scenario using mapgen: http://www.tt-forums.net/viewtopic.php?t=10704
(Note that this scenario was created before I removed the use of height level 0, so there might be some glitch with level 0 tiles)


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 1:30 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 21, 2004 11:08 am
Posts: 7
:D
Thanks for the reply. Sounds really good and ill give it a good try tonight. That sweden scenario looks bloody great! Its caught all the islands and hills perfectly!

What sort of base images did you use to create it? OS Maps or satellite photographs or similar?

Also ill be asking this question on the main forum, but does anyone have an idea of an approximate scale on Loco?


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 1:31 pm 
Offline
Engineer
Engineer
User avatar

Joined: Fri Sep 24, 2004 10:06 am
Posts: 113
Location: British Columbia, Canada
Lol. I had been custom buiding my own map due to the unrealistic nature of the randomly generated maps and after an hour or 2 I only managed to complete like 1/8 of my map. Hopefully with this tool I won't need to bother finnishing my map in order to get nicer looking maps.


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 1:41 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
Stubblychin wrote:
:D
Thanks for the reply. Sounds really good and ill give it a good try tonight. That sweden scenario looks bloody great! Its caught all the islands and hills perfectly!
Quote:
Thanks!
I think it is ok, but the map image I used was not very good.. It can become much better.

Quote:
What sort of base images did you use to create it? OS Maps or satellite photographs or similar?
I found a not-so-good terrain map on the internet. Terrain maps are surprisingly hard to find on the net.

Quote:
Also ill be asking this question on the main forum, but does anyone have an idea of an approximate scale on Loco?
Yeah: There is no scale whatsoever. The highest possible mountain is only 180meter (real swedish mountains are for example 1000-2000meter), and cities, trains, roads, industries are obviously not at the same scale as the map.


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 1:49 pm 
Offline
Engineer
Engineer
User avatar

Joined: Mon Sep 13, 2004 10:22 am
Posts: 109
Location: Holland
Look at what i just made in 10 minutes :shock:

Image


Last edited by Rens2Sea on Mon Sep 27, 2004 2:39 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 1:53 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 21, 2004 11:08 am
Posts: 7
Quote:
Quote:
Also ill be asking this question on the main forum, but does anyone have an idea of an approximate scale on Loco?
Yeah: There is no scale whatsoever. The highest possible mountain is only 180meter (real swedish mountains are for example 1000-2000meter), and cities, trains, roads, industries are obviously not at the same scale as the map.


Looks like ill just have to judge by eye then!

Quote:
Look at what i just made in 10 minutes


:shock: Wow!


Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 2:35 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
*New update* Due to popular request (well, at least Rens2Sea requested it)
Now you can select world region if you want.
The options works like this:

North american:
mapgen -n image.bmp
Alpine:
mapgen -a image.bmp
Great brittain:
mapgen -b image.bmp

Or just:
mapgen image.bmp
(this will default to north american and sealevel 4)

EDIT

I threw in configurable sealevel as well.

Example: mapgen -12 -b image.bmp
This sets the sealevel to 12 and the region to Brittish.
If the sealevel option is omitted, it will use a sealevel of 4. This default level is recommended for most maps.


Last edited by ampz on Sat Oct 09, 2004 10:37 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Mon Sep 27, 2004 7:20 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Jan 10, 2004 8:19 pm
Posts: 2085
Location: London
Moved because it has A LOT more to do with scenarios that Graphics and Modding of Loco.


Top
   
 Post subject:
PostPosted: Tue Sep 28, 2004 11:01 am 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
*Added automatic removal of "non-slopeable" holes*

The sides of 1 block wide holes and ditches can obviously not be sloped.
These tiny holes and ditches are usually the result of the land-height in the BMP file beeing very close to the border between two valid locomotion heights.
Originally I just left thoose holes and ditches with vertical sides, but it does not look very good, so I have now added autmomatic removal of such "artefact holes and ditches".

EDIT
I have optimized the program slightly, the previous version generated a map in a little over 200ms on my computer. This new optimized version generates a map in 100-150ms :-)
I have also been able to decrease the size from 99kByte to 81kByte, I am sure that people on modems as well as people who pay for used bandwidth welcome this.

I also realized that I need some way to keep track of the version number, so I have now dubed this version of mapgen to v1.0

EDIT2
Graphical user interface added :)
And that's without increasing the file by more than a few hundred bytes (file is still 82kByte).
Simply run mapgen.exe and it will ask for a bmp file to use.


Last edited by ampz on Sat Oct 09, 2004 10:37 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Tue Sep 28, 2004 8:30 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Sep 09, 2004 3:03 pm
Posts: 158
The command line arguments are now completely replaced by a semi-graphical user interface. Just doubleclick on the exe.
I don't think anyone should have any trouble using it.

Download


Last edited by ampz on Sat Oct 09, 2004 10:38 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Tue Sep 28, 2004 10:15 pm 
Offline
Engineer
Engineer

Joined: Wed Sep 08, 2004 12:51 pm
Posts: 23
Location: Oslo - Norway
This is an awsome tool :shock: Thanks!
Could you give us examples on what kind of maps to search for?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 91 posts ]  Go to page 1 2 3 4 5 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.