Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Client, Server & Shared

To be able to make the framework multiplayer friendly, Depraved Sense was coded with Client, and Server in mind most of the time. Which resulted in a code base scattered around Client, Server, and Shared workspaces. Most modders from zomboid are accustumed to only ever use the Client workspace for their own mods, so it can be a shock for someone needing to learn a whole lot just to do things. But don’t worry, Depraved Sense Already does most of the heavy lifting for you in most critical parts, so you won’t need to do much to make things working.

However it is still good practice to know exactly where to store your code, and how to handle a few networking problems.

For starters, Project Zomboid loads lua folders in a specific order.

Singleplayer: Shared -> Client -> Server

Multiplayer (Client): Shared -> Client

Multiplayer (Server): Shared -> Server

Keep in mind that SinglePlayer does not create a separate server instance like most games that have online multiplayer. Instead, Zomboid creates a whole state for SinglePlayer that treats both Client and Server as the same thing. This single fact alone makes it difficult to check if some feature works on Multiplayer or not.

When creating your mod the code of it often fall into these occasions.

Client, when it is related to the UI, Sounds, and in general what you seen on the game’s screen.

Server, when you want to do anything remotely to gameplay and data. Like changing item’s stats or changing the player’s current state. This is because almost all changes occurring on the Server will immediately sync all other Clients.

Shared, when the code itself is more of a library or util for both Client and Server. That is because Shared is loaded by both sides no matter the occasion or state of the game.

For more information on how to handle Networking code, check the PZWiki’s page on Networking.