If you want to host multiplayer network games, you need to set up an OpenTTD server on your computer. This guide will explain how to do it and how to forward the ports if you’re connecting to the Internet through a router.
Starting the server
2. Click Start Server
3. Pick a name for your game to help others identify it, and enter it into the Game name box
4. Configure the additional settings:
- Set Password sets a password for the server so that only users who know the password can join your game.
- Connection specifies whether the server is for local/private use only, or advertises itself to the master server so it is visible in the internet server list.
- Language Spoken is for requesting that users speak a certain language on your server.
- Max clients limits the total number of clients (players and spectators) that can connect.
- Max companies limits the number of companies at game.
- Max spectators limits the number of clients who can connect to watch but not play (not-players).
5. Click New Game (to generate random new game), or Load Game (to continue an saved game), or Play Scenario, or Play Heightmap.
Connecting to the server
If some players are connecting via the public Internet, however, your server will only appear if you have chosen “Internet (advertise)” under “Connection” (there may be a delay of several minutes before it is visible). Otherwise, they will need to know your router’s IP address, or your computer’s if you aren’t using a router. This can be obtained by visiting https://www.whatismyip.com/.
If you’re using a firewall
Port forwarding
If you want your server to be visible on the public server list (recommended), you will also need to forward UDP connections to port 3978.
How to setup a port forwarding:
1. Go to your routers setting. ( http://192.168.0.1/ or http://192.168.1.1/ )
2. Enter the login and password. ( Usually it’s admin/admin )
3. Find the DHCP clients list and copy your PC mac adress.
4. Reserve the local IP ( for example 192.168.0.100 ) for your mac adress. You might need to reload the router afterwards.
5. Find the Port forwarding/Virtual servers tab and add the new rule.
6. Enter the service port ( 3979 for OpenTTD ) and local IP adress you just reserved for your PC. Choose both TCP and UDP connections and save the rule.
7. Make another rule for port 3938 ( UDP only ) if you want your server to appear on the OpenTTD site.
8. Reload the router
Note that you wont be able to host the server if you have a private IP. To check if it’s private you should compare your WAN IP adress from router settings and the one from https://www.whatismyip.com/ .
If it’s different then your IP is private and you should contact your internet provider to buy a public one.
Dedicated server
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.
Method 1:
- Create a shortcut to openttd.exe
- Right-click on the shortcut and click Properties
- Add -D onto 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
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.
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
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”
In the dedicated server window (or with rcon):
- Type ls to 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”.
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
Related Posts:
- OpenTTD: Savefiles for All Versions (Past Main Menu)
- OpenTTD: How to Install the DOS Graphics & Sound Effects & Music
- OpenTTD: How to Place Your Stations Efficiently
- OpenTTD: Simple Train Station Configurations