← Journal

From Server Puppet to Autonomous Survivor

Homes, semantic perception, daily life, and independent decision timing turned a command-driven body into the foundation of an autonomous survivor.

Beyond remote commands

The first useful NPC commands were very direct:

GO_TO_TILE
FOLLOW
COME_HERE
STOP

They were important, but they only proved that the server could control the body.

They didn't make the NPC autonomous.

The next question was how to let a survivor understand enough of Project Zomboid's world to make its own decisions without giving the Brain direct access to the entire mutable game state.

I could have passed the IsoPlayer, squares, buildings and every other PZ object straight into the AI.

That probably would have worked for a while.

It also would have become very difficult to maintain.

The Brain doesn't touch the PZ world directly

The current boundary is roughly:

PZ mutable world
  ↓
PzPerceptionAdapter
  ↓
immutable PerceptionSnapshot
  ↓
Brain
  ↓
NpcIntent
  ↓
runtime controllers

The Brain doesn't get an IsoPlayer, IsoGridSquare, network packet or the main runtime manager.

Instead it receives a bounded snapshot containing the things it can reasonably know at that moment: its own state, nearby players, buildings and rooms, distances, line of sight, semantic locations, recently rejected targets and information about when and how the snapshot was collected.

That separation has turned out to be useful for more than code cleanliness.

It means the part deciding what the NPC wants to do can be tested without having to boot an entire Project Zomboid server.

The ugly PZ-specific work stays on the other side.

Knowing where food might be is not knowing where food is

One thing I didn't want was NPC clairvoyance.

If Alice is hungry and there's a grocery store nearby, it's reasonable for her to think:

There's probably food in there.

It's not reasonable for her to know that the third cabinet in the back room contains two cans of beans before she's ever entered the building.

So world perception includes semantics.

The NPC can recognize things such as:

grocery store
restaurant
kitchen
house
potential food location

It can rank those places and choose somewhere worth investigating.

But it doesn't get the contents of distant containers for free.

That difference is going to matter a lot as scavenging develops. I want NPCs to make sensible guesses based on the world around them, not silently query the save for the exact location of whatever item they currently need.

Home became the first real anchor

Home was one of the first things that made the NPC feel less like a remotely controlled player.

It's not just a saved X/Y coordinate.

It's a durable relationship with a building and its immediate surroundings that can be reconstructed after a restart.

That lets the survivor reason in terms of:

HOME_IDLE
HOME_WANDER
YARD_WANDER
RETURN_HOME

Home isn't intended to trap the NPC there. It's somewhere to leave and, more importantly, somewhere meaningful to return to.

That same concept can later become the foundation for beds, food storage, shared households and home defence instead of introducing a completely separate “base” system.

Teaching the NPC to do nothing useful

A survivor that spends every second optimizing survival can look almost as artificial as one that doesn't do anything.

So some of the first autonomous activities were intentionally ordinary:

  • sitting down;
  • standing up;
  • watching TV;
  • listening to radio (activity path; real-radio confirmation still pending);
  • reading;
  • eating;
  • drinking.

Posture and activity are separate internally.

POSTURE:
standing | seated

ACTIVITY:
idle | watch TV | listen to radio | read | eat | drink

That avoids having completely separate implementations for “sit and read”, “sit and watch TV”, “sit and eat” and every future combination.

It also gives later systems somewhere sensible to add things like resting, social activity and eventually sleep.

Five survivors immediately found a flaw

A lot of AI problems are difficult to see with one NPC.

The first five-NPC autonomy test exposed one almost immediately.

Several NPCs would occasionally make the same decision at almost exactly the same time. Nothing was technically wrong: they were in the same house, seeing roughly the same world and evaluating similar choices on similar schedules.

But watching everyone suddenly decide to go outside together looked ridiculous.

The fix wasn't simply “add randomness everywhere”.

Each survivor now has its own deterministic behavior seed, decision timing variation, weighted optional choices, cooldowns and a small amount of anti-herding pressure.

So one house can naturally end up looking more like:

Alice   sitting quietly
Bob     walking through the kitchen
Sarah   watching TV
Jack    outside
Emily   staying idle

They can still choose the same thing. They just don't have to behave like synchronized copies because their circumstances happen to match.

And this only applies where diversity makes sense.

If five NPCs later see a zombie coming through the front door, I'm perfectly happy for all five to suddenly agree that there are more important things to do than watch TV.

Randomness isn't the intelligence. It just stops several independent survivors from behaving like one synchronized machine.

Keep reading

Browse every field note