Entity limit: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (added language bar. also some formatting.)
Line 1: Line 1:
{{lang|Entity limit|title=Entity Limit}}
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.


Line 5: Line 6:
{{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!}}


== Engine limits ==
== Engine Limits ==


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. In {{Game link|Portal 2}}, there can be up to 8192 entities. {{todo|Check other Source engine games.}}}}
{{note|In {{Gmod|2}}, there can be up to 16384 entities, split into two groups of 8192. In {{Game link|Portal 2}}, there can be up to 8192 entities. {{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 18: Line 19:
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 [[Env_sprite_clientside|sprite_clientside]] or [[prop_detail|detail]] props do not count toward either limit.}}
{{tip|[[Temporary Entity|Temporary entities]] and [[prop_static|static]], <code>[[Env_sprite_clientside|sprite_clientside]]</code>, 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.}}
Line 24: Line 25:
{{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 that use a model with [[$collisionjoints]] will generate one [[phys_bone_follower]] for every convex piece of their [[collision model]]. These can quickly eat up the edict count! Enabling the "Disable Bone Followers" keyvalue on the prop will disable bone followers, although the prop will no longer have a functioning collision model, and the model will not be able to [[ragdoll]].}}
{{tip|Prop entities that use a model with {{ent|$collisionjoints}} will generate one {{ent|phys_bone_follower}} for every convex piece of their [[collision model]]. These can quickly eat up the edict count! Enabling the "Disable Bone Followers" keyvalue on the prop will disable bone followers, although the prop will no longer have a functioning collision model, and the model will not be able to [[ragdoll]].}}


== Hammer limits ==
== VMF Limits ==


Hammer itself has no entity limit, but [[VBSP]]'s is 8192 (16384 in {{as}}, 20480 in {{csgo}}). {{note|This is a soft limit, a modded [[VBSP]] is capable of adding as much entities as memory allows.}}
Hammer itself has no entity limit, but [[VBSP]]'s is 8192 (16384 in {{as|2}}, 20480 in {{csgo|2}}). {{note|This is a soft limit; a modded [[VBSP]] is capable of adding as many entities as memory allows.}}
This is double the combined total accepted by the engine, which may be because it at first treats [[internal entity|internal entities]] (such as [[prop_static]] and [[env_cubemap]]) like normal entities, or perhaps because it generates a lot of [[detail props]].
This is double the combined total accepted by the engine, which may be because it at first treats [[internal entity|internal entities]] (such as {{ent|prop_static}} and {{ent|env_cubemap}}) like normal entities, or perhaps because it generates a lot of [[detail props]].


VBSP also recommends an [[Source BSP File Format#Entity|entdata]] size limit of 384KB, but this is in no way enforced.
VBSP also recommends an [[Source BSP File Format#Entity|entdata]] size limit of 384KB, but this is in no way enforced.
Line 38: Line 39:


== See also ==
== See also ==
* [[Internal_entity]]
* {{ent|internal_entity}}
* [[Edict_t]]
* {{ent|edict_t}}


== External links ==
== External links ==
* [https://rafuron.wordpress.com/category/mapping-tricks/ mapping tricks to get around the Entity limit]
* [https://rafuron.wordpress.com/category/mapping-tricks/ mapping tricks to get around the Entity limit]

Revision as of 15:41, 27 April 2022

English (en)Esperanto (eo)Русский (ru)中文 (zh)Translate (Translate)

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.

Tip.pngTip: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!

Engine Limits

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

Note.pngNote:In Garry's Mod Garry's Mod, there can be up to 16384 entities, split into two groups of 8192. In Portal 2 Portal 2 , there can be up to 8192 entities.
Todo: Check other Source engine games.
  1. Non-networked entities, which exist only on the client or server (e.g. death ragdolls on client, logicals on server).
  2. 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.

Tip.pngTip:Temporary entities and static, sprite_clientside, or detail props do not count toward either limit.
Tip.pngTip:If you're creating lots of individual objects all the time, consider rolling them all into a single manager entity.
Tip.pngTip:In-game, use console commands like report_entities and cl_showents to get an idea of how many entities are present at that current state.
Tip.pngTip:Prop entities that use a model with $collisionjoints will generate one phys_bone_follower for every convex piece of their collision model. These can quickly eat up the edict count! Enabling the "Disable Bone Followers" keyvalue on the prop will disable bone followers, although the prop will no longer have a functioning collision model, and the model will not be able to ragdoll.

VMF Limits

Hammer itself has no entity limit, but VBSP's is 8192 (16384 in Alien Swarm Alien Swarm, 20480 in Counter-Strike: Global Offensive Counter-Strike: Global Offensive).

Note.pngNote:This is a soft limit; a modded VBSP is capable of adding as many entities as memory allows.

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.

See also

External links