MassBattle Docsv1.19.20

Reinforce.h

USTRUCT ×3

Source/MassBattle/Public/Fragments/Reinforce.h

概述 Overview

支援(增援)行为相关 fragment 集合:配置 FReinforce(Agent 向指挥中心上报目标情报、丢失目标后向共享目标增援的行为参数)、运行时状态 FReinforcing(当前增援目标、卡死检测计时器等逐帧状态)与辅助条目 FReinforceTargetEntry(指挥中心记录每个共享目标的条目,缓存位置以支持无 fragment 查询的最近目标查找)。行为路径由 EReinforceMode(定义于 MassBattleEnums.h)选择,bEnable 为总开关。

Reinforce-behavior fragment collection: config FReinforce (parameters for sharing target sightings with a command center and reinforcing toward shared targets after target loss), runtime state FReinforcing (current reinforce target, stuck-detection timers), and the helper entry FReinforceTargetEntry (per-shared-target record on the command center; cached location enables nearest-target lookup without fragment queries). The active behavior paths are selected by EReinforceMode (defined in MassBattleEnums.h), gated by bEnable.

FReinforceTargetEntry USTRUCT

指挥中心实体记录每个共享目标的条目。CachedLocation 使查最近目标时无需对该目标实体做 fragment 查询。

Per-command-center entry tracking a shared target. CachedLocation enables nearest-target lookup without fragment queries on the target entity.

成员变量 Members

名称 Name类型 Type默认值说明 Description
TargetFEntityHandle—共享目标实体句柄。Handle of the shared target entity.
CachedLocationFVectorZeroVector目标缓存的最近位置,用于无 fragment 查询的最近目标查找。Cached target location for nearest-target lookup without fragment queries.
ReportCountint320该目标的累计上报次数。Accumulated report count for this target.

FReinforce USTRUCT

支援行为配置 fragment(FA_MassBattleBaseFragment 派生)。所有字段为策划在 EntityConfig 中可调参数,运行时不变。bEnable 是总开关;Mode 选择开启后的行为路径(默认 Full 向后兼容 bEnable=true)。

Reinforce-behavior config fragment (derived from FA_MassBattleBaseFragment). All fields are designer-tunable EntityConfig parameters, constant at runtime. bEnable is the master gate; Mode selects which paths are active (default Full preserves backward compatibility with bEnable=true).

成员变量 Members

名称 Name类型 Type默认值说明 Description
bEnableboolfalse是否启用支援行为——与指挥中心共享目标情报,丢失目标后向共享目标增援。Whether to enable reinforce behavior — share target sightings with the command center and reinforce toward shared targets on target loss.
ModeEReinforceModeFull支援模式:ReportOnly = 只上报,ReinforceOnly = 只支援,Full = 两者兼有。bEnable 必须为 true。Reinforce mode: ReportOnly = report only, ReinforceOnly = reinforce only, Full = both. bEnable must be true.
CommandCenterFEntityHandle—指挥中心实体——必须是 Agent。Agent 向其上报目标并从中查询共享目标。Command center entity — MUST be an agent. Agents report targets to and query shared targets from this entity.
AcceptanceRadiusfloat200.f与增援目标距离低于该值时停止增援(距离单位)。Stop reinforcing when distance to the target is below this value.
MoveSpeedMultfloat1.f增援过程中的移动速度乘数。Movement speed multiplier while reinforcing.
MaxReinforceDistancefloat0.f到共享目标的 2D 距离超过该值时放弃增援。0 = 无限。Give up reinforcing if 2D distance to the shared target exceeds this. 0 = infinite.
StuckTimeoutfloat5.f距离无减少的最大时间(秒),超时后放弃当前增援目标重新查询。Max time (seconds) with no distance-to-target decrease before abandoning the current reinforce target and re-querying.

FReinforcing USTRUCT

支援行为运行时状态 fragment(FA_MassBattleBaseFragment 派生)。由支援相关处理器逐帧更新当前增援目标与卡死检测状态。含 TArray 成员,经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明为不可平凡拷贝。

Reinforce-behavior runtime state fragment (derived from FA_MassBattleBaseFragment). Updated per frame by the reinforce-related processors with the current reinforce target and stuck-detection state. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE as not-trivially-copyable (contains TArray members).

成员变量 Members

名称 Name类型 Type默认值说明 Description
CurrentReinforceTargetFEntityHandle—Agent 当前正在增援的目标。Current target the agent is reinforcing toward.
bHasEverHadTargetboolfalse守卫:从未有过目标的 Agent 跳过支援。首次获得索敌目标时置 true,之后不重置。Gate: newborn agents with no prior target skip reinforce. Set true on first trace-target acquisition, never cleared.
TargetEntriesTArray<FReinforceTargetEntry>空共享目标账本——预留给指挥中心持久化累积。当前未使用;活跃支援使用每帧 CommanderSnapshots。普通 Agent 此数组为空。Shared-target ledger — reserved for persistent commander-side accumulation. Currently unused; active reinforce uses per-frame CommanderSnapshots instead. Empty on regular agents.
StuckTimerfloat0.f卡死检测——无进展时累加的计时(秒)。Stuck detection — timer accumulates when there is no progress toward the target.
LastDistToTargetfloat0.f上次记录的到支援目标的直线距离平方——无路径时使用。Last recorded straight-line distance (squared) to the reinforce target — used when no path exists.
LastPathIndexint320上次路径索引,路径卡死检测用。索引进位 = 有进展。Last path index for path-based stuck detection. Index advanced = progress.
LastDistToPathPointSqfloat0.f上次到当前路径点的距离平方。距离减少 = 有进展。Last distance (squared) to the current path point. Getting closer = progress.

管线角色 Pipeline Role

FReinforce / FReinforcing 在 MassBattle 管线中的位置:由 MassBattleAgentBehaviorProcessor(行为状态机)、MassBattleAgentMoveProcessor / MassBattleAgentMoveProcessorFP(增援移动)、MassBattleAgentTraceProcessor(目标上报)与 MassBattleAgentSubsystem(指挥中心宿主)读写;FReinforcing 的字段进入 MassBattleSnapshotRegistry 快照注册表,参与网络同步。

Position of FReinforce / FReinforcing in the MassBattle pipeline: read/written by MassBattleAgentBehaviorProcessor (behavior state machine), MassBattleAgentMoveProcessor / MassBattleAgentMoveProcessorFP (reinforce movement), MassBattleAgentTraceProcessor (target reporting) and MassBattleAgentSubsystem (command center host). FReinforcing fields are registered in MassBattleSnapshotRegistry for network sync.