Entity limit: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
For reasons of memory allocation, there is a limit to the number of entities Source can manage at once.
For reasons of memory allocation, there is a limit to the number of entities Source can manage at once.


{{warning|A high entdata may lead to your map and server crashing, avoid high numbers of entities. }}
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 [[The Source Engine BSP File Format#Entity|entdata]] can take a noticeably long time to transmit from server to client, and {{confirm|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!}}


== Engine limits ==
== Engine limits ==
Line 7: Line 9:
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:


# Non-networked entities, which exist only on the client or server.dll (e.g. death ragdolls, [[CLogicalEntity|logicals]]).
# Non-networked entities, which exist only on the client or server (e.g. death ragdolls on client, [[CLogicalEntity|logicals]] on server).
# Entities with associated [[edict]]s, which can cross the client/server divide.
# Entities with associated [[edict]]s, which can cross the client/server divide.


Line 20: Line 22:
== Hammer limits ==
== Hammer limits ==


Hammer itself has no entity limit, but [[VBSP]]'s is 8192. This is double the combined total accepted by the engine, {{confirm|which may be because it at first treats [[internal entity|internal entities]] (such as [[prop_static]] and [[env_cubemap]]) like normal entities, and/or possibly because it generates a lot of [[detail props]].}} It also recommends an <code>[[The Source Engine BSP File Format#Entity|entdata]]</code> size limit of 384KB, but this is in no way enforced.
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 entity|internal entities]] (such as [[prop_static]] and [[env_cubemap]]) like normal entities, or perhaps because it generates a lot of [[detail props]].


{{note|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.}}
VBSP also recommends an [[The Source Engine BSP File Format#Entity|entdata]] size limit of 384KB, but this is in no way enforced.


[[Category:Level Design]]
[[Category:Level Design]]
[[Category:Programming]]
[[Category:Programming]]
[[Category:Glossary]]
[[Category:Glossary]]

Revision as of 04:40, 29 May 2010

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

Confirm: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:

  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 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. This is how Left 4 Dead handles huge numbers of infected: they are all "finger puppets" of the director.

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.