Importing HeightMaps in OpenTTD?
Moderator: OpenTTD Developers
- chrisgrant
- Engineer
- Posts: 6
- Joined: 15 Oct 2004 16:43
- Location: Perth, WA
Importing HeightMaps in OpenTTD?
With TTDX it was possible to create a HeightMap in almost any graphic editor and open it in a program called sv0creator. You could do a few things in the program, like selecting height of the snow line, and then convert the image into a TTDX scenario file. You would still have to add towns, industries, etc but at least you had the basic landscape.
Does anybody know if it's possible to do the same thing with the new big maps?
If not does anybody know how to make a similar tool/patch?
It would be very useful especially for making real world maps as you can easily use any map to create mountains and rivers in almost their exact position.
BTW sv0creator can downloaded at http://www.geocities.com/c3p1models/sv0creator.html
I didn't make it but I won't say who did cos I don't know if I'm supposed to mention other peoples names!
Does anybody know if it's possible to do the same thing with the new big maps?
If not does anybody know how to make a similar tool/patch?
It would be very useful especially for making real world maps as you can easily use any map to create mountains and rivers in almost their exact position.
BTW sv0creator can downloaded at http://www.geocities.com/c3p1models/sv0creator.html
I didn't make it but I won't say who did cos I don't know if I'm supposed to mention other peoples names!
You have 2 options:
1. Use sv0creator to make 256x256 maps and open them in OpenTTD
2. Write your own tool similar to sv0creator, with the added options of 64, 128, 256, 512 and 1024 maps.
1. Use sv0creator to make 256x256 maps and open them in OpenTTD
2. Write your own tool similar to sv0creator, with the added options of 64, 128, 256, 512 and 1024 maps.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
I wrote a very bad, very hacky tool to take raw grey bitmaps and convert them into openttd maps in the editor.
This was in the form of a patch to ottd.
The resulting map could then be saved out.
There are several issues:
- I made it for a svn version, so the resulting maps could not be converted back into 0.3.6
- It only worked with 256x256
- It could easily go wrong, placing stuff too near the edge of the map
I hope to make a better one eventually.
Mark
This was in the form of a patch to ottd.
The resulting map could then be saved out.
There are several issues:
- I made it for a svn version, so the resulting maps could not be converted back into 0.3.6
- It only worked with 256x256
- It could easily go wrong, placing stuff too near the edge of the map
I hope to make a better one eventually.
Mark
http://www.huebsch-gemacht.de/ttd/ wrote the correct link by request of chu_ (no unstable isdn server anymore) - Bjarni
Made by chu_
-Abraxa
Made by chu_
-Abraxa
Chris, I think maybe Killer wanted a binary?Killer 11 wrote:Maybe a binarie for windows???
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
-
- Engineer
- Posts: 75
- Joined: 10 Jun 2004 12:46
I have neither windows nor a cross-compiler.DaleStan wrote:Chris, I think maybe Killer wanted a binary?
At first my idea was a stand-alone png->scn converter. But integrating it into ottd, was much more simple.
We are currently working on a tool to fix broken pngs, because there are severe limitations on the images.
/me pokes at patch
/me posts new patch (against SVN 2335)
Fixed:
- Memory leaks on return values 4 and 5
- Compilation when WITH_PNG is undef
- Potential issue with PNG files on non-Unix platforms
- Message in "Reset Land" confirmation dialog when loading a PNG file.
- Marks the main view dirty after loading PNG file.
Todo:
- Remove "Load land" button when WITH_PNG is undef (?)
- Add a dialog to select which PNG file is loaded (currently map.png is hardcoded)
- Fix title of "Reset Land" confirmation dialog
*fiddles with VS .NET
There we are.
One exe, revhacked to r2335.
/me posts new patch (against SVN 2335)
Fixed:
- Memory leaks on return values 4 and 5
- Compilation when WITH_PNG is undef
- Potential issue with PNG files on non-Unix platforms
- Message in "Reset Land" confirmation dialog when loading a PNG file.
- Marks the main view dirty after loading PNG file.
Todo:
- Remove "Load land" button when WITH_PNG is undef (?)
- Add a dialog to select which PNG file is loaded (currently map.png is hardcoded)
- Fix title of "Reset Land" confirmation dialog
*fiddles with VS .NET
There we are.
One exe, revhacked to r2335.
- Attachments
-
- trunk.rar
- And, in compilance with the GPL:
- (1.85 MiB) Downloaded 1215 times
-
- PNGLoadv2.zip
- (429 KiB) Downloaded 1182 times
-
- pngmap2.patch
- (9.94 KiB) Downloaded 1111 times
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
-
- Engineer
- Posts: 75
- Joined: 10 Jun 2004 12:46
THX for thatDaleStan wrote:/me pokes at patch
/me posts new patch (against SVN 2335)
Fixed:
Done.DaleStan wrote: Todo:
- Remove "Load land" button when WITH_PNG is undef (?)
- Fix title of "Reset Land" confirmation dialog
Still open. Can someone help with that?DaleStan wrote: - Add a dialog to select which PNG file is loaded (currently map.png is hardcoded)
- Attachments
-
- pngmap3.patch
- third version
- (9.35 KiB) Downloaded 1007 times
Hi everyone,
I'm the author of SV0 Creator... it's been a while since my original posts about it, and I think they were lost in a server or database crash right around the time it was released... the only previous post in my name is about BMP2SV0, way back from 2001
Anyway, I finally decided to set aside some time for finishing up some of my past projects, and I've wanted to start contributing to OpenTTD as well. And this seemed like a good place to start (not to mention a few emails about it already)
I've done some modifications, and adapted some of my code from SV0 Creator as well. It only took a few hours so far, so I REALLY should have done this sooner, but I guess It would have taken me much longer if the base loading code wasn't already created.
Bugfixes:
- height is MapSizeY(), width is MapSizeX(), not the opposite
- flip image horizontally - TTD map is "backwards" horizontally from normal images
- 'no owner' is 0x10 - hex, not decimal
Changes:
- Automatically add the water border
- Automatically alter landscape to proper height differences (1 max in each straight direction)
- Removed the text strings associated with the errors given about the two features above.
To do:
- Automatic rescaling of images (I should be able to add that using existing code also)
- Automatic conversion of additional color depths - I'd suggest plain grayscale conversion, so that no special palletes are needed. Also, 24-bit images are fairly easy to convert to grayscale as well.
- (from before)Add a dialog to select which PNG file is loaded (currently map.png is hardcoded)
I'm still fairly new at the OpenTTD code, so please excuse any errors, and let me know if anything is wrong/doesn't work.
Also, shouldn't this be in the Development section?
I'm the author of SV0 Creator... it's been a while since my original posts about it, and I think they were lost in a server or database crash right around the time it was released... the only previous post in my name is about BMP2SV0, way back from 2001

Anyway, I finally decided to set aside some time for finishing up some of my past projects, and I've wanted to start contributing to OpenTTD as well. And this seemed like a good place to start (not to mention a few emails about it already)

I've done some modifications, and adapted some of my code from SV0 Creator as well. It only took a few hours so far, so I REALLY should have done this sooner, but I guess It would have taken me much longer if the base loading code wasn't already created.
Bugfixes:
- height is MapSizeY(), width is MapSizeX(), not the opposite
- flip image horizontally - TTD map is "backwards" horizontally from normal images
- 'no owner' is 0x10 - hex, not decimal
Changes:
- Automatically add the water border
- Automatically alter landscape to proper height differences (1 max in each straight direction)
- Removed the text strings associated with the errors given about the two features above.
To do:
- Automatic rescaling of images (I should be able to add that using existing code also)
- Automatic conversion of additional color depths - I'd suggest plain grayscale conversion, so that no special palletes are needed. Also, 24-bit images are fairly easy to convert to grayscale as well.
- (from before)Add a dialog to select which PNG file is loaded (currently map.png is hardcoded)
I'm still fairly new at the OpenTTD code, so please excuse any errors, and let me know if anything is wrong/doesn't work.
Also, shouldn't this be in the Development section?
- Attachments
-
- pngmap_changes4.patch
- new patch against SVN 2352
- (10.1 KiB) Downloaded 1013 times
-
- Engineer
- Posts: 75
- Joined: 10 Jun 2004 12:46
Probably. Can someone with the appropriate powers move it?cccp wrote:Also, shouldn't this be in the Development section?
It's not 90° to the left. It's a choice between 45° left and 45° right.ChrisHuebsch wrote:the png-pixel at position (0,0) becomes tile at (MapMaxX,0). why do rotate the image 90° to the left?cccp wrote:Bugfixes:
- flip image horizontally - TTD map is "backwards" horizontally from normal images
I've been sitting on these changes for too long.
Changes:
- Increased size of landscape dialog (now there's the proper 2 px below the "Load Land" button)
- Removed some unused texts, minor fixes of some others.
Same deal as last time, except the exe is revhacked to r2356.
- Attachments
-
- trunk.rar
- (1.85 MiB) Downloaded 998 times
-
- PNGLoadv5.zip
- (431.4 KiB) Downloaded 1043 times
-
- pngmap5.patch
- (9.81 KiB) Downloaded 1057 times
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
For now, the PNG *must* be the same size as the map. For a 512x512 map, you need a 512x512 PNG.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
What I meant is the horizontal edge of the map (from X=0 to X=width) goes from the top corner to the left corner, which is mirrored from how a normal image would look if it was rotated 45°. It was showing the simple "Hello World" PNG flipped horizontally when I initially loaded the patch. Of course the other solution is to rotate it the other way, with the top edge of the image going from the top to the right corner of the map, but I thought that it may be better to stay with what was in the current patch. Basically as DaleStan said, it's either 45° left or right, it's just that when you turn to the left, the X coordinates need to be flipped.ChrisHuebsch wrote:is it?cccp wrote: Bugfixes:
- flip image horizontally - TTD map is "backwards" horizontally from normal images
the png-pixel at position (0,0) becomes tile at (MapMaxX,0). why do rotate the image 90° to the left?
Ideally I'd like to add some buttons for rotation and flipping of the loaded maps, most likely with a preview as well, similar to how I did with SV0 creator. I suppose that would need its own window though.
It doesn't look like it's that hard to add a new window, but I haven't tried, so I'm not sure. Getting the preview pane to work might be difficult, though.
@Born_Acorn: Can you suggest a better message?
@Born_Acorn: Can you suggest a better message?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
What do you mean?
I just tried it with a resized version of your image, and it seemed fine...
Actually the 'size' error won't really be needed anymore once the rescaling is done. As far as how that would work, I have a few possibilities:
1. Leave the image exactly the same size as it is, and crop or add water around the edges as necessary, based around the center of the image.
2. Rescale image to fit the dimensions of the chosen map size, corner to corner - without keeping the aspect ratio.
3. Rescale image to fit dimensions of the map, but keep aspect ratio, and fill the rest with water.
I think #3 would be best for creating realistic maps, but #2 may sometimes be useful as well when you just want to fill up the entire map. Any thoughts? (I think #1 is pretty much useless...)
I just tried it with a resized version of your image, and it seemed fine...
Actually the 'size' error won't really be needed anymore once the rescaling is done. As far as how that would work, I have a few possibilities:
1. Leave the image exactly the same size as it is, and crop or add water around the edges as necessary, based around the center of the image.
2. Rescale image to fit the dimensions of the chosen map size, corner to corner - without keeping the aspect ratio.
3. Rescale image to fit dimensions of the map, but keep aspect ratio, and fill the rest with water.
I think #3 would be best for creating realistic maps, but #2 may sometimes be useful as well when you just want to fill up the entire map. Any thoughts? (I think #1 is pretty much useless...)
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
3 is the best 
(this is what Im getting. I need a 1024x1024 or 2048x2048 size for it)

(this is what Im getting. I need a 1024x1024 or 2048x2048 size for it)
- Attachments
-
- screenshot.PNG
- (76.22 KiB) Downloaded 1078 times
Who is online
Users browsing this forum: Google [Bot] and 12 guests