Page 1 of 5
Importing HeightMaps in OpenTTD?
Posted: 17 Apr 2005 13:34
by chrisgrant
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!
Posted: 17 Apr 2005 15:13
by Darkvater
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.
Posted: 17 Apr 2005 19:28
by markr
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
Posted: 16 May 2005 19:06
by Killer 11
I didn't want to start a new tread so i bumped this.
So does anyone have any decent tool for making ottd maps from heightmaps???
Posted: 16 May 2005 19:30
by Abraxa
http://www.huebsch-gemacht.de/ttd/ wrote the correct link by request of chu_ (no unstable isdn server anymore) - Bjarni
Made by chu_
-Abraxa
Posted: 16 May 2005 19:48
by Killer 11
Maybe a binarie for windows???
Posted: 16 May 2005 20:56
by DaleStan
Killer 11 wrote:Maybe a binarie for windows???
Chris, I think maybe Killer wanted a binary?
Posted: 16 May 2005 21:23
by ChrisHuebsch
DaleStan wrote:Chris, I think maybe Killer wanted a binary?
I have neither windows nor a cross-compiler.
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.
Posted: 17 May 2005 04:06
by DaleStan
/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.
Posted: 17 May 2005 17:05
by ChrisHuebsch
DaleStan wrote:/me pokes at patch
/me posts new patch (against SVN 2335)
Fixed:
THX for that
DaleStan wrote:
Todo:
- Remove "Load land" button when WITH_PNG is undef (?)
- Fix title of "Reset Land" confirmation dialog
Done.
DaleStan wrote:
- Add a dialog to select which PNG file is loaded (currently map.png is hardcoded)
Still open. Can someone help with that?
Posted: 21 May 2005 13:28
by cccp
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?
Posted: 21 May 2005 15:54
by ChrisHuebsch
cccp wrote:
Bugfixes:
- flip image horizontally - TTD map is "backwards" horizontally from normal images
is it?
the png-pixel at position (0,0) becomes tile at (MapMaxX,0). why do rotate the image 90° to the left?
Posted: 21 May 2005 21:19
by DaleStan
cccp wrote:Also, shouldn't this be in the Development section?
Probably. Can someone with the appropriate powers move it?
ChrisHuebsch wrote: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?
It's not 90° to the left. It's a choice between 45° left and 45° right.
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.
Posted: 21 May 2005 21:31
by Born Acorn
I cannot get it to work. AT ALL.
keeps giving me crazy messages about resolutions, of which I have no idea are on about
Posted: 21 May 2005 21:46
by DaleStan
For now, the PNG *must* be the same size as the map. For a 512x512 map, you need a 512x512 PNG.
Posted: 21 May 2005 21:53
by cccp
ChrisHuebsch wrote:cccp wrote:
Bugfixes:
- flip image horizontally - TTD map is "backwards" horizontally from normal images
is it?
the png-pixel at position (0,0) becomes tile at (MapMaxX,0). why do rotate the image 90° to the left?
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.
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.
Posted: 22 May 2005 01:22
by DaleStan
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?
Posted: 22 May 2005 08:20
by Born Acorn
"Incorrect PNG Size"
All thats needed.
Now I resized it but its completely wrong, te heights has inverted themselves and the vlue is now higer than the land.
Posted: 22 May 2005 12:59
by cccp
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...)
Posted: 22 May 2005 13:43
by Born Acorn
3 is the best
(this is what Im getting. I need a 1024x1024 or 2048x2048 size for it)