Dedicated server

From PZwiki
Revision as of 09:07, 31 July 2019 by Vaileasys (talk | contribs) (added/moved links)
CommunityMultiplayerDedicated server

Hosting a Project Zomboid dedicated server can be done in Windows and Linux.

Steam Server

Through the Steam Client

  1. Go to your Library and then Tools.
  2. Scroll until you see "Project Zomboid Dedicated Server" and download/install it.
  3. Once downloaded, run the program.

That's it. Now connect to the server through the game (if hosting it on the same computer being played on, connect to it via its LAN IP, or alternatively 127.0.0.1 or "localhost" without the quotes)

Windows

Now go to the folder that the files have just been downloaded to, in this example to C:\PZserver and run the startServer64.bat for a 64bit server or StartServer32.bat for the 32bit version:

Mp win folders.png

Note: While the exes may work, sometimes it'll result in a dedicated server that cannot be connected to locally.

Linux

The default installation folder is in /home/YOURUSERNAME/.steam/steam/steamapps/common/Project Zomboid Dedicated Server

From here start the start-server.sh file.

If you don't know how, navigate to the installation folder via terminal. The following example uses the default folder:

cd ~/.steam/steam/steamapps/common/Project\ Zomboid\ Dedicated\ Server\/

Then simply start the start-server.sh by typing

bash start-server.sh

Mp lin terminal.png


If this is the first time creating the server, you will be asked for an admin password after the userdatabase was created. This automatically creates an account with the name "admin" and the password you're setting.
If you read "*** SERVER STARTED ***" after setting up the password, the server is successfully launched.

Mp win console.png

Starting the Server

As stated in the cmd window, the ports 8766 and 16261 have to be port forwarded in order to allow people to successfully connect to it.

When using the Steam version of the game (starting the game through Steam), connecting to the LAN/WAN server requires both the local IP and the internet IP of the server (there are two fields for this purpose). The host (assuming they're playing on the same computer as the server is running on) can use 0.0.0.0 or 127.0.0.1 as the local IP.

In case the test of the TCP port fails on the LAN server, enter the LAN IP in the optional field as well as the public IP address in the intended field. A started steam server shows you the public IP address in the cmd window.

Note for Hamachi users: You will have to use the Hamachi IP as the "public" IP ("IP" field in the MP server list menu) in order to connect to your own server. Example:

Mp server ip.png

Downloading the Steam server files

First of all, in order to host a Steam server you will need to download the server files.

There are two ways to go about this

Through the Steam Client (THE EASIEST WAY)

Go to your Library and then select "Tools".
Scroll until you see "Project Zomboid Dedicated Server" and download/install it like you would with a game.
Once downloaded, you start it.

That's it.

Through SteamCMD

See Valve's developer wiki for how to download and install SteamCMD:
https://developer.valvesoftware.com/wiki/SteamCMD


Once installed, run SteamCMD (by running the steamcmd.exe in the installation folder of SteamCMD).

In the open SteamCMD window, type in the following:

login anonymous

This will log you in anonymously, so you won't even need a Steam account in order to host a Steam server.

If you want, you can now set up the installation directory. Linux users can skip this; the server will then install to /home/YOURUSERNAME/.steam/steam/steamapps/common/Project Zomboid Dedicated Server/. The following is an example (for Windows), installing the server on your C: drive in a folder called "PZServer":

force_install_dir C:\PZServer

Once done, we will download the server files to the specified folder by typing in:

app_update 380870 validate

When the download is done and you see the success message, you can close Steam CMD by typing in

quit

Non-Steam Server

To host a non-Steam-server, navigate to your game installation folder (the default location is Steam\SteamApps\common\ProjectZomboid) and find the batch-file called ProjectZomboidServer.bat.
Start it by double clicking it.

A command prompt window will pop up. Upon first startup, it will create a userdatabase and create an admin account while asking you to set up a password for it.
After setting up the password, it will finish creating and starting up the server and say "***SERVER STARTED****".

(Note: If you are getting an error, saying "The system cannot find the path specified" while trying to create the spawnregions or user database, let it go through and once the server started without those, close the cmd window and start up the server again by executing the ProjectZomboidServer.bat.)

To allow people to connect to your server you will need to forward the necessary ports.
The necessary standard ports to forward are 16261 (UDP) which serves as a handshake port for communicating with the server.
For each possible player slot on your server, you need to forward additional TCP ports, which are used to stream the world to the player clients.
If you want a server with 10 slots, you would have to forward
16261 UDP
16262 - 16272 TCP

A quick and easy way to test if your ports are forwarded properly are:

Good guides on how to forward ports are found all over the internet. Portforward.com has good guides on hand and covers a lot of routers. Port Forwarding sounds harder in theory that it actually is and mostly just involves getting into the menu of your router.
If you have no access to your router, please consult whoever is in charge of your network (parents, room mates, admins, etc).

External links