MassBattle Docsv1.19.20

HostHierarchy.h

USTRUCT ×3 UENUM ×1

Source/MassBattle/Public/Fragments/HostHierarchy.h

概述 Overview

Host(宿主)实体层级体系:枚举 EHostAttachmentSource(附着来源:外部实体 / 父 Host / 世界锚点)、核心片段 FHostHierarchy(每个 Host 实体的永久片段——树链接、附着来源、每 tick 已解析世界状态,下游处理器无需访问父级片段)、以及两个 Tag(FHostControllerTag 标记 Host 控制器实体、FCpuInterpTag 标记使用 CPU 逐帧插值的 FX 宿主)。

Host entity hierarchy system: the enum EHostAttachmentSource (attachment source: external entity / parent host / world anchor), the core fragment FHostHierarchy (a permanent fragment on every Host entity carrying tree links, attachment source and per-tick resolved world state so downstream processors never reach into parent fragments), and two tags (FHostControllerTag marking Host controller entities, FCpuInterpTag marking FX hosts using CPU-side per-frame interpolation).

EHostAttachmentSource UENUM

统一附着来源枚举——替代各类型 Config 中 bAttached + AttachToEntity 的碎片化读取,由 FHostHierarchy::AttachmentSource 使用。

Unified attachment source enum — replaces the scattered per-type Config bAttached + AttachToEntity reads; used by FHostHierarchy::AttachmentSource.

值 Value说明 Description
ExternalEntity跟随普通 Mass 实体(单位/投射物/战利品等)。Follow a regular Mass entity (Agent/Projectile/Loot etc.).
ParentHost跟随父 Host 节点。Follow a parent Host node.
WorldAnchor无外部父级;使用最后已解析世界状态。No external parent; uses the last resolved world state.

FHostHierarchy USTRUCT

每个 Host 实体的永久片段,派生自 FA_MassBattleBaseFragment。三组数据:①树链接(侵入式链表的父/子/兄弟句柄,Prev 指针用于 O(1) 解绑);②附着来源枚举;③每 tick 已解析状态(世界变换、线/角速度、插值参数、缩放——由 Host 处理器每帧写入,渲染与生命周期处理器只读消费)。

Permanent fragment on every Host entity, derived from FA_MassBattleBaseFragment. Three groups: ①tree links (parent/child/sibling handles of an intrusive linked list, with Prev for O(1) unlink); ② the attachment source enum; ③ per-tick resolved state (world transform, linear/angular velocity, interp params, scale — written each frame by the Host processor, consumed read-only by render and lifecycle processors).

成员变量 Members

名称 Name类型 Type默认值说明 Description
AttachmentEntityFEntityHandle无效句柄父实体:ExternalEntity 时指向 Mass 实体,ParentHost 时指向父 Host,WorldAnchor 时无效。Parent entity: a Mass entity for ExternalEntity, the parent Host for ParentHost, invalid for WorldAnchor.
ParentHostFEntityHandle无效句柄父 Host 节点(仅 AttachmentSource == ParentHost 时有效)。Parent Host node (valid only when AttachmentSource == ParentHost).
FirstChildHostFEntityHandle无效句柄侵入式链表中的第一个子 Host。First child Host in the intrusive linked list.
NextSiblingHostFEntityHandle无效句柄父级子链表中的下一个兄弟 Host。Next sibling Host in the parent's child list.
PrevSiblingHostFEntityHandle无效句柄上一个兄弟 Host,用于 O(1) 解绑。Previous sibling Host for O(1) unlink.
AttachmentSourceEHostAttachmentSourceWorldAnchor附着来源枚举。Attachment source enum.
ResolvedWorldTransformFTransformIdentity每 tick 解析出的世界变换。World transform resolved per tick.
ResolvedLinearVelocityFVector3f(0,0,0)每 tick 解析出的线速度。Linear velocity resolved per tick.
ResolvedAngularVelocityFVector3f(0,0,0)每 tick 解析出的角速度。Angular velocity resolved per tick.
ResolvedInterpParamsFVector4f(0,0,0,0)每 tick 解析出的插值参数。Interpolation parameters resolved per tick.
ResolvedWorldScaleFVector3f(1,1,1)每 tick 解析出的世界缩放。World scale resolved per tick.
InterpStateFHostRenderInterpState—CPU 侧逐帧插值状态(非 UPROPERTY,定义于 Fragments/Render.h)。CPU-side per-frame interpolation state (not UPROPERTY; defined in Fragments/Render.h).
bResolvedThisTickuint8 : 10本 tick 是否已解析。Whether resolution happened this tick.

方法 Methods

Reset void

复位全部成员:树链接清为无效句柄、附着来源回 WorldAnchor、解析状态回默认值、bResolvedThisTick = false、InterpState.Reset()。用于实体复用。

Resets every member: tree links to invalid handles, attachment source to WorldAnchor, resolved state to defaults, bResolvedThisTick = false and InterpState.Reset(). Used on entity reuse.

Input

无参数。

No parameters.

Output

无返回值。副作用:全部成员复位。

No return value. Side effect: all members reset.

FHostControllerTag USTRUCT

每个 Host 实体的永久 Tag,派生自 FA_MassBattleBaseTag。快速判断「这个 Mass 实体是不是 Host 控制器」,替代从各类型 Config 片段推断。

Permanent tag on every Host entity, derived from FA_MassBattleBaseTag. A fast check for "is this Mass entity a Host controller?", replacing inference from per-type Config fragments.

FCpuInterpTag USTRUCT

标记使用 CPU 逐帧插值的 FX 宿主,派生自 FA_MassBattleBaseTag。HostMonoProcessor 的 CpuInterpQuery 每引擎帧处理这些实体并把插值后的变换直接推送到 Niagara 数组。池创建时设置;实体生命周期内不可变——池复用时绝不添加/移除。

Tag on FX host entities using CPU-side per-frame interpolation, derived from FA_MassBattleBaseTag. HostMonoProcessor's CpuInterpQuery processes these every engine frame and pushes interpolated transforms directly to Niagara arrays. Set at pool creation; immutable for the entity's lifetime — never added/removed at pool reuse.

管线角色 Pipeline Role

grep 验证:FHostHierarchy 被 MassBattleHostMonoProcessor(逐帧解析层级与插值,经 CpuInterpQuery 处理 FCpuInterpTag 实体)、MassBattleNetworkProcessor、MassBattleAgentSubsystem 与 MassBattleHostSubsystem(构建/复用/解绑时维护树链接)引用。EHostAttachmentSource 由 HostMonoProcessor / AgentSubsystem / HostSubsystem 消费。

Verified by grep: FHostHierarchy is referenced by MassBattleHostMonoProcessor (resolves hierarchy and interpolation each frame, processing FCpuInterpTag entities via CpuInterpQuery), MassBattleNetworkProcessor, MassBattleAgentSubsystem and MassBattleHostSubsystem (maintains tree links at build/reuse/unlink). EHostAttachmentSource is consumed by HostMonoProcessor / AgentSubsystem / HostSubsystem.