实体限制

From Valve Developer Community
Jump to: navigation, search
实体限制
English简体中文

本页面由大康正在翻译中。页面创建时间为2022年10月3日。欢迎任何人补充新内容或者修改其中的错误。


出于内存分配的原因,Source 可以一次管理的实体数量存在限制。

还应考虑地图实体数据的组合大小(以字节为单位),即使实体数量在安全限制范围内也是如此。大量 entdata 可能需要相当长的时间才能从服务器传输到客户端,并可能导致崩溃。

Tip.png 提示:创建非常大或细节很多的地图时,请记住,运行时存在的实体数将多于编译时的实体数量。角色持有的武器、子弹和死亡布娃娃等物品也是实体。如果您看到“no free edicts”错误,那么您需要开始减少实体数量!

引擎限制

最多有 4096 个实体。总数分为两组,每组 2048 个。

Note.png 注意: Garry's Mod Garry's Mod 中,限制高达 16384 个实体,分为两组,每组有 8192 个。在 传送门 2 传送门 2,限制最高是 8192 个实体。
待完善:查看其他起源引擎游戏的限制。
  1. 仅存在于客户端或服务器上的非网络实体(例如,客户端上的死亡布娃娃,服务器上的逻辑规则)。
  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.png Tip: Temporary entities and static, sprite_clientside, or detail props do not count toward either limit.
Tip.png Tip: If you're creating lots of individual objects all the time, consider rolling them all into a single manager entity.
Tip.png Tip: 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.png 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.

VMF 限制

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

Note.png 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 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.


起源 2

In Source 2, specifically S&box S&box, networked entity limit is 16384.

There appears to be no limit for map compiles, or it is tied to the networked entity limit.

另见

External links