Until now the infected were half fake. The server kept a list of them and a simulation of where they walk, but each client spawned its own copy. Most of the time it looked fine. Then two guys stand next each other and one sees a zombie at the door and the other sees nothing. Not great for a survival game.
So I rebuilt it. Now there is a mode called networked in bs_zombies and it is the default.
How it works now
The server still is the brain. It keeps the registry, the health, who killed what, all of that. What changed is that when a record gets close to a player, the server promotes it to a real OneSync ped with CreatePed. From that moment every client sees the same entity.
- Records far away stay virtual, they cost almost nothing
- Close ones get promoted, nearest first, under a cap
- When nobody is near anymore, the ped goes back to being a record
- Corpses are cleaned by the server, not by whoever happened to be there
Hits are still validated on the server. The client only reports AI state for networked walkers, it can’t say “I killed it” and get away with it.
What broke
The walk. The ped is real now, so the clipset has to be set on every client that adopts it, and some clients were picking the normal walk. You get zombies walking like they are going to the office. There is a /zgait probe to find out which clipset is applied where, I’m waiting on output from a few more sessions before I pick one.
Also had a few orphans, peds with no record behind them. There is a guard for that now, if a ped has no record after a few ticks it gets deleted.
Next
Performance pass before I add anything else on top. That one is next post.