Landscape generator
Moderator: Locomotion Moderators
Landscape generator
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.
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.
-
- TTDPatch Developer
- Posts: 417
- Joined: 13 Apr 2004 13:35
- Location: Eindhoven, Netherlands
- Contact:
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]
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]
-
- TTDPatch Developer
- Posts: 417
- Joined: 13 Apr 2004 13:35
- Location: Eindhoven, Netherlands
- Contact:
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...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.
Code: Select all
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.
It is a command line tool.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.
Open a DOS box (or command prompt) and go to the directory where mapgen is located, then type: mapgen image.bmp
This is not a bug, this is a feature.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...
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.
EDIT The Locomotion built in scenario editor as well as the game itself actually allow height 0 land, why should'nt I?- 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..
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 27 Sep 2004 12:47, edited 2 times in total.
-
- TTDPatch Developer
- Posts: 417
- Joined: 13 Apr 2004 13:35
- Location: Eindhoven, Netherlands
- Contact:
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...)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.
I tried what you said. Kind of weird.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...)
mapgen is updated to not use height level 0.
Just download the zip file again.
-
- Engineer
- Posts: 7
- Joined: 21 Sep 2004 11:08
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.
It just loads a bmp file and outputs a scenario file. Not much reason to add a GUI. It would only slow down thingsStubblychin wrote:
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!
Yes. (Actually, the pixelvalue is 20 now since I just updated mapgen to not use height 0)Just to put things straight if i do a square of land in grayscale under pixelvalue 25 will it be under the water?
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).
(pixelvalue 20 now)If i do a square of land at pixelvalue 25 will it be below the water or visible?
It will become a piece of green land at sealevel. (just like in the built in scenario editor)
Everything at or above sealevel becomes dry land. Everything below sealevel ends up under water. Just like in the built in scenario editor.In general will i need to keep any land i want generated above the 25 pixel mark?
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.Also when i go into loco do i load the landscape in the editor? Will the landscape be written into the loco landscapes folder?
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)
-
- Engineer
- Posts: 7
- Joined: 21 Sep 2004 11:08
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?
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.Stubblychin wrote:
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!Thanks!
I think it is ok, but the map image I used was not very good.. It can become much better.
I found a not-so-good terrain map on the internet. Terrain maps are surprisingly hard to find on the net.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?
Last edited by Rens2Sea on 27 Sep 2004 14:39, edited 1 time in total.
-
- Engineer
- Posts: 7
- Joined: 21 Sep 2004 11:08
Looks like ill just have to judge by eye then!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.
Wow!Look at what i just made in 10 minutes
*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.
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 09 Oct 2004 10:37, edited 1 time in total.
*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.
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 09 Oct 2004 10:37, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 0 guests