Transport Fever

Transport Fever

40 ratings
Easy Custom Map Creation
By Xanos
A short explanation on how to create your own heightmaps for Transport Fever.
Introduction to the Transport Fever Map format, map.lua file and tutorial on how to use the third party "map creator tool".
   
Award
Favorite
Favorited
Unfavorite
Introduction
In order to play your own custom map in Transport Fever, you first need a heightmap.
Heightmaps may be drawn by hand, generated with third party tools or represent real-world data.
For your first heightmap, you may search for "heightmap" in Google and just use one of the images you find.
Other sources include terrain.party[terrain.party], a realworld heightmap exporter for Cities Skylines, direct STRM export, e.g. from here[srtm.csi.cgiar.org], or any tool of your choice.

Once you have your heightmap, you have to make sure to meet certain criteria in order for Transport Fever to correctly load your map.
The Transport Fever Map Format - Explained
The File Structure
Transport Fever expects a certain file structure for custom maps.
All custom maps have to be placed in the maps/ folder in the Transport Fever installation directory.
In order to open your installation directory, go to your Steam Library, right click on Transport Fever, click on Local Files, click on Browse Local Files.
In the maps/ folder, each maps has its own folder and features two files: heightmap.png and map.lua.

Example folder structure for a map:
  • Transport Fever
    • maps/
      • custom_map/
        • heightmap.png
        • map.lua


heightmap.png
The heightmap.png file represent the actual height data of the map.
The darker the image, the lower the terrain. The lighter the image, the higher the terrain.
The heightmap.png has to be saved as grayscale image. This is important has has to be made sure in the image processing software of your choice.

The size of the image directly reflects the size of the map:
1 pixel = 4 meter
The size of the image is limited to certain dimensions. A edge of the image may have the following values:
1025, 2049, 3073, 4097, 5121, 6145, 7169, 8193 [, 16385, 32769]
For simplicity, this guide will round each value down to the next thousandth, e.g. 4097 -> 4k
The maximum size of the custom map is currently restricted to 16M, thus 4k × 4k, or 2k × 8k, etc.
This limit may be lifted in future versions of the game.

map.lua
The map.lua file is a text file containing lua script with requried parameters further explaining the map to the game.
An example map.lua file may look like this:

local towns = { {pos = { 286.76619962477, -3641.505 }, name = _("Berlin"), sizeFactor = 1}, } local industries = { {pos = { 56.39401575985, 3272.745 }, fileName = "industry/chemical_plant.con" } } function data() return { authors = { { name = 'Xanos', role = 'CREATOR', steamProfile = '' } }, name = _('Example Map'), description = _(''), minGameVersion = '1000', range = {50, 150}, seed = '', --startDate = { year = 1850, month = 01, day = 01 }, tags = {'map'}, towns = towns, industries = industries } end

Let's go through the code:
The data() Function
The main part of the file is below function data() return {
This is the function that is called by Transport Fever to get information about the map.
First, the author of the map is defined by name and role.
Afterwards, we define the name of our map and can also give an additional description.
The minGameVersion defined the lowest build number required to load this map, in case that later versions of the game add new functionality that may be required.
The most important value is the range. This defines what height should be mapped to totally black and totally white areas of the image.
The first value denotes the blacks, while the second value denotes the whites.
The water level is always at 100 meter, thus every point of the map below 100 will be under water.
The second value (highest point, resp. white) has to be above water, otherwise the map will not be generated.
seed and startDate are optional parameters definind a seed for the random generator and a fixed start date for the map.
tags should contain "map" and may feature other information.
The last two entries, towns and industries refer to placement information of our towns and industries.

For a better overview and more clean code, those are defined in individual variables that are defined above our data function.

Towns and Industries
Towns and industries may be defined optionally. If not defined, they will be placed by the random generator.
There have to be towns on the map in order to the game to load.
However, industries may be placed outside of the map boundary in order to prevent the random generator to kick in and subsequently start with a map completely without industries.
In our example code, a single town and a single industry are placed.

Towns have to feature a position (pos), name and size factor (sizeFactor).
The position is given in meter from the center of the map whereby the y-coordinate is flipped with regard to normal image processing tools.
The name is the initial name of the city upon starting the game.
The sizeFactor is the initial size of the city. 1 is normal size, 0.5 is half and 2 is double the size.
The city will develop over time, the value only represents the initial size.

Industries feature a position (pos) angle, and construction file name (fileName).
Position is analog to towns, while the angle additionally determines the rotation of the industry.
The file name determines what industry is placed and has to be an existing construction that is either part of the main game or added by a mod that has to be loaded when starting the game.

Your First Map
In order to create a map, you may try to crate a heightmap.png with correct dimensions and of type grayscale and add a minimal map.lua, e.g.:
function data() return { authors = { { name = 'Xanos', role = 'CREATOR', steamProfile = '' } }, name = _('My Test Map'), description = _(''), minGameVersion = '1000', range = {50, 150}, --seed = '', --startDate = { year = 1850, month = 01, day = 01 }, tags = {'map'}, towns = {}, industries = {} } end
When starting a new map, select a custom map instead of a map size.
Remember, the dimension of the image directly define the size of the map in game.
Make Your Life Easy: TpF Map Creation Tool
Understanding the map format and the prerequisites will help you in creating maps more easily.
But even with good understanding of the mechanics, you may make you life more easy by using third party tools.

One of these tools is the Transport Fever Map Creation Tool.
This tool allows you to load any image and will make sure that the format and dimension of the image are corrected for Transport Fever.
You may also place towns and industries by graphically selecting a location on the map.
At the end, you can export your final map with a single click and place it in the Transport Fever installation directory.
The tool makes sure that the directory and file structure is correct.
You only need to worry about playing your freshly created map.

The tool is currently still in development, please report bugs here[www.transportfever.net].

You may want to have a look at this tutorial video on how to create custom maps with this tool:
19 Comments
D.N.MAN 10 Jan, 2023 @ 2:26pm 
Greetings, Map Creation Tool does not work any more, can you fix it?
Edderward 11 Jan, 2019 @ 10:04am 
Also, if you have a problem with creating a road network, adjust the height settings. It seems that the maximum height difference is too large to built roads. So you need to "flatten" the map some times...
Edderward 11 Jan, 2019 @ 10:02am 
For a black-white height map I used the followin site https://tangrams.github.io/heightmapper/

(Tip: go to the area you want, export the map. Hold your screen at the same location and turn on map labels (and lines). Now you can position the towns and cities more accurately.
Hans 13 Jun, 2018 @ 9:38am 
WARNING: There is a link with a high Norton Internet Securety warning in Havan_IronOak message from feb 22.
The link must be https://terrain.party/
Xanos  [author] 25 Feb, 2018 @ 12:42pm 
Grayscale images not accepted by the game are not "real" single-channel grayscale but just RGB images with desaturated channels.
The "Map Creation Tool" will always create real heightmap images as required by the game!

The "stairs" problem occurs when using 8bit per channel.
This is common for RGB images (32bit/pixel with RGBA channel = 8bit / channel)
The "Map Creation Tool" also works with 16 bit per channel images and will also save images as single-channel 16 bit gray sccale images.
However, if the source image is only 8bit/channel, the "lost resolution" cannot be recreated by the tool.
In this case, use less height dynamic (smaller range between lowest and highest point on the map) or blur the image with a image editor program that supports 16 bit.

BTW, the current gimp release version (2.8) does not support 16 bit. Only the preview version 2.9 does.
Whiskers 8 Sep, 2017 @ 1:27pm 
I wish they were smart and put a good editor accesible from the main menu.
Gideon Svart 22 Aug, 2017 @ 11:55am 
Cant create grayscale image. I use ACDSee, just save image in png, and game not accept it. Where to click to get a grayscale image?
Map creation tool have a critical bug - after export heightmap in game it turns out with the effect of stairs. =\
DaVinci 21 Jul, 2017 @ 8:48am 
can i add to a map also assets, buildings, stations and so on? how?
DaVinci 21 Jul, 2017 @ 8:48am 
where i can find all the available industries?
Old Soldier 7 Mar, 2017 @ 9:31pm 
This is an incredibly useful guide. Thank you _so_ much for sharing it.
Being something of a troglodyte, I admit I did struggle at first; but eventually was able to get my first custom map up and running. It's not perfect but it's playable.


Thanks again, mate!