Compiling Simutrans

Normally you install and run Simutrans from one of the available executables, but if you wish to modify the source code yourself, and perhaps create patches and contribute to the development of the executable, you will need to be able to compile Simutrans yourself. This is a short guide on how to do just that.

If you are on Windows, download either Microsoft Visual Studiolink-external or MSYS2link-external. MSVC is easy for debugging, MSYS2 is easy to set up (but it has to
be done on the command line).

These instruction are based on the readme.txt distributed with the source code. Please consult that document for any updates that might have been added since this page was last updated. You can also check the Development Support subforum link-external

Getting the Source Codelink

You can download the latest version with a SVN client. The primary repository for the Simutrans source code is
$ svn checkout svn://servers.simutrans.org/simutrans/trunk

If you prefer to use git, there is a mirror of the svn repository available thanks to aburch at github which you can make a local clone of:
$ git clone http://github.com/aburch/simutrans.git

Note that the svn repository is the main repository, and the git repository is just a mirror. If you use git instead of svn, you will need to set the game version manually for network play.

Getting the librarieslink

Simutrans required librarieslink

This is a list of libraries used by Simutrans. Not all of them are necessary, some are optional, so pick them according to your needs.
Library Website Necessary? Notes
zlib https://zlib.net/link-external Necessary Basic compression support
libSDL2  http://www.libsdl.org/link-external Necessary* *On Linux & Mac. Optional but recommended for Windows. Graphics back-end
bzip2  http://www.bzip.org/downloads.htmllink-external Optional Alternative compression. You can pick this or zstd
libzstd https://github.com/facebook/zstdlink-external Optional Alternative compression. You can pick this or bzip2
pkgconf http://pkgconf.org/link-external Optional Needed by FreeType/SDL/makeobj
libpng http://www.libpng.org/pub/png/link-external Optional Used by makeobj
libfreetype http://www.freetype.org/link-external Optional TrueType font support
libminiupnpc http://miniupnp.free.fr/link-external Optional Easy Server option
libfluidsynth https://www.fluidsynth.org/link-external Optional* *Needed for music on Linux. MIDI playback with support for changing soundfonts.
libSDL2_mixer http://www.libsdl.org/link-external Optional Alternative MIDI playback and sound system.

Libraries for MSYS2 / Linux / Maclink

Library Brew (Mac) Debian/Ubuntu Arch Linux Fedora OpenSUSE MSYS2
zlib zlib zlib1g-dev zlib zlib-devel zlib-devel mingw-w64-x86_64-zlib
libSDL2  sdl2 libsdl2-dev sdl2 SDL2-devel libSDL2-devel mingw-w64-x86_64-SDL2
bzip2  bzip2  libbz2-dev bzip2  bzip2-devel libbz2-devel mingw-w64-x86_64-bzip2
libzstd zstd libzstd-dev zstd libzstd-devel libzstd-devel mingw-w64-x86_64-zstd
pkgconf pkg-config pkgconf pkgconf pkgconf pkgconf mingw-w64-x86_64-pkg-config
libpng libpng libpng-dev libpng libpng-devel libpng16-devel mingw-w64-x86_64-libpng
libfreetype freetype libfreetype6-dev freetype2  freetype-devel freetype2-devel mingw-w64-x86_64-freetype*
libminiupnpc miniupnpc libminiupnpc-dev miniupnpc miniupnpc-devel miniupnpc-devel mingw-w64-x86_64-miniupnpc*
libfluidsynth fluidsynth libfluidsynth-dev fluidsynth fluidsynth-devel fluidsynth-devel mingw-w64-x86_64-fluidsynth*
libSDL2_mixer sdl2_mixer libsdl2-mixer-dev sdl2_mixer SDL2_mixer-devel libSDL2_mixer-devel mingw-w64-x86_64-SDL2_mixer

Libraries for Microsoft Visual Studiolink

  1. Download MSVC Studio Community edition.
  2. Download a git tool and clone https://github.com/Microsoft/vcpkglink-external to and arbitary directory.
  3. Run bootstrap-vcpkg.bat
  4. Copy install-building-libs.bat from simutrans/trunk to this folder and execute it.

If you are using other version or prefer to compile the libraries yourself, check the forum thread link-external.


Go to the source code directory of simutrans (simutrans/trunk if you downloaded from svn).

Automatic configurationlink


  1. Open a terminal and run autoreconf -ivf
  2. Now run ./configure
  3. Type make AV_FOUNDATION=1 to compile Simutrans*
  4. Also type make OSX/getversion

  • AVFoundation must be specified on MacOS 10.12 or later, but the midi playback is currently broken. If you care about music try Fluidsynth (USE_FLUIDSYNTH_MIDI=1) instead.

GCC Systemslink

  1. Open a terminal and run autoconf
  2. Now run ./configure
  3. Finally type make to compile Simutrans

Microsoft Visual Studiolink

Simutrans solution is a single solution file with 4 projects:
  • Simutrans-Main: The project that holds the shared, non back-end specific, files. All the followings use Main to build the specific back-end executables.
  • Simutrans SDL2: Prefered backend for Simutrans.
  • Simutrans GDI: Windows-only backend.
  • Simutrans Server: Server backend with no graphical interface.

There are 3 compilation configurations for the main executable:
  • Debug is meant for developing
  • Stable is meant for compiling stable versions
  • Release builds optimised code but using revision data just like debug. This is meant for creating optimised nightly builds for servers.

Manual configurationlink

  1. Go to the source code directory of simutrans
  2. Copy the file config.template to config.default and edit the file. You need to specify:
    • BACKEND = sdl2
    • OSTYPE = (you should know it)
  3. Additionally, you may want to set the following flags too:
Flag Description
OPTIMISE=1  Add umpteen optimisation flags
DEBUG= 1  Up to 3, enable the debug build
MULTI_THREAD = 1  Enable multi-core CPU support
USE_FREETYPE = 1  Enable Truetype font support. Set also FREETYPE_CONFIG
FREETYPE_CONFIG=freetype-config If it fails, try with FREETYPE_CONFIG=pkg-config freetype2
USE_UPNP = 1  Easy server hosting behind routers
USE_ZSTD = 1  Compression for savegames
USE_FLUIDSYNTH_MIDI = 1  Use Fluidsynth music backend for MIDI playback

Finally, type make. If you want a smaller program and do not care about error messages, you can comment out #DEBUG=1 and run strip sim (Unix) or strip sim.exe (Windows) after compiling and linking.


If you want to cross-compile Simutrans from Linux for Windows, see en_Cross-Compiling_Simutrans page.


If you want to contribute, read the coding guidelines in simutrans/documentation/coding_styles.txt
You definitely should check out the international forumlink-external as well.


Rate this page:

Contributors to this page: Roboron3042 , Frank , IgorEliezer and system .
Page last modified on Friday March 26, 2021 19:09:07 CET by Roboron3042.