Optimization - WapaMario63/-mlptf2-Maps GitHub Wiki
General Map optimization
Entity Management
The Source engine has an entity limit of 4096 (except for Garry's Mod which has it raised to 16384), split into two buffers: client-side and server-side. For TF2 maps, you will mostly worry about the server-side entity limit, which is 2,048, these are called edicts, as that is what the entity database is called in the engine. Every object that a player can interact with is considered an edict, such as triggers, lights, buttons, etc. However, players themselves are also edicts, every individual hat, unusual and weapon visible are edicts, every projectile, sticky bombs and such are edicts, this poses an issue of trying to keep your edict count low, as exceeding the limit will cause a server crash. If you are making a payload map or a 3 stage attack/defend map (or heavens forbid a 3 stage payload map) you are more likely to use more edicts in your map, so be cautious when you start adding all the fancy dynamic entities in your map.
The safest limit for a 32 player server is around 1,400. This accounts if a full 32 player server had fancy cosmetics, went demoman and used the scottish resistance. To check how many edicts your map is using, hop into your map ingame, enable sv_cheats and use one of these commands: report_entities
or sv_dump_edicts
, these will tell you how many edicts are in your map (including yourself). status
can also show this information.
More info on the valve developer wiki, and this TF2Maps thread.
Optimizing your mares
The pony models were not really meant to be used in TF2 maps, so they can bloat your map if you don't change certain bits of their configuration.
Disable Collision
TF2 (and other Source 2007 games) has a more restrictive index buffer compared to Garry's Mod (what these models were made for), going over this limit while doing collision detection with something detailed (e.g. rocket explosions calculating where splash damage should be done) will crash everyone's game. Our mares have complex collision models on their heads, so it is crucial you set your mare's prop_dynamic property "Collision" to either "Not Solid" or "Use Bounding Box" (the selection box surrounding your mare in Hammer).
Disable Bone Followers
In the source engine, every instance of a collision model is considered an entity, this is used for models to collide properly with other objects when being animated and for ragdoll physics. Our mares have a bunch of collision models that can really bloat up the entity buffer, so since they are mostly just standing there with occasional animation changes and sometimes tracked movement, the prop_dynamic property "Disable Bone Followers" must be set to "Yes".