server that does not have a local client taking part in the game. A dedicated server can run in the background on a computer.
Starting a dedicated server
Run the OpenTTD executable using the
-D (capital D!) command line option.
- Create a shortcut to
- Right-click on the shortcut and click Properties
-Donto the end of the Target line
- Click Apply
- Run the shortcut
- On the start menu click Run
"c:\(path to openttd)\openttd.exe" -D
- Click OK
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 avaible. All output will be sent to the file openttd.log. You can display the log with tail : tail -f openttd.log to follow events.
- Run the
dedicated.cmdfile. If you run
openttd -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.
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.
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
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).
rcon <password> "<command>".
rcon x8na7f "kick 5"
Installing online content
If you want to install content using the in-game content download facility, you can do that from the console in your dedicated server. The benefit of using this compared to copying the files manually to your server is that it will automatically get all dependencies that the content author has declared when uploading it to the content system.
- First, you need to load the list of available content from the server:
- Wait until "Content server connection closed" is printed in the console.
- List all available content
- A list of available content is now printed. Find the content you like to download and read its ID which is written in the beginning of the line. Eg. 2947 for Simple City Builder.
- Next, select the content to download using its id:
content select 2947
- You can add more content by repeating the
- Then download all selected content:
Hint: If you use nightly r26000+ or stable 1.4+, you can type
content state city to only list content that contain the word 'city' in their name.
Loading a game
In the dedicated server window (or with rcon):
lsto list the files of the current directory, a number will be beside each one, which represents
cd <number>to go to that directory.
load <number>to load that file.
- You can also load savegames and scenarios with the
-g "<filename>", command line option.
openttd.exe -D -g "scenario/echo.scn".
Automatically start/stop and save your game
If you 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
- Autoclean companies in order to specify what happens when a player logs off during a game and a company becomes inactive