Project Zomboid

Project Zomboid

52 ratings
Project Zomboid: How to start a server
By FLEURDELYS XIII
This is a short guide on how to get your functional Zomboid server up with a little automation.

Does this have all the answers? No.

Have a better method or idea? Feel free to comment/explain ! [Comments that lead to websites with no or little relevant commentary will be deleted to avoid spam/phishing]
2
   
Award
Favorite
Favorited
Unfavorite
Step 1 - Getting Started
This portion is entirely based off of PZ Wiki's portion of setting up your server which is right here[pzwiki.net]. It's also important to note that I strictly explain the Steam + Windows portion of the setup through this guide.
Fight me.

To get a dedicated server up and running, you'll need:
  • A Backup, PC Server Box, or just leave your own on 24/7 (Not super-recommended);
  • Know your internal IP (Usually something like 127.0.0.1) and external one.
  • Project Zomboid & Project Zomboid Dedicated Server Installed on the machine running the server(But do not run the dedicated tools!)
  • The following ports opened. Never had to change their status myself so neither should you, but just in case (Don't know how? Me neither. Go on the wiki it'll explain):
    • 8766 UDP
    • 16261 UDP


Once you got those things ready, you'll want to locate your installation folder (Default: C:\Program Files (x86)\Steam\steamapps\common\Project Zomboid Dedicated Server)

Important note: By default the StartServer64 batch file specifies 16GB of starting memory for the server. Only you know your PC, remember that this will be running mostly 24/7 keep it in mind when setting your memory values: You must edit the StartServer64 file (Right click, Edit with Notepad) and change the -Xms and -Xmx files to the values you want to use for server memory, or the server will fail to start with memory errors.

An example with 6GB used for the amount of memory (note the -Xms and -Xmx values):

".\jre64\bin\java.exe" -Djava.awt.headless=true -Dzomboid.steam=1 -Dzomboid.znetlog=1 -XX:+UseZGC -XX:-CreateCoredumpOnCrash -XX:-OmitStackTraceInFastThrow -Xms6g -Xmx6g -Djava.library.path=natives/;natives/win64/;. -cp %PZ_CLASSPATH% zombie.network.GameServer -statistic 0

Run the batch file that corresponds to your Windows/PC setup
(I.E. Run Batch32 for a 32-bit, Batch64 for a 64-bit)


On the first run, it'll ask you to set a password for the admin account it will create. After the server finishes setting up with default game settings, a message will output indicating success or failure.

Close that instance of the server and you now have a server's backbone setup and scripted. But don't get too excited, we're 'deleting' that later (probably, depends if you want mods or not on your server).

We can adjust some of the settings manually with notepad, or simply use the incorporated in-game server hosting options. So let's do exactly that and move onto the next step of adjusting your settings to make it playable.
Step 2 - Early Setup
As I mentioned in the previous section; we can adjust everything for the server, in Zomboid's 'Host' option from the main menu.


Once there, you'll notice that it looks like a server is already created using the "servertest" settings. You'll want to go to 'Manage Settings' to the right of it. (You can change the memory settings before doing anything to reflect the values we set in the previous section, but run the risk of needing to do it again and forgetting, after this portion.)

If this is your first time starting a zomboid server and playing with the settings of a MP server, you might want to use the "create copy" feature and fool around with that 'copy' first.

You'll see your dedicated settings on the list to the left marked "servertest". Once selected, to the right you can go to "Edit Server Settings". I'd avoid renaming the servertest, it will create issues even up-to undoing all progress, both server and in-game wise.

You'll be offered 2 sections on the left, called respectively "INI" and "Sandbox". I could dive deep in detail as to what every setting means, but I'll simply skim over the important ones in each section.

  • INI
    • Details: Change your Public/Private displayed information for players to see. Set the game to "Pause when empty" (Server stay's online, but freezes time until someone connects to it)
    • SteamWorkshop: [Explained further]. Parent mods from the workshop.
    • Mods: [Explained further]. Sub-Mods from the workshop.
    • Map: [Explained further]. Additions to the physical Map

  • Sandbox
    • Presets: If you have a previously saved preset for your sandbox settings, you can apply it here, but it doesn't exempt you from having to double check the settings anyway as some settings are different from MP/SP.

Now onto Mods !
Step 3 - Finalizing your Setup & Mods
Once you're satisfied with the generic setting values, we can move onto the Mods and adding them in.

Obviously, first thing would be to check out the workshop and subscribe to mods you would want in the server. There's a lot, and most of them are great, so take your time.

(Adding mods into an already started game will cause some issues, and could even corrupt your game. This is why I mentioned we will be 'refreshing' the server once we're officially ready. Do it right the first time.)

Once you're done raiding the workshop for the mods you want; you still need to add them into the server.

First step would be to go back to the main menu and go to the 'Mods' section and enable all the ones you want on your server. Be sure to note down the "Parent Mods" and their specific "Sub-mods" (like AuthenticZ or even some Vehicle mods that have double spawn rate). Get that done and click 'Back' at the bottom left (Your game and PC will hiccup for a second as it loads in your selection).

Restart your game (Forces mods onto your game profile)

Going back to edit the "servertest" settings;

In the "Steam Workshop" portion of the "INI" settings, you're going to need to add all the parent mods you just subscribed to, 1 by 1. (There are QoL mods like mod managers to help with this and faster ways, but I personally don't use them as this is the most certain way they will be incorporated in the server.)

Move onto the "Mods" portion, here you will see a lot of the same things from the steam workshop portion, there is a difference; these are the sub-mods. Some mods only have a singular one and don't need to adjust them, but others have a few sub-mods and need to be left out of your selection.

Restart your game again
(This is to enforce the mods on the server itself, this will often open new options within the "Sandbox" portion that you can play with).

Once you've gone through these new settings and adjusted them to your liking, double-check your settings one last time before clicking that little "Save" button. Remember to adjust your memory value to reflect what you set in the .batch file !

Go back to the 'Host portion' of the menu and select "Delete world". This keeps your settings and values but will refresh & delete the world to add the new items/mods.

Go back to the "StartServer64/32" from our Zomboid folder and run it again.

Now your server will startup after downloading all the mods. Ready to play once you've collected your Public IP.

Important Note: If a player who joins has a singular mod that is more up-to-date than the server, he will not be able to join.

The next section covers the more technical aspects to cover this issue.
Step 4 (optional) - Advanced Maintenance & Auto-restarts
This part of the guide is slightly more technical, not 100% fool-proof and still a work in development, keep that in mind when reading. If you find a flaw, a better way to do it, etc. please feel free to open dialogue about it, I'll run the tests & hypotheses with pleasure.

NOTE: I still have not found an automated solution to forcing all the players off the server at once, prior to the closing of the server. If you have a solution, please let me know/comment.


Very simple solution called 'Task Scheduler' from Windows. If you're unfamiliar with the tool, look up a quick and easy tutorial of what all the buttons do, but for this guide, I will give explicit values and what needs a check-mark and what doesn't.

First step would be to get Task Scheduler up and running, open your Windows 'Start' menu, and using the search function, look up 'Task Scheduler' (Or you can use the 'Run' function and enter the following without quotes "taskschd.msc"

Before doing anything, if you don't already have a folder for your personal tasks, create one (to avoid having to search for a millennia every time).



Once you found a suitable name for the folder, select/open it, you can now start with your task. On the right of the screen you can see and click "Create Task".

The task wizard will appear. Choose a name for your task (i.e. Zomboid server restarts) and description. Keep the following features checked/unchecked & 'Configure for' Windows 10 (if you have windows 10, otherwise leave that option alone).

Moving to the triggers page, add a new timed/schedule trigger. Depending on how often you would want your server to restart, adjust the values (I personally put it at every 8 hours to allow a good amount of playtime but still have more than 1-2 restarts a day due to mod update schedules (Some mods are updated at 2AM, others at 4PM). Do not sync this trigger across time zones, it will create extra unneeded instances.

Once you set that up to your liking, you can move onto the next area: Actions. Create a new action and you will need to reference the "Startserver64/32" batch file from the Zomboid folders.

Here's a TLDR for the rest of the settings of that task:

  • Conditions: Leave all that unchecked unless you're running on a laptop.
  • Settings: The following should be checked and selected:
    • Allow task to be run on demand
    • If the running task does not end when requested, force it to stop
    • If the task is already running, then the following rule applies: Queue a new instance or Do not start a new instance (Depends how lazy you are, I'm very lazy.)



Save or "Ok" your new task and you now have a server that will start up every 8 hours.

To restart the instance automatically, you will need to close the instance of Command Prompt that is hosting your server; MAKE SURE THAT NO-ONE IS CONNECTED TO THE SERVER. I can't stress it enough, otherwise closing your server while someone is online will, yes, kick them out, however as servers save only when they are empty, but you would still need to enter the "save" command in the Command Prompt instance running your server. to avoid the following issue:

I will not be explaining on how to auto-close the server yet [To be completed in near future]. Why? 1. I can't find a functional way to automatically do it.

2. Well, imagine you didn't need a restart for 2-3 actual days and then do decide to restart, either due to a mod outdated, or just a refresh; everything that happened in those 3 days (or most of it) will be reverted.

Come back soon to find out how to fix that.

NOTE FOR THE ONES WANTING TO HELP & FIGURE OUT WHY IT DOES THIS:

I assume this will have to do with either the backup times (Mine are set to 0). I am unsure if I would need to specify to load the last backup or not if that was the case.

The "PauseWhenEmpty" option in the 'INI' portion of the server setup.

The only way to prevent losing days/hours worth of progress is to empty the server of players, save the world (enter 'SAVE' in the console) and restart.
10 Comments
Jompik Mar 5 @ 11:45am 
hey dont i need to have static ip to make public server?
meiscool1212 Oct 9, 2023 @ 2:01pm 
everything seems to be working great until i load the game and launch the server. then i get stuck on "loading world"
FLEURDELYS XIII  [author] Jun 15, 2023 @ 8:16pm 
Glad to hear from the ant community !
Xesmuclana Jan 6, 2023 @ 5:36pm 
I clicked on this to read the meme but it's only for ants ig
KyGaha Dec 20, 2022 @ 9:08am 
топ
FLEURDELYS XIII  [author] Dec 18, 2022 @ 7:05am 
If you're hosting a closed game - you can deactivate the anti-cheat through the console or in-game

Load game and server without mods if you can't do it in game from there. I know none of this process is easy, the developers are working nearly 'round the clock to be able to improve it and the game itself !

Have any questions: I'll be glad to help out !

Happy adventuring !
Nyarlathotep Dec 16, 2022 @ 12:45pm 
I think the worst part about setting up a dedicated server has to be the little unexplained issues along the way when trying to run Startserver64.bat with mods. From not finding the file path to the mod folders to the mods not being found. After hours of deleting mods and verifying integrity just for the same thing to happen again and again.

Once you finally start getting the server to work, anti-cheat busts your balls in a last fuck you to your mental fortitude and disconnects you for being admin host because the game thinks you're cheating.

However by far the worst part, googling for information only to receive different solutions for the same problem or only receiving information you don't need.
Zombi3Gutz00 Dec 14, 2022 @ 8:33pm 
why is it so fucking complicated to start a multiplayer server
ᑕᕼᗩᖇᑕOᗩᒪ Dec 13, 2022 @ 5:56am 
could of used this fucking yesterday
Wolf Dec 8, 2022 @ 12:24pm 
Thx good man ;_;