Precache Limits (Models, Sounds, Generic) and Performance

April 23, 2026 Daemon666 8 min read 1 visualizações

Precache is how the GoldSrc engine registers, at map load, every model, sound and file it might need to send to a client. The engine has hard ceilings on how many of each it can register, and crossing one does not degrade gracefully — it crashes the map load with a specific error. Every admin running custom content or heavy mods eventually meets these limits, so it pays to know exactly where they are and how to live under them.

1. The ceilings you are working against

The engine reserves a fixed number of slots for each precache category. The historically documented limits are:

CategoryRegistered withApprox. limit
Modelsprecache_model512 (MAX_MODELS)
Soundsprecache_sound512 (MAX_SOUNDS)
Generic filesprecache_generic512 (MAX_GENERIC)
Eventsprecache_eventbounded, separate pool

These include everything the map and every loaded plugin registers together — the map's own models plus every model a mod or plugin precaches. On a heavy zombie or fun server it is the plugins, not the map, that blow the budget.

2. The errors an overflow throws

When you exceed a ceiling the map fails to load with one of these, which is exactly what people paste into search:

Host_Error: PF_precache_model_I: Model <name> failed to precache because it was > MAX_MODELS
Host_Error: PF_precache_sound_I: Sound <name> failed to precache
SZ_GetSpace: overflow

The model and sound errors name the specific file that pushed you over — useful, but that file is only the last straw, not the culprit. The real problem is the total count. The dedicated fixes are in model overflow and sound slots overflow.

3. Reduce the count, do not chase the file

Because the error names the last file, the instinct is to remove that one file — but then the next one over the line simply fails instead. Attack the total:

  • Cut custom content you do not use. Half-configured mods precache models and sounds for features you never enabled.
  • Share models between entities and classes. Ten zombie classes pointing at three shared models cost three slots, not ten.
  • Precache only what is actually used on this map. A plugin that unconditionally precaches its whole asset set on every map wastes slots on maps that never use them.

4. Precache costs load time and memory too

The ceilings are the hard wall, but precache has a soft cost as well. Everything precached is loaded into memory at map start and contributes to the load time and per-instance RAM. On a box running several servers, each instance holds its own copy of everything it precaches, so a bloated precache list multiplies across instances and can exhaust RAM long before CPU is the problem. A lean precache list loads faster and leaves more memory for the OS and neighbours.

5. Order and duplicates

Precaching the same model twice does not consume two slots — the engine returns the existing index — but sloppy code that precaches in a loop or precaches conditionally in the wrong forward can register far more than intended. Precache in plugin_precache() (the correct forward, called before the map spawns entities), not lazily at runtime, where a precache of a never-before-seen file can crash a live server rather than just failing at load. This is also why adding a model mid-map is dangerous.

Common errors

  • MAX_MODELS on map load — total precached models exceed 512. Cut and share models; the named file is just the last one.
  • Sound precache fails — over the sound ceiling. Remove unused custom WAVs, especially from half-enabled mods.
  • SZ_GetSpace: overflow — a message or resource list grew past the engine buffer, often from too many resources announced to clients at once. Reduce custom content.
  • Removed the named file, a different one now fails — you are at the ceiling; removing one file just promotes the next. Reduce the total count.
  • Precache crashes a live server, not at load — something precached at runtime instead of in plugin_precache(). Move it to the precache forward.

Verification

Load your heaviest map with every plugin enabled and confirm it reaches gameplay with no Host_Error precache line in the console or logs. If it loads clean, you are under the ceilings; to know your margin, count the custom models and sounds your mod registers and keep a comfortable buffer under 512 each so a future map addition does not tip you over. For the entity-count ceiling — a related but separate limit — see too many entities / max edicts.

Colaboradores: Daemon666 ✦
Compartilhar: