Skip to content
Ted John edited this page Mar 1, 2022 · 34 revisions

OpenRCT2 has support for co-op multiplayer. It can be accessed by clicking the "Multiplayer" button in the Main Title.

Starting the server

To start the built-in server, click "Multiplayer" from the Main Title of OpenRCT2, and then select "Start Server". Specify the save that you want to host in the "Load Save" window to finish the start. The default port for OpenRCT2 is 11753 (TCP), this can be changed by manually editing the config file in your OpenRCT2 user directory.

In order for the server to successfully accept clients, the port must be open for the server's own firewall and any router's firewall the computer is behind. Additionally if the server is behind a router with NAT enabled, the router must be configured to have the port forwarded to the server's local address.

You can also launch a server by command line, e.g.

openrct2 host <saved game path> --port 11753

Dedicated server

OpenRCT2 also supports a headless mode where the game will run as a console application with no UI. This is useful for running dedicated game servers. This can be launched by the following command line:

openrct2 host <saved game path> --port 11753 --headless

Alternatively, on Linux, the openrct2-cli binary may be used:

openrct2-cli host <saved game path> --port 11753

Additional arguments:

Argument Variable Description
--headless N/A Runs OpenRCT2 without graphical interface.
--port Port number Changes the server port number.
--user-data-path Path to directory containing config.ini Changes the server configuration data path.
--password Password to set. Sets the server password.
--verbose N/A Output additional information to the console.
--help N/A Prints out help for CLI.

Setting permissions

The quickest way to setup permissions as of v0.2.7, is for you to join the server from a client and then on the dedicated server's STDIN terminal, and then change yourself to 'admin' role. Executing network.players in the terminal will print information about all the players connected to the server. Typically you would be the first user to join, so you will like be player index 1. You can change your player group to admin by running:

network.players[1].group = 0

Now you can make further changes to the permissions using the client as you will be admin.

You can modify other aspects of the server using the scripting API: https://github.com/OpenRCT2/OpenRCT2/blob/develop/distribution/openrct2.d.ts

Server hosting with a Docker container

One of the easiest ways to get a dedicated server up and running, is by using the official Docker container: https://github.com/OpenRCT2/openrct2-docker

Running as a service on Linux with systemd

To have an always-on server, OpenRCT2 needs to be run as a service. Create the file /etc/systemd/system/openrct2.service and change it where needed:

[Unit]
Description=OpenRCT2 server instance
After=network.target

[Service]
ExecStart=<path_to_openrct2-cli> host "<path_to_saved_game>" --headless

Type=simple
User=<username>
Group=<groupname>

[Install]
WantedBy=multi-user.target

Reload the systemd daemon:

systemctl daemon-reload

Enable the service:

systemctl enable openrct2.service

Start the service:

systemctl start openrct2.service

Starting the client

To connect to a server, click "Multiplayer" from the Main Title of OpenRCT2, and then select the server. If the server is not on the list, click "New Server", and enter the IP/hostname of the server. After that, click on the entry to connect the server. If the server is not running on the default port, you can specify that after the IP address, e.g. 127.0.0.1:22050.

To connect to a server by command line with the IP address 192.168.1.102 and listening on port 22050, run the following command (replace with the actual values of the server you want to connect to):

openrct2 join 192.168.1.102 --port 22050

Permissions

See Multiplayer permissions.

Desynchronisation

For a list of causes, see Multiplayer issues.

In order for network games to be reliable, they must stay synchronised. This works by each client always running the game slightly later than the server and never overtake its number of game ticks. When a player sends a game action (e.g. placing a path or opening a ride) - the action is sent to the server. The server then sends the action to all the clients - the clients then all run the action on precisely the same game tick as the server. So long as the game logic is deterministic, the games remain synchronised down to every peep position.

Currently there are still bugs relating to the initial connection setup and some of the user actions which cause the game state to diverge between the server and the client. If the client detects that its game state is not the same as the server, it will automatically disconnect. The client is able to reconnect to the server if this happens.

If you would like to ignore desynchronisation for testing purposes, you can enable the "stay connected" option in the options dialog. Warning: doing this can lead to strange side effects.

Alternatively set the following configuration option as a client in your config.ini file. This will alert you when the game has desynchronised but keep the connection open so you can still play.

[network]
stay_connected = true
Clone this wiki locally