Page 1 of 1

Generating a city or region from a height map image

Posted: Wed Jun 26, 2019 14:58
by Lobby
Hi, in recent versions of the game you can create cities and regions from height map images. Such images look like that:
The brightness of each pixel determines the height of the corresponding tile in the city. The brightness ranges from 0 to 255, with 10 being the sea level. Dependent on where you have your height maps from you may have to adjust their contrast and brightness. See the entry on Wikipedia for more information about height maps.

You can get real world height map data for example from

In order to generate a city from a height map place the height map image file into your TheoTown folder and remember its name. Then go into the game, create a new city, and enter the name of the height map file (including the file ending) into the seed text field. The picture will be scaled to match the selected city size.
Append #somerandomtext to add some randomness to the map generation in case you are not happy with the result (e.g. the biomes on the map).

The game also allows you to generate a region out of a height map. To do that, use the following scheme for the cr console command:

Code: Select all

cr:{name:"New York",bmp:"ny.png",size:12,maps:[0,0,6, 6,0,6, 0,6,6, 6,6,6]}
See the topic about generating regions for more information about the cr command and how to use it. Note that you have to enable debug mode and experimental features in the setting in order to use the console.
The result :img
The height map that's used here is a part of New York and was extracted using :img
Note how dark the image is because of the lack of hills in New York.

This feature is compatible with all recent versions of the game :66:
However, the version for iOS doesn't support 16 bit (per channel) images right now. This is a special format that is used by some height map creators; you may have to save them with an image program to make them compatible with the game.

Re: Generating a city or region from a height map image

Posted: Wed Jun 26, 2019 20:22
by SomeIndianGuy
So TT now has incorporated elements from Openttd now?