Zh/Entity limit: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
mNo edit summary
m (obsolete language category)
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{lang|Entity limit|title=实体限制}}
{{LanguageBar|title = 实体限制}}
{{:User:1416006136/Signature|time=2022年10月3日|in progress=1}}
 
出于内存分配的原因,Source 可以一次管理的[[entity|实体]]数量存在限制。
{{:User:1416006136/Signature|time=Oct 3 2022}}
出于内存分配的原因,Source 可以一次管理的{{L|entity|实体}}数量存在限制。


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


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


== 引擎限制 ==
== 引擎限制 ==
Line 11: Line 12:
最多有 4096 个实体。总数分为两组,每组 2048 个。
最多有 4096 个实体。总数分为两组,每组 2048 个。


{{note:zh-cn|在 {{Gmod|2|suf=:zh-cn}} 中,限制高达 16384 个实体,分为两组,每组有 8192 个。在 {{portal2|4|suf=:zh-cn}},限制最高是 8192 个实体。{{Todo:zh-cn|查看其他起源引擎游戏的限制。}}}}
{{Note|在 {{Gmod|2|suf=:zh-cn}} 中,限制高达 16384 个实体,分为两组,每组有 8192 个。在 {{portal2|4|suf=:zh-cn}},限制最高是 8192 个实体。{{todo|查看其他起源引擎游戏的限制。}}}}


# 仅存在于客户端或服务器上的非网络实体(例如,客户端上的死亡布娃娃,服务器上的[[CLogicalEntity|逻辑]]规则)。
# 仅存在于客户端或服务器上的非网络实体(例如,客户端上的死亡布娃娃,服务器上的{{L|CLogicalEntity|逻辑}}规则)。
# Entities with associated [[edict]]s, which can cross the client/server divide.
# 具有与{{L|edict|实体字典}}相关联的实体,可以跨越客户端/服务器划分。


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.
如果游戏尝试分配第 2049 个实体字典,它将退出并显示错误消息,但如果它尝试创建第 2049 个非网络实体,它只会拒绝并向控制台打印警告。这背后的逻辑可能是动态生成的实体(即不存在于地图中)但没有分配实体字典可能不太重要。


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.
这两个实体列表由 <code style="padding:0">CBaseEntityList::CBaseEntityList()</code> 使用 <code style="padding:0">NUM_ENT_ENTRIES</code> <code style="padding:0">MAX_EDICTS</code> 创建。在不破坏与引擎的兼容性的情况下,这两个值都无法更改。


{{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|1={{L|Temporary Entity|临时实体}}和{{L|prop_static|静态道具}}、<code style="padding:0">{{L|Env_sprite_clientside|sprite_clientside}}</code>,或者{{L|prop_detail|细节}}道具不计入任一限制。}}


{{tip|If you're creating lots of individual objects all the time, consider rolling them all into a single manager entity.}}
{{Tip|如果一直创建大量单个对象,请考虑将它们全部滚动到单个管理器实体中。}}


{{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|1=在游戏中,使用 <code style="padding:0">report_entities</code> <code style="padding:0">cl_showents</code> 等控制台命令来了解当前状态下存在多少实体。}}


{{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]].}}
{{Tip|使用 {{ent|$collisionjoints}} 模型的道具实体将为其{{L|collision model|碰撞模型}}的每个凸块生成一个 {{ent|phys_bone_follower}}。这些可以迅速吃满实体字典计数!在道具上启用“Disable Bone Followers”键值将禁用''骨头跟随器''(Bone Followers),尽管道具将不再具有正常运行的碰撞模型,并且模型将无法变成{{L|ragdoll|布娃娃}}。}}


== VMF 限制 ==
== VMF 限制 ==


Hammer itself has no entity limit, but [[VBSP]]'s is 8192 (16384 in {{as|2}}, 2048 in {{csgo|2}}). {{note|This is a soft limit; a modded [[VBSP]] is capable of adding as many entities as memory allows.}}
Hammer 本身没有实体限制,但 {{L|VBSP}} 的限制是 8192 ({{as|2}} 中是 16384 个,{{csgo|2}} 中是 2048 个)。{{Note|这是一个软限制;一个修改后的 {{L|VBSP}} 可以在内存允许的情况下任意数量的实体。}}
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]].
这是引擎能接受的总和的两倍,这可能是因为它最初将{{L|internal entity|内部实体}}(例如{{ent|prop_static}}{{ent|env_cubemap}})视为普通实体,或者可能是因为它生成了很多{{L|detail props|细节道具}}。


VBSP also recommends an [[Source BSP File Format#Entity|entdata]] size limit of 384KB, but this is in no way enforced.
VBSP 还建议将 [[Source BSP File Format#Entity|entdata]] 大小限制为 384KB,但这绝不是强制执行的。


[[Category:Level Design]]
{{ACategory|Level Design}}
[[Category:Programming]]
{{ACategory|Programming}}
[[Category:Glossary]]
{{ACategory|Glossary}}




== 起源 2 ==
== {{source2|4|nt=0|suf=:zh-cn}} ==


In Source 2, specifically {{game name|s&box|name=S&box}}, networked entity limit is 16384.
{{source2|4|suf=:zh-cn}} 中,尤其是 {{S&box|4|suf=:zh-cn}},网络实体限制是 16384。


There appears to be no limit for map compiles, or it is tied to the networked entity limit.
地图编译似乎没有限制,或者它与网络实体限制相关联。


== 另见 ==
== 另见 ==
Line 50: Line 51:
* {{ent|edict_t}}
* {{ent|edict_t}}


== External links ==
== 外部链接 ==
* [https://rafuron.wordpress.com/category/mapping-tricks/ mapping tricks to get around the Entity limit]
* [https://rafuron.wordpress.com/category/mapping-tricks/ 绕过实体限制的地图技巧]
 
{{ACategory|GoldSrc}}
{{ACategory|Source}}
{{ACategory|Source 2}}
 
{{ACategory|Level Design}}
{{ACategory|Programming}}

Latest revision as of 04:14, 22 August 2024

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

This page was translated by DaKang233 on October 3, 2022 (UTC+8). Anyone is welcome to add new content or fix errors.


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

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

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

引擎限制

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

Note.png注意:Garry's Mod Garry's Mod 中,限制高达 16384 个实体,分为两组,每组有 8192 个。在 传送门2 传送门2,限制最高是 8192 个实体。
待完善: 查看其他起源引擎游戏的限制。
  1. 仅存在于客户端或服务器上的非网络实体(例如,客户端上的死亡布娃娃,服务器上的逻辑(en)规则)。
  2. 具有与实体字典(en)相关联的实体,可以跨越客户端/服务器划分。

如果游戏尝试分配第 2049 个实体字典,它将退出并显示错误消息,但如果它尝试创建第 2049 个非网络实体,它只会拒绝并向控制台打印警告。这背后的逻辑可能是动态生成的实体(即不存在于地图中)但没有分配实体字典可能不太重要。

这两个实体列表由 CBaseEntityList::CBaseEntityList() 使用 NUM_ENT_ENTRIESMAX_EDICTS 创建。在不破坏与引擎的兼容性的情况下,这两个值都无法更改。

Tip.png提示:临时实体(en)静态道具(en)sprite_clientside(en),或者细节(en)道具不计入任一限制。
Tip.png提示:如果一直创建大量单个对象,请考虑将它们全部滚动到单个管理器实体中。
Tip.png提示:在游戏中,使用 report_entitiescl_showents 等控制台命令来了解当前状态下存在多少实体。
Tip.png提示:使用 $collisionjoints 模型的道具实体将为其碰撞模型(en)的每个凸块生成一个 phys_bone_follower。这些可以迅速吃满实体字典计数!在道具上启用“Disable Bone Followers”键值将禁用骨头跟随器(Bone Followers),尽管道具将不再具有正常运行的碰撞模型,并且模型将无法变成布娃娃(en)

VMF 限制

Hammer 本身没有实体限制,但 VBSP(en) 的限制是 8192 个 (异形丛生 异形丛生 中是 16384 个,反恐精英:全球攻势 反恐精英:全球攻势 中是 2048 个)。

Note.png注意:这是一个软限制;一个修改后的 VBSP(en) 可以在内存允许的情况下任意数量的实体。

这是引擎能接受的总和的两倍,这可能是因为它最初将内部实体(en)(例如prop_staticenv_cubemap)视为普通实体,或者可能是因为它生成了很多细节道具(en)

VBSP 还建议将 entdata 大小限制为 384KB,但这绝不是强制执行的。


起源2 起源2

起源2 起源2 中,尤其是 S&box S&box,网络实体限制是 16384。

地图编译似乎没有限制,或者它与网络实体限制相关联。

另见

外部链接