From time to time I play OpenTTD with friends. When we do we usually play a map for quite some time. This requires a dedicated server and I had one running on my Raspberry Pi for quite a while. However I reinstalled Raspbian and therefore had to setup the OpenTTD server again.
Since I forgot all the steps and there still is no arm package of the latest release, I had to compile the source code and figure out all the steps for the setup again. Next time I will have this guide to look at.
This guide is based on a fresh raspbian install. Login as the default pi user using SSH or if you do this from within the desktop just start the terminal. Make sure you are in your home directory:
tar xvzf openttd-1.6.1-source.tar.gz
sudo apt-get update sudo apt-get install build-essential pkg-config libsdl1.2-dev subversion patch zlib1g-dev liblzo2-dev liblzma-dev libfontconfig-dev libicu-dev
cd openttd-1.6.1/ ./configure --enable-dedicated make --jobs=4
On multicore systems like the Raspberry Pi 2 and Raspberry Pi 3 you should use multiple threads to compile faster. Under Linux the number of logical cores can be obtained using:
sudo make install
To automatically start and stop the OpenTTD server I use the OpenTTD Init Script written by Frode Woldsund:
cd ~ wget https://bitbucket.org/frodus/openttd-init/downloads/openttd-init-1.2.1.zip unzip openttd-init-1.2.1.zip
sudo apt-get install screen
sudo ln -s ~/openttd-init/openttd /etc/init.d/openttd chmod 755 ~/openttd-init/openttd sudo update-rc.d openttd defaults
mv openttd-init/config.example openttd-init/config nano openttd-init/config
In the config file I only changed the username:
The old OpenTTD graphics don’t look good. There is a 32bit replacement called zBase and I like it a lot. The install can be done like this:
wget http://binaries.openttd.org/bananas/basegraphic/zBase-v5588.tar.gz gunzip zBase-v5588.tar.gz mkdir -p .openttd/baseset mv zBase-v5588.tar .openttd/baseset
Note: If you don’t install a graphics set at this point the server won’t start! You won’t see an error message because of the startup script! If you don’t like zBase you need to install another graphics set instead!
To create a config file I just created an empty config file and started and stopped the OpenTTD server to fill it with the default values:
touch ~/.openttd/openttd.cfg sudo service openttd start sudo service openttd stop
Afterwards the config file can be edited
Here are the basic settings I changed:
; set passwords for the server server_password = letmein rcon_password = letmein admin_password = letmein ; set a name for the server server_name = Noki's Server ; Pause game without active clients min_active_clients = 1 ; increase number of vehicles to maximum max_trains = 5000 max_roadveh = 5000 max_aircraft = 5000 max_ships = 5000 ; set the curreny currency = EUR ; set map size to 512x512 map_x = 9 map_y = 9 ; set start year to 1970 starting_year = 1970 ; set autosave to yearly autosave = yearly
In addition I usually change the cargo distribution to async:
; change the cargo distribution to async distribution_pax = 1 distribution_mail = 1 distribution_armoured = 1 distribution_default = 1
There is a documentation for the openttd.cfg settings in the OpenTTD wiki.
Finally I setup a cronjob that creates a savegame every six hours:
sudo crontab -e
I add this line and save the file:
0 */6 * * * /etc/init.d/openttd autosave
With the Universal Rail Type NewGRF train replacement becomes easier. It allows to use Autoreplace to convert engines and wagons into models of other rail types. This is especially usefull for upgrades to monorail and maglev.
The install is easy:
I usually do it once the server is up and running. I just use the admin console to install it:
rcon letmein "content update" rcon letmein "content state" rcon letmein "content select 2699" rcon letmein "content download"
Then I stop the server:
sudo service openttd stop
Then I enable the railtype in openttd.conf:
[newgrf] Universal_Rail_Type-2.0.1/universalrailtype.grf =
Then I start the sever:
sudo service openttd start
And finally I start a new game using the console:
rcon letmein "newgame"
I really wish there would be an debian package for arm that makes installing and updating OpenTTD simpler. However next time I will just look at this post and manage to reinstall OpenTTD in minutes.
Feel free to contact me if you have anything to add to this guide.