Dedicated server

From SRB2 Wiki
Jump to navigation Jump to search

A dedicated server is a netgame server in which the host is not a player in the game. Instead, the host monitors the game from a terminal window, such as the Win32 console in Windows. The terminal window acts like the in-game console would normally, logging game events and allowing the host to execute console commands and set console variables. The host and other players can join the server normally. Dedicated servers are useful for hosting a server without having to be present in the game. This allows the host to leave the server running for other players while doing other things on their computer. Since the game window itself doesn't need to be displayed, dedicated servers also take up less CPU power than the regular game.

Hosting a dedicated server

To host a dedicated server, you must launch the game with the command line parameter -dedicated. To host on the Master Server, you also need to specify a room with the parameter -room XX, where the XX is replaced by the room's ID number. This should be 33 for the Standard room, 28 for the Casual room and 38 for the Custom Gametypes room.

If a console script file with the name adedserv.cfg exists in your SRB2 folder, it will automatically be loaded and executed upon starting a dedicated server. This allows you to specify game settings that you want to apply only when you're hosting a dedicated server.

Joining your own dedicated server

In order to join your own dedicated server as a player, you can connect to either 127.0.0.1 or localhost using either the Multiplayer menu on the title screen, the console command connect, or the command line parameter -connect.

Alternatively, you can download Shardvexz's Dedicated Server Tools from here, which will make hosting and joining your own dedicated server easier. Put these files in your SRB2 folder and execute them to automatically start or join your own dedicated server. Please note that the SRB2 Launcher found in the first redirect mentioned, which leads to the SRB2 Launcher/startSRB2 post, might not be fully compatible with SRB2 2.2, but the Dedicated Server Tools have been confirmed to work with SRB2 2.2. Also note that the download has been slightly edited from the MB version to include separate hosting files for the Casual, Custom Gametypes, and OLDC rooms, as they weren't in the MB version. The rest of the files remains unedited.

Note that you will join your server as a normal client without host privileges. To perform administrative actions, you must give yourself administrative privileges by promoting yourself or logging in with a password. Only the host can promote players or set the password, so you will need to do this from the dedicated server terminal window. Likewise, some console variables, such as allowjoin or blamecfail, can only be set by the host, so you must set them through the terminal window as well.