← Journal

The Server Is Empty. The NPCs Are Still Out There.

Cold-boot tests proved that connectionless survivors can restore, move through rolling world relevance, interact with real persistent objects, and return while no human is connected.

Who carries the world when nobody is online?

One of the questions I kept coming back to with True MP NPC was pretty simple: what happens when the last real player disconnects?

Having an NPC walk around while a player is nearby is one thing. Project Zomboid already has the surrounding cells and chunks loaded for that player. A connectionless NPC doesn't have a client or a normal network relevance window, so there was no guarantee it could keep using the world once everyone left.

If these NPCs are eventually going to leave Home, scavenge, come back with supplies and keep surviving while nobody is online, they need to be able to carry their own little part of the world with them.

Build 42.20.2 turned out to have exactly the server-side hook I needed. ServerMap has a relevance path that doesn't depend on a UdpConnection, so True MP NPC can contribute a bounded NPC relevance area directly to vanilla's existing world-loading system.

There isn't a second custom chunk manager running alongside PZ, and the NPC doesn't pretend to be a connected player.

human-player relevance
+ NPC relevance
+ other server relevance
  ↓
vanilla ServerMap

Vanilla still decides what gets loaded, retained, saved and eventually unloaded.

Cold boot with zero players

I wanted the test to be stronger than simply disconnecting after somebody had already loaded the area.

So the server was started from cold with zero human players connected. Nobody logged in first to bootstrap the NPCs or their surroundings.

Four persistent NPCs restored normally on the first attempt. A fifth didn't, because its saved position failed the spawn-safety check. That describes the original proof run; a later machine-verified cold boot restored 15 durable NPCs on distinct safe squares. Unsafe or duplicate persisted squares can now relocate through a bounded deterministic nearby search, and the corrected position is persisted before autonomy resumes.

That fifth NPC is actually part of the result I wanted. Instead of forcing it into a questionable square just to make the numbers look good, the system left it safely unmaterialized and kept its persistent record.

The four restored survivors had connection = null, active Brains, real loaded squares, native pathfinding and physical movement.

Packet count stayed at zero, which is exactly what should happen when there are no clients around to receive replication.

For this setup the dedicated server currently requires PauseEmpty=false. That's a normal Project Zomboid server option, not a hidden client or fake player being kept online.

The survivor carries a bounded window of world

The next test was sending an NPC far enough away from Home that it had to bring previously irrelevant world into memory.

It worked.

During one run the loaded world looked roughly like this:

cold boot:          0 cells /   0 chunks
Home active:        6 cells / 384 chunks
travel away:       12 cells / 768 chunks
return Home:        6 cells / 384 chunks

The last line mattered almost as much as the travel itself.

If that number had kept growing as the NPC walked, I would have created a chunk leak rather than an autonomous survivor. Instead, after the NPC returned Home, the distant area lost its NPC relevance and vanilla's normal save/unload lifecycle brought the footprint back down.

The NPC also respected the less convenient parts of the world. One route stopped at a locked door. Another stopped on real collision.

It didn't decide that a failed route was permission to teleport through a wall.

Long-distance replanning still has room to improve, but the important part is now proven: a connectionless NPC can physically travel into world regions that no human player is keeping loaded.

A piece of paperwork

My favourite test from this phase involved possibly the least exciting loot imaginable.

The NPC travelled into a distant loaded area and found a real filingcabinet containing four existing items. One of them was Base.Paperwork, item ID 1502973175.

The NPC took that exact item.

filing cabinet: 4 → 3

NPC inventory:
Base.Paperwork #1502973175
exactly once

Then the server was saved and restarted.

The NPC restored with the same item ID and type still in its inventory exactly once.

No test crate, no fake loot and no human player standing nearby.

It's only a piece of paperwork, but technically it proved something much more interesting: the survivor had travelled through the real persistent PZ world, taken ownership of an existing world item and carried that consequence through a server restart while zero humans were online.

This was probably the point where the long-term idea behind True MP NPC stopped feeling theoretical to me.

The NPC no longer needs a human nearby to carry the world around it. It can leave Home, load the world ahead, travel physically, interact with persistent objects and come back while the server has zero human connections.

Keep reading

Browse every field note