A dedicated server is a OpenTTD network game Server that does not have a local client taking part in the game. A dedicated server can run in the background on a computer.
Contents |
Starting a dedicated server
Run the OpenTTD executable using the -D (capital D!) Command line option.
To load a specific save file, add -g savename.
In Windows
Method 1:
-
Create a shortcut to
openttd.exe - Right-click on the shortcut and click Properties
-
Add
-Donto the end of the Target line - Click Apply
- Run the shortcut
Method 2:
- On the start menu click Run
-
Enter:
"c:\(path to openttd)\openttd.exe" -D - Click OK
In Linux
-
Run
openttd -Din a terminal. If you are connecting to the server via SSH and would like the game to run when you logout you should use GNU Screen or dtach.
You can also start openttd with -f option. It means that the process will run in the background, but no console will be available. All output will be sent to the file openttd.log. You can display the log with tail : tail -f openttd.log to follow events.
In OS/2
-
Run the
dedicated.cmdfile. If you runopenttd -D, you will not see a console window and will be unable to provide commands to the program.
In Mac OS X
- Open Terminal.
- cd into the directory with OpenTTD
- type cd OpenTTD.app/Contents/MacOS/
- type ./openttd -D
- OpenTTD should start up in Dedicated Server.
In Docker.io
- See https://registry.hub.docker.com/r/bateau/openttd/ for more details
Configuring the server
There are 3 ways to change the game options:
- Launch a single player game, change the settings, and close the game.
- Use the console commands to control the server while it is running.
- Edit the Openttd.cfg file manually. See Diff custom for some help.
Available Tools:
Change the network settings in the Network section of Openttd.cfg:
- Set Lan internet to 0.
- Change Server name so you can identify the server,
- Set Server advertise to true, so it will be visible on the Server list
- If you have multiple network interfaces make sure you set Server bind ip.
- If you are behind a router, make sure that you forward the port specified by Server port (both TCP and UDP)
Controlling the server with rcon
Configure the dedicated server to accept rcon commands:
-
In the dedicated server window, type
rcon_pw <password>.
Example:
rcon_pw x8na7f
Connect to the server as a client:
- Launch OpenTTD normally.
- Find your server on the multiplayer list and connect to it.
- Open the console (~ key).
-
Type
rcon <password> "<command>".
Example:
rcon x8na7f "kick 5"
Installing online content
Online content (NewGRFs) can be added to the server from the console using the content command. This is preferable to manual installation, because it includes dependencies and updating.
- First, you need to load the list of available content from the content server:
-
content update Wait until "Content server connection closed" is printed in the console.
- Find your content
-
content state [filter] This will list all content that matches
filter. If you omit the filter, it will list all content on the server.
- Next, select the content to download using its id, which is the first number listed in the previous command's output:
-
content select 2947
-
You can add more content by repeating the
content selectcommand.
- Then download all selected content:
-
content download
Note: This will not activate the content, you will need to modify the game settings to use it.
Loading a game
In the dedicated server window (or with rcon):
-
Type
lsto list the files of the current directory, a number will be beside each one, which represents<number>below. -
Type
cd <number>to go to that directory. -
Type
load <number>to load that file.
-
You can also load savegames and scenarios with the
-g "<filename>", command line option.
Example:
openttd.exe -D -g "scenario/echo.scn".
Automatically start/stop and save your game
If you do not want to run docker: Run your dedicated server in ubuntu/debian you can download and install a init.d script You will get the following functions:
- Automatically startup when your server box bootup
- Automatically shutdown when you server box is shutdown
- Automatically saving your game at a defined interval
For more functions, install guide and download, visit: https://bitbucket.org/frodus/openttd-init
With a ready-made docker container you get a tested and working environment for openttd. In ubuntu 14.04 or newer you can run: sudo apt-get install docker.io and then read documentation on the following url https://registry.hub.docker.com/r/bateau/openttd/ Mind that this is a pre-configured virtual machine and packaging is done by 3rd party.
See also
- Autoclean companies in order to specify what happens when a player logs off during a game and a company becomes inactive
- A short intro on Firewalls for Dedicated Servers [1]








