Difference between revisions of "Entity limit"
(No, the entity limit cannot be bypassed. You may be thinking of Hammer's entity lump memory size limit.) |
(Clarify GMod entity limit) |
||
(14 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
For reasons of memory allocation, there is a limit to the number of [[entity|entities]] Source can manage at once. | For reasons of memory allocation, there is a limit to the number of [[entity|entities]] Source can manage at once. | ||
− | The combined size (in bytes) of a map's entity data should also be considered, even if the number of entities is within safe limits. Large amounts of [[Source BSP File Format#Entity|entdata]] can take a noticeably long time to transmit from server to client, and | + | The combined size (in bytes) of a map's entity data should also be considered, even if the number of entities is within safe limits. Large amounts of [[Source BSP File Format#Entity|entdata]] can take a noticeably long time to transmit from server to client, and may lead to crashes. |
{{tip|When creating very large or detailed maps, remember that more entities will exist at runtime than were compiled in. Things like weapons held by characters, projectiles and death ragdolls are all entities too. If you see "no free edicts" errors then you need to start cutting!}} | {{tip|When creating very large or detailed maps, remember that more entities will exist at runtime than were compiled in. Things like weapons held by characters, projectiles and death ragdolls are all entities too. If you see "no free edicts" errors then you need to start cutting!}} | ||
Line 8: | Line 8: | ||
There can be up to 4096 entities. This total is split into two groups of 2048: | There can be up to 4096 entities. This total is split into two groups of 2048: | ||
+ | |||
+ | {{note|In {{GMOD}}, there can be up to 16384 entities, split into two groups of 8192. {{todo|Check other Source engine games.}}}} | ||
# Non-networked entities, which exist only on the client or server (e.g. death ragdolls on client, [[CLogicalEntity|logicals]] on server). | # Non-networked entities, which exist only on the client or server (e.g. death ragdolls on client, [[CLogicalEntity|logicals]] on server). | ||
Line 16: | Line 18: | ||
The two entity lists are created by <code>CBaseEntityList::CBaseEntityList()</code> using <code>NUM_ENT_ENTRIES</code> and <code>MAX_EDICTS</code>. Neither of those values can be changed without breaking compatibility with the engine. | The two entity lists are created by <code>CBaseEntityList::CBaseEntityList()</code> using <code>NUM_ENT_ENTRIES</code> and <code>MAX_EDICTS</code>. Neither of those values can be changed without breaking compatibility with the engine. | ||
− | {{tip|[[Temporary Entity|Temporary entities]] and [[prop_static|static]] or [[prop_detail|detail]] props do not count toward either limit.}} | + | {{tip|[[Temporary Entity|Temporary entities]] and [[prop_static|static]] or [[Env_sprite_clientside|sprite_clientside]] or [[prop_detail|detail]] props do not count toward either limit.}} |
− | {{tip|If you're creating lots of individual objects all the time, consider rolling them all into a single manager entity | + | {{tip|If you're creating lots of individual objects all the time, consider rolling them all into a single manager entity.}} |
{{tip|In-game, use console commands like <code>report_entities</code> and <code>cl_showents</code> to get an idea of how many entities are present at that current state.}} | {{tip|In-game, use console commands like <code>report_entities</code> and <code>cl_showents</code> to get an idea of how many entities are present at that current state.}} | ||
+ | |||
+ | {{tip|Prop entities with a collision model (except prop_static and prop_detail), will generate a [[phys_bone_follower]] entity for convex piece it has in its [[collision model]]. These can quickly eat up the edict count! They can however, be disabled by setting the "Disable Bone Followers" keyvalue to Yes, although this will make the collision model no longer function, and the model will not be able to ragdoll anymore.}} | ||
== Hammer limits == | == Hammer limits == | ||
Line 31: | Line 35: | ||
[[Category:Programming]] | [[Category:Programming]] | ||
[[Category:Glossary]] | [[Category:Glossary]] | ||
+ | |||
+ | == See also == | ||
+ | * [[Internal_entity]] | ||
+ | * [[Edict_t]] | ||
+ | |||
+ | == External links == | ||
+ | * [https://rafuron.wordpress.com/category/mapping-tricks/ mapping tricks to get around the Entity limit] |
Latest revision as of 12:04, 10 August 2020
For reasons of memory allocation, there is a limit to the number of entities Source can manage at once.
The combined size (in bytes) of a map's entity data should also be considered, even if the number of entities is within safe limits. Large amounts of entdata can take a noticeably long time to transmit from server to client, and may lead to crashes.

Engine limits
There can be up to 4096 entities. This total is split into two groups of 2048:


- Non-networked entities, which exist only on the client or server (e.g. death ragdolls on client, logicals on server).
- Entities with associated edicts, which can cross the client/server divide.
If the game tries to assign a 2049th edict it will exit with an error message, but if it tries to create a 2049th non-networked entity it will merely refuse and print a warning to the console. The logic behind this may be that an entity spawned dynamically (i.e. not present in the map) but not assigned an edict probably isn't too important.
The two entity lists are created by CBaseEntityList::CBaseEntityList()
using NUM_ENT_ENTRIES
and MAX_EDICTS
. Neither of those values can be changed without breaking compatibility with the engine.



report_entities
and cl_showents
to get an idea of how many entities are present at that current state.
Hammer limits
Hammer itself has no entity limit, but VBSP's is 8192. This is double the combined total accepted by the engine, which may be because it at first treats internal entities (such as prop_static and env_cubemap) like normal entities, or perhaps because it generates a lot of detail props.
VBSP also recommends an entdata size limit of 384KB, but this is in no way enforced.