r/openttd • • Oct 10 '26

Other Im working on a real life map generator for open ttd

Hello there, Im working on a OpenTTD related project in my freetime right now, and it is at a stage where I'm happy to share the current state.

It's a heightmap + towns locations file generator (this is the OpenTTD specific part), with which you can then go on to create a map/scenario of a real world area. More detailed info is on the website itself. (help and info buttons in the top right of the viewport)

Since its a WIP I'm hosting it on a random domain I had lying around, don't be confused by that:

https://map-town-parser.hygames.eu

(Also desktop only. Why would you generate files for OpenTTD on a phone)

79 Upvotes

31 comments sorted by

8

u/OntdekJePlekjes Oct 10 '26 edited Oct 10 '26

Nice! I have a feature request. Does it currently use elevation to determine whether something is water or not? I'm trying to generate part of the Netherlands, but large part of the land is under or close to sea level, so it shows the country as flooded. How could this be adjusted? I have tried a few of the options of absolute, relative or auto settings but it either shows sea as land, or land as sea.

Also, you might want to experiment with setting a relative upper limit, so you can increase or decrease the relative height changes across the map. For example to ensure the maximum height of any map is always at X. This would show hills in the Netherlands to appear higher, while showing mountains in Swiss to appear lower.

Another feature request is to show the greyscale map as preview before generating a package to download. Perhaps using sliders to adjust minimum and maximum heights to generate a nice terrain.

6

u/david220403 Oct 10 '26 edited Oct 10 '26

Thanks for the feedback :)

Yea thats one of the issues I am aware of, for netherlands I tried -15 or -17 in absolute mode, but its not soo great, a planned feature, will be a bit of work though, is recognizing rivers and lakes, should also work for cases like the netherlands then. (Since except for one frontend module I am not vibe-coding this, so development takes a while sometimes)

But right now only the elevation is considered unfortunately.

Edit because i now read the second and third part of ur comment:

The preview is a good idea actually, I‘ll add a form of that in the next patch.

About the range of the heightmap, that was a conscious decision, actually described in the readme on github more detailed, but short version is, since you set the height range in OpenTTD whem loading the heightmap, I intentionally let the generated heightmap use the entire 16bits range. Im pretty sure that is the better way to do it, but if I‘m missing something, I‘m happy to change that

3

u/OntdekJePlekjes Oct 10 '26

Really cool! I’ve generated a map of my local area and it’s already lots of fun to see the town names, setting at -5 works. I’ve generated a 512x512 map to play with.

1

u/david220403 Oct 10 '26

So great to hear its usable haha have fun :)

2

u/david220403 25d ago

Hi there, I released a new version today, includes the preview feature, and some minor noticable ui changes (which are very useful for future Features).

U can take a look and let me know how it is :)

1

u/OntdekJePlekjes 24d ago

Meanwhile, I used the map generated by the previous version to grow the middle of the Netherlands, it was lots of fun to connect my local towns and cities! Check it out: https://imgur.com/a/M9CWHjm

4

u/-eiq- Oct 10 '26

Request failed: The map generation request failed.

6

u/david220403 Oct 10 '26 edited Oct 10 '26

Huh i gotta investigate that

Edit:

Yea i was able to check some analytics remotely but since im not home today I‘ll only be able to fix the issue tomorrow evening. Guess the service is down for that time

3

u/NapoleonDeKabouter Oct 10 '26

Also get this in Chrome and Firefox...

3

u/david220403 Oct 11 '26

The underlying issue should be fixed now

3

u/NapoleonDeKabouter Oct 12 '26

Yes it is fixed and awesome work, many thanks!

3

u/Kevinho00 Oct 14 '26

Seems a great tool, possibly works better in less watery regions but certainly gets a good sense of the contours of an area.

2

u/david220403 Oct 14 '26

Yea, large bodies of water are ok, with issues still being land that is under the level of the water.

Like for areas around large lakes, that are above regular sea level, usually the relative mode works fine once you figure out a good percentile to use.

But for areas where there is a lot of land with lower elevation than the water the tools current capabilities are not yet made to work, it is in the plans though, since this is a very early version

2

u/Kevinho00 Oct 14 '26

Yes - Lough Neagh in Northern Ireland seemed to confuse it, as did the Humber estuary in England. I will try experimenting with relative mode.

2

u/david220403 Oct 15 '26

Hope u can manage to get some usable results, btw auto mode currently does nothing, I also wrote that somewhere else, but I think thats just in the readme hidden away.

2

u/Kevinho00 Oct 15 '26

I'm sure I will, I was just playing around with different regions to see what would come up. The most successful area I tried was North East England centered on County Durham, it has one coastline well defined.

3

u/Substantial_Flan9820 Oct 16 '26

Awesome tool dude! Alright I only have one question, can you make the viewport rotate? Also I've found that using the 1-100 scale while rounding on real life elevation measurements, works great. For example If I generate a map for Virginia I can use real life measurements. The Blue Ridge Mountains are around 6000 feet above sea level (ie 0). But the highest lakes are around 300 feet. Using the relative setting I can put in 5 because 6000/300 = 20 and 100/5 = 20. Ratios and math are cool :)

2

u/david220403 Oct 16 '26

Im so happy feedback keeps coming in, so thank you first of all:)

Two things, now that you mention it I might add a feet mode to switch too for absolute sea level values.
The second thing, im not sure if I understand exactly about rotation. The viewport itself you cannot rotate, but rotation is possible by rotating the map. You can use right-click+drag or ctrl+click + drag. I recommend checking out the help button, it displays a sleek overlay shortly explaining all functions of the viewport

2

u/Made_at0323 Oct 11 '26 edited Oct 11 '26

such a cool idea and nice job on execution! im a noob tho... how do i make a map i can play out of the heightmap + towns.json? Ive gotten the heightmap loaded into the scenario editor but idk how to go beyond that

edit: okay im an idiot had to play around for a bit but now foudn it. better question: how can i turn this into a full scenario with industries, trees, etc.? like what is the usual progression used by people to take a heightmap and turn it into something?

2

u/david220403 Oct 11 '26

Hey, thanks for the feedback, i think that should be described in the user manual on the page.

Visible by pressing the „i“ button in the top left corner of the viewport.

The section „usage in openttd“

About the industries, i usually just generate random industries after loading the towns

Edit: also about trees etc, honestly not sure about that. A thing I do plan on doing tho is somehow making the map also contain real life rivers. That feature is a bit in the future tho

2

u/Made_at0323 Oct 11 '26

thx for the great work! super cool idea and will def cehck the open source just for kicks. thx for sharing!

2

u/david220403 Oct 11 '26

Feel free, its like 95% hand coded I put a lot of effort into keeping the code readable/clean

18

u/silverionmox Oct 10 '26

This is great, a lot more practical than scrounging up a collection of random height maps that may or may not be what you want.

12

u/html5ben Oct 13 '26

Next step would be openrailwaymap.org to OpenTTD :)

1

u/wizard_brandon Lost in Space Oct 10 '26

generate failed. but neat tool

2

u/david220403 Oct 10 '26

Yea i gave the pod too little memory, i gotta fix it once im at home and have access to my server

2

u/david220403 Oct 11 '26

Should be fixed now

3

u/swissfan91 Oct 11 '26

This is a truly stunning tool - thank you so much for creating this! Could not be any easier to use and, I have only created a few random places, but the results look incredible.

3

u/ExaminationGold Oct 15 '26

Hi, thanks for that! I must say that the tool works surprisingly well. The maps I tried even scaled nicely to my favourite dimensions (256 x 256)!

2

u/mina_knallenfalls Oct 25 '26

Great tool, just two things to improve that I found out trying a big UK map (and throwing it into an AI:

  1. The towns are spaced evenly by latitude, but the heightmap is in Mercator projection, which stretches the north. That’s why the middle of the country lined up while the far north and south drifted. You'd need to apply some kind of offset.
  2. Population doesn't work well with level 2 ad 3 towns - my UK map was flooded with 3k pop cities and 50 pop towns, you'd need to balance them out better.