Skip to content

Performance

Honest version: the scripts are not the heavy part. The map is.

[the_apocalypse_project] is a whole-map conversion on top of Los Santos, around 166 ymaps and an MLO. A lot of its ymaps have streaming extents of kilometres, much bigger than the props inside. So the engine thinks half the map is in range at once and everything streams in at the same moment around a spawning player. That’s where the pool pressure comes from.

The real fix is in the maps: tighten the inflated extents in CodeWalker, with a safe margin. Worth more than every pool line below.

server.cfg raises some pools with increase_pool_size (the modern way, gameconfig.xml is not honoured anymore):

increase_pool_size "Building" 500
increase_pool_size "StaticBounds" 2000
increase_pool_size "EntityDescPool" 5000
increase_pool_size "TxdStore" 8000
increase_pool_size "FragmentStore" 4000
increase_pool_size "fragInstGta" 800
increase_pool_size "Object" 800
# + interior/portal/occlusion, LightEntity, AttachmentExtension

These are modest on purpose, not the max. Maxing them costs memory on every client and Building way above ~500 causes its own problems.

Keep set onesync_population false. Ambient population fills exactly the pools you can’t raise.

The zombie caps already scale down by themselves:

  • server frame time over Zombies.Net.perfBudgetMs (70) cuts the cap, down to perfMinFactor
  • total entities between entitySoft and entityHard (1400 / 1900) cuts it, and over hard the farthest walkers go
  • a player under fpsLow FPS gets fewer walkers near them

Tune perfBudgetMs from the frame average /znet shows on an idle server. If your server is just slower, the default will cut zombies all the time.

On the client side Streaming.PoolGuard.clientPedLimit (180) stops new walker peds before the ped pool gets full, and an emergency cull removes corpses first, then the farthest walkers.

resmon 1 -- client, per resource ms
profiler record 500 -- then profiler view
/znet -- zombie caps and server frame
/pools -- client ped pool

There is no /bsperf, the resources don’t keep internal timers. Use resmon.

In October I went through every client script. Nearly every per-frame loop is already gated (it sleeps 250-1000 ms when idle). The few that always run per frame are things the engine needs every frame (hiding HUD parts, population density, blackout lights). If you see one of ours high in resmon while idle, that’s a bug, tell me.