MassBattle Docsv1.19.20

UMassBattleAgentMoveProcessor

UCLASS Processor

Source/MassBattle/Public/Processors/MassBattleAgentMoveProcessor.h

概述 Overview

Agent 移动与物理的浮点实现(与 UMassBattleAgentMoveProcessorFP 定点实现二选一,由 UMassBattleSubsystem::bUseFixPointMath 门控)。管线末尾执行(SimStages[4],Host 之后),按 UniqueID 动态比例分到 Subtick1/Subtick2 两个子帧(均衡器按墙钟成本 ±1 调整阈值,模拟结果中性——每 agent 从自身状态 + Subtick0 头部重建的静态网格快照积分,分区不影响结果)。逐实体十一段:① 距离与接受半径(按行为状态,追击用目标 PreLocation 保证确定性);② 期望方向 XY 寻路(流场 / A* / 直线,反应延迟 + 冷却 + 路径修补);③ MoveState 状态机(Arrived / Moving / Returning);④ 期望速度 XY(行为速度倍率 × 减速 × 距离/角度映射 × 斜坡修正);⑤ 期望速度向量;⑥ 速度注入(Launch 击退应用与免疫);⑦ RVO2 主动避让(ORCA 线性规划 + 交通规则——L1 遭遇分类缓存 FTrafficEncounter 一次计算多处消费(侧让义务、flank 绕行、制动距离限位、责任分配),压力场/力场两种求解器);⑧ PBD 被动碰撞(迭代求解);⑨ 压力场;⑩ Yaw 转向(机动模型:Creature/Aircraft/Vehicle);⑪ Tilt 倾斜。每段开头先排空 PendingFlowFieldLoads(异步流场加载),并串行处理 LaunchGatherer(按力大小升序确定性累加)。

Agent movement & physics float implementation (mutually exclusive with the fixed-point UMassBattleAgentMoveProcessorFP, gated by UMassBattleSubsystem::bUseFixPointMath). Runs at the end of the pipeline (SimStages[4], after Host), partitioned across Subtick1/Subtick2 by UniqueID with a dynamically rebalanced ratio (the balancer shifts the threshold ±1 per logic frame toward equal wall cost — sim-result-neutral: each agent integrates from its own state + the static grid snapshot rebuilt at the Subtick0 head, so the split never changes per-agent results). Per-entity eleven sections: ① distance & acceptance radius (per behavior state; chase uses the target's PreLocation for determinism); ② desired direction XY pathfinding (flow field / A* / straight line, reaction delay + cooldown + path patching); ③ MoveState machine (Arrived / Moving / Returning); ④ desired speed XY (behavior speed multiplier × slow × distance/angle maps × slope correction); ⑤ desired velocity vector; ⑥ velocity injection (Launch knockback application with immunity); ⑦ RVO2 active avoidance (ORCA linear programs + traffic rules — an L1 encounter-classification cache FTrafficEncounter computes once for many readers: sidestep obligation, flank detours, braking-range limiting, responsibility allocation; two solvers — RVO and force field); ⑧ PBD passive collision (iterative solver); ⑨ pressure field; ⑩ Yaw steering (movement models: Creature / Aircraft / Vehicle); ⑪ Tilt. Before the loop, PendingFlowFieldLoads is drained (async flow-field loads) and the LaunchGatherer is processed serially (deterministic ascending-force accumulation).

继承 Inheritance

UMassProcessor → UMassBattleAgentMoveProcessor

公开方法 Public Methods

UMassBattleAgentMoveProcessor 构造函数

构造函数。设置 bAutoRegisterWithProcessingPhases = false(手动派发)、bRequiresGameThreadExecution = true、ExecutionFlags = Standalone | Server | Client。

Constructor. Sets bAutoRegisterWithProcessingPhases = false (manually dispatched), bRequiresGameThreadExecution = true, and ExecutionFlags = Standalone | Server | Client.

Input

无参数。

No parameters.

Output

无返回值。副作用:注册为手动派发、游戏线程专用的处理器。

No return value. Side effect: registers as a manually-dispatched, game-thread-only processor.

ConfigureQueries virtual void

初始化实体查询:All<FAgentTag> + All<FScaling, FCollider, FTrace, FDefence, FPatrol, FChase, FReinforce, FMove, FReturn, FAttack, FAttacking, FDeath, FDying, FAgentEvent, FAgentDebug, FAgentController, FAvoidance, FBehaving>(MARO) + All<FLocating, FRotating, FDebuffing, FNavigation, FNavigating, FTracing, FAvoiding, FMoving, FReturning, FStatistics, FDeterminism, FEntityFlagFragment, FAnimating>(MARW) + All<FTrafficShared, FPhysicsShared, FAnimShared>(MARO)。

Initializes the entity query: All<FAgentTag> + All<FScaling, FCollider, FTrace, FDefence, FPatrol, FChase, FReinforce, FMove, FReturn, FAttack, FAttacking, FDeath, FDying, FAgentEvent, FAgentDebug, FAgentController, FAvoidance, FBehaving>(MARO) + All<FLocating, FRotating, FDebuffing, FNavigation, FNavigating, FTracing, FAvoiding, FMoving, FReturning, FStatistics, FDeterminism, FEntityFlagFragment, FAnimating>(MARW) + All<FTrafficShared, FPhysicsShared, FAnimShared>(MARO).

Input
参数 Param类型 Type说明 Description
EntityManagerconst TSharedRef<FMassEntityManager>Mass 实体管理器,查询初始化目标。Mass entity manager; query initialization target.
Output

无返回值。副作用:EntityQuery 注册进处理器。

No return value. Side effect: EntityQuery registered with the processor.

Execute virtual void

每 tick 执行入口。bUseFixPointMath 为 true 时直接返回(走 FP 处理器);取 MB / MA / 哈希网格(缺失返回);Subtick1/Subtick2 至少一个调度才执行。流程:① 排空 PendingFlowFieldLoads(MPSC 队列,ResolveAndRegisterRuntimeObjectPtr 加载流场并写 FNavigating.FlowFieldToUsePtr);② Launch 分配(串行):LaunchGatherer.Merge() → 按目标分组 → 确定性模式按力大小升序(InstigatorID 平局)累加 → 写入 Moving.LaunchVelSum;③ 逐实体移动循环(并行,UniqueID 分区过滤):Move.bEnable 为 false 或 bComponentDrivenPosition(组件驱动,位置由 GameState::ExecuteNetCommand 写入)时跳过;Section 1 距离/接受半径(Patrol/Chase/Reinforce/Attack 冷却/Return/Idle 各自半径;Chase 与 Attack 冷却读目标 PreLocation);Section 2 寻路(停止条件:Attacking 非冷却 / AimFailed 冷却 / Falling / Launching / Appearing / Sleeping / Dying / PlayerDriven / bStopActiveMovement;空闲流场跟随;Individual 个体寻路经 AFlowField::GetSteeringDirection,A* 全量重算(反应延迟 ReactionTimeRange + AStarCoolDown)或冷却中路径修补(替换修补尾部防无限增长),无直接回退防护;Section 3 MoveState:到达 → Arrived;Returning 旗标 → Returning;否则 Moving;Returning→Arrived 转换置 bJustFinished 跨帧信号;Section 4 期望速度:行为速度倍率(Patrol/Chase/Return) × CombinedSlowMult(减速叠加 × 免疫) × 角度映射(Creature) × 距离二次插值 × 斜坡恒定速度修正;Section 5 期望速度向量(PlayerDriven 消费 PendingInputVector,CMC 对齐的约束+缩放+空中控制);Section 6 速度注入(Launch 应用:免疫系数、置 Launching+Falling 旗标、3 秒倒计时);Section 7 RVO2 避让(场景胶囊扫描共享 RVO/PBD、邻居收集(网格)、ComputeRVO2AvoidingVelocity 或 ComputeForceFieldAvoidingVelocity(压力场),ORCA 线性规划 LP1/LP2/LP3,交通规则偏置与避让责任分配);Section 8 PBD 被动碰撞(预计算墙约束 PrecomputeWallConstraints、迭代求解、场景平面硬约束);Section 9 压力场;Section 10 Yaw(机动模型:Creature 直接朝向 / Aircraft / Vehicle 轮转向 ComputeVehicleDriveDirection + ApplyVehiclePhysicsTail,CMC 加减速 ApplyCMCVelocity);Section 11 Tilt(倾斜);Z 轴积分(地面/飞行、CachedGroundZ、KillZ);chunk 末 append 移动/巡逻/追击事件。

Per-tick entry. Returns immediately when bUseFixPointMath is true (the FP processor runs instead); resolves MB / MA / the hash grid (returns early if missing); executes when either Subtick1 or Subtick2 is scheduled. Flow: ① drains PendingFlowFieldLoads (MPSC queue; ResolveAndRegisterRuntimeObjectPtr loads the flow field into FNavigating.FlowFieldToUsePtr); ② launch distribution (serial): LaunchGatherer.Merge() → group per target → in deterministic mode sort by ascending force magnitude (InstigatorID tie-break) and accumulate → write Moving.LaunchVelSum; ③ per-entity movement loop (parallel, UniqueID partition filter): agents with Move.bEnable false or bComponentDrivenPosition (position written by GameState::ExecuteNetCommand) skip; Section 1 distance/acceptance radius (Patrol/Chase/Reinforce/Attack-cooldown/Return/Idle radii; Chase and Attack-cooldown read the target's PreLocation); Section 2 pathfinding (stop conditions: Attacking-not-cooling / AimFailed-cooling / Falling / Launching / Appearing / Sleeping / Dying / PlayerDriven / bStopActiveMovement; idle flow-field follow; Individual pathfinding via AFlowField::GetSteeringDirection with full A* recalc (reaction delay ReactionTimeRange + AStarCoolDown) or in-cooldown path patching (patch tail replaced to prevent unbounded growth), no-direct-fallback guards); Section 3 MoveState: arrived → Arrived; Returning flag → Returning; else Moving; the Returning→Arrived transition sets the bJustFinished cross-frame signal; Section 4 desired speed: behavior speed multiplier (Patrol/Chase/Return) × CombinedSlowMult (slow stacking × immunity) × angle map (Creature) × quadratic distance interpolation × slope constant-speed correction; Section 5 desired velocity vector (PlayerDriven consumes PendingInputVector with CMC-aligned constraint + scale + air control); Section 6 velocity injection (launch application with immunity, sets Launching+Falling flags, 3s countdown); Section 7 RVO2 avoidance (consolidated scene capsule sweep for RVO/PBD, neighbor collection from the grid, ComputeRVO2AvoidingVelocity or ComputeForceFieldAvoidingVelocity (pressure field), ORCA linear programs LP1/LP2/LP3, traffic-rule biases and avoidance-responsibility allocation); Section 8 PBD passive collision (precomputed wall constraints via PrecomputeWallConstraints, iterative solver, scene planes as hard constraints); Section 9 pressure field; Section 10 Yaw (movement models: Creature direct facing / Aircraft / Vehicle wheel steering via ComputeVehicleDriveDirection + ApplyVehiclePhysicsTail, CMC accel/decel via ApplyCMCVelocity); Section 11 Tilt; Z-axis integration (ground/flying, CachedGroundZ, KillZ); move/patrol/chase events appended at chunk end.

Input
参数 Param类型 Type说明 Description
EntityManagerFMassEntityManager&实体管理器。Entity manager.
ContextFMassExecutionContext&执行上下文,提供 fragment 视图与实体遍历。Execution context providing fragment views and entity iteration.
Output

无返回值。副作用:写全部命中实体的 FLocating / FRotating / FMoving / FNavigating / FAvoiding / FDebuffing 等;消费 LaunchGatherer 与 PendingFlowFieldLoads;向 MB.OnMoveQueue / OnPatrolQueue / OnChaseQueue 与调试队列写入。

No return value. Side effects: writes FLocating / FRotating / FMoving / FNavigating / FAvoiding / FDebuffing etc. on all matched entities; consumes LaunchGatherer and PendingFlowFieldLoads; writes to MB.OnMoveQueue / OnPatrolQueue / OnChaseQueue and debug queues.

ProjectPointDownToNavmesh static bool

把世界点垂直向下投影到 navmesh:从 InPoint + Z 垂直向下做 VerticalSearchDist 的通道追踪,命中可步行表面则写 OutNavLocation。巡逻目标选点与飞行悬停高度的地面检测使用。

Projects a world point straight down onto the navmesh: channel-traces downward from InPoint + Z over VerticalSearchDist; on a walkable hit writes OutNavLocation. Used by patrol goal picking and flying-hover ground detection.

Input
参数 Param类型 Type说明 Description
WorldUWorld*世界,提供追踪。World providing the trace.
InPointconst FVector待投影点。Point to project.
TraceChannelECollisionChannel追踪通道(地面通道)。Trace channel (ground channel).
OutNavLocationFVector&输出的 navmesh 命中位置。Output navmesh hit location.
VerticalSearchDistfloat垂直搜索距离(默认 500u)。Vertical search distance (default 500).
Output

返回是否命中;命中时 OutNavLocation 被写入。

Returns whether a hit occurred; OutNavLocation written on hit.

QueryFlowFieldNav static FFlowFieldNavResult

流场导航查询:从实体位置采样流场(经 FFlowfieldScratchContext 线程本地上下文),返回方向/模式/采样单元哈希等结果。LayerHandle 指定层,默认使用流场默认层。

Flow-field navigation query: samples the field from the entity position (via the thread-local FFlowfieldScratchContext), returning direction/mode/sampled-cell hash etc. LayerHandle selects a layer, defaulting to the field's default layer.

Input
参数 Param类型 Type说明 Description
FlowField 等 12 参数多参数流场指针、位置、碰撞体 up、尺寸参数、Collider/Move/Moving/Navigation 片段与 scratch 上下文,可选层句柄。Flow-field pointer, location, collider up, size params, Collider/Move/Moving/Navigation fragments, scratch context, optional layer handle.
Output

返回 FFlowFieldNavResult(方向/导航模式/采样哈希等)。

Returns FFlowFieldNavResult (direction / nav mode / sampled hash etc.).

TryFlyingFallbackOutsideField static bool

飞行 agent 在流场覆盖范围外时的回退:直接朝目标直线飞行,写 OutNavMode / OutDirection。

Fallback for flying agents outside the flow field's coverage: fly straight toward the goal, writing OutNavMode / OutDirection.

Input
参数 Param类型 Type说明 Description
FlowField / SelfLocation / bCanFly / Moving / OutNavMode / OutDirection多参数流场指针、位置、是否可飞、移动状态与两个输出。Flow-field pointer, location, fly flag, moving state, and two outputs.
Output

返回是否启用了回退;命中时写 OutNavMode / OutDirection。

Returns whether the fallback engaged; writes OutNavMode / OutDirection on success.

ApplyFlowFieldReactionTime static FVector

流场反应延迟:目标方向按 ReactionTimeRange 随机延迟后生效(以 SampledCellsHash 区分采样点),写入 FNavigating 并消费实体 RandomStream 与 FDeterminism。

Flow-field reaction delay: the target direction takes effect after a random delay in ReactionTimeRange (keyed by SampledCellsHash), written into FNavigating while consuming the entity's RandomStream and FDeterminism.

Input
参数 Param类型 Type说明 Description
TargetDir / SampledCellsHash / Navigation / Navigating / Det / DeltaTime多参数目标方向、采样单元哈希、导航配置/状态、确定性片段与帧时间。Target direction, sampled-cell hash, navigation config/state, determinism fragment, and delta time.
Output

返回最终生效方向。副作用:写 Navigating 的延迟计时并消费随机流。

Returns the final effective direction. Side effects: writes Navigating delay timers and consumes the random stream.

EllipseRadiusAtAngle static float

椭圆在给定接近方向上的半径:把方向变换到椭圆局部系,按半长轴/半短轴解析计算。

Ellipse radius along a given approach direction: transforms the direction into the ellipse's local frame and evaluates the semi-major/semi-minor analytic formula.

Input
参数 Param类型 Type说明 Description
a / b / majorDir / approachDirfloat / float / FVector2f / FVector2f半长轴、半短轴、主轴方向、接近方向。Semi-major, semi-minor, major direction, approach direction.
Output

返回该方向上的椭圆半径。

Returns the ellipse radius along the direction.

SelectFrictionForward static FVector

按机动模型选择摩擦参照方向——决定减速/摩擦施加的轴向。Creature 为指令驱动前向(「侧向」垂直于本帧实际被执行的转向方向),优先级:求解器指令速度 SolverVel2D(绕行/侧让等有意侧向机动计入前向)→ 原始意图 DesiredVel2D → 朝向 Heading2D;Vehicle/Aircraft 为底盘前向(横向抓地力与车体朝向对齐),直接用朝向。

Selects the friction reference direction by movement model — the axis along which deceleration/friction applies. Creature is command-driven forward ("lateral" is perpendicular to where the agent is actually being steered this frame), priority: the solver command velocity SolverVel2D (deliberate lateral steering counts as forward) → raw intent DesiredVel2D → heading Heading2D; Vehicle/Aircraft are chassis-forward (lateral grip aligned with body orientation), using the heading directly.

Input
参数 Param类型 Type说明 Description
MovementModel / Heading2D / DesiredVel2D / SolverVel2DEMovementModel / FVector / FVector / FVector机动模型、2D 朝向、2D 期望速度与 2D 求解器(避让后)速度。Movement model, 2D heading, 2D desired velocity, and the 2D (post-avoidance) solver velocity.
Output

返回摩擦参照方向。

Returns the friction reference direction.

ComputeEllipseFromMult static FEllipseParams

按基础半径 × 双轴乘数计算避让椭圆(主轴投影到水平面)。

Computes the avoidance ellipse from a base radius × per-axis multipliers (major axis projected to the horizontal plane).

Input
参数 Param类型 Type说明 Description
BaseRadius / AvoidDistMult / UpVectorfloat / FVector2f / FVector3f基础半径、XY 避让距离乘数、up 向量。Base radius, XY avoidance distance multipliers, up vector.
Output

返回 FEllipseParams(半长轴/半短轴/主轴方向)。

Returns FEllipseParams (semi-major / semi-minor / major direction).

ComputeEllipseFromNeighbor static FEllipseParams

按邻居避让半径直接构造椭圆(与 ComputeEllipseFromMult 语义互补,输入已是半径对)。

Builds the ellipse directly from neighbor avoidance radii (complementary to ComputeEllipseFromMult; the input is already a radius pair).

Input
参数 Param类型 Type说明 Description
AvoidRadius / UpVectorFVector2f / FVector3fXY 避让半径对与 up 向量。XY avoidance radii and up vector.
Output

返回 FEllipseParams。

Returns FEllipseParams.

ComputeForecastDriveSpeeds static FForecastDriveSpeeds

按基础速度与倒车速度比计算正/反向预测速度,供 AlignToPath / AlignToMovement 的正反决策。

Computes forward/reverse forecast drive speeds from the base move speed and reverse-speed ratio, for the AlignToPath / AlignToMovement reverse-vs-forward decision.

Input
参数 Param类型 Type说明 Description
BaseMoveSpeed / ReverseSpeedRatiofloat / float基础移动速度与倒车速度比。Base move speed and reverse speed ratio.
Output

返回 FForecastDriveSpeeds。

Returns FForecastDriveSpeeds.

ComputeCapsuleCenterToGroundOffset static float

胶囊中心到地面的偏移:半杆长 × |up.Z| + 半径(倾斜投影)。

Capsule center-to-ground offset: shaft half length × |up.Z| + radius (tilted projection).

Input
参数 Param类型 Type说明 Description
ShaftHalfHeight / Radius / ColliderUpfloat / float / FVector3f半杆高、半径、碰撞体 up 向量。Shaft half height, radius, collider up vector.
Output

返回偏移距离。

Returns the offset distance.

ApplyCMCVelocity static void

CMC 风格速度逼近:目标速度高于当前速度用 Accel 加速,低于用 Decel 减速,按 DT 线性逼近。

CMC-style velocity approach: accelerates toward the target velocity with Accel when higher, decelerates with Decel when lower, approaching linearly over DT.

Input
参数 Param类型 Type说明 Description
CurrentVel / TargetVel / Accel / Decel / DTFVector& / const FVector / float / float / float当前速度(就地修改)、目标速度、加减速度与时间步。Current velocity (mutated in place), target velocity, accel/decel, and delta time.
Output

无返回值。副作用:CurrentVel 被逼近。

No return value. Side effect: CurrentVel approaches the target.

ComputeVehicleDriveDirection static FVector

载具驱动方向:期望方向与当前朝向的夹角受 MaxSteeringAngleDeg 限制,转向角以 SteeringRateDegPerSec 速率趋近(经 InOutSteeringAngleDeg 跨帧保持),输出带转向角的驱动方向。

Vehicle drive direction: the angle between the desired direction and current heading is clamped to MaxSteeringAngleDeg, the steering angle approaches at SteeringRateDegPerSec (persisted across frames via InOutSteeringAngleDeg), outputting the steered drive direction.

Input
参数 Param类型 Type说明 Description
ForwardDirection 等 7 参数多参数当前朝向、期望 2D 方向、最大转向角、转向速率、帧时间、当前前进速度与跨帧转向角引用。Current forward, desired 2D direction, max steering angle, steering rate, delta time, current forward speed, and the in-out steering angle reference.
Output

返回驱动方向。副作用:InOutSteeringAngleDeg 被更新。

Returns the drive direction. Side effect: InOutSteeringAngleDeg updated.

ApplyVehiclePhysicsTail static FVector

载具物理尾段:目标前进速度的加减速逼近(TargetForwardSpeed 就地更新),按驱动方向与当前速度组合输出本帧速度。

Vehicle physics tail: accel/decel approach of the target forward speed (TargetForwardSpeed mutated in place), combining drive direction with current velocity into this frame's velocity.

Input
参数 Param类型 Type说明 Description
TargetForwardSpeed 等 6 参数多参数目标前进速度引用、驱动方向、当前 2D 速度、Move/Moving 片段、帧时间与位置。Target forward speed ref, drive direction, current 2D velocity, Move/Moving fragments, delta time, and location.
Output

返回本帧速度。副作用:TargetForwardSpeed 被逼近。

Returns this frame's velocity. Side effect: TargetForwardSpeed approaches its target.

成员变量 Members

FEllipseParams struct (头文件公开)

定向避让半径的椭圆参数:SemiMajor(半长轴)、SemiMinor(半短轴)、MajorDir(主轴方向,2D)。

Ellipse parameters for directional avoidance radius: SemiMajor, SemiMinor, MajorDir (2D major direction).

FForecastDriveSpeeds struct (头文件公开)

对齐路径/移动方向的正反预测速度:Forward / Reverse。

Forecast drive speeds for the AlignToPath / AlignToMovement reverse-vs-forward decision: Forward / Reverse.

FSceneObstRVOData struct (头文件公开)

场景追踪产生的 RVO 障碍数据:从 FHitResult 构造,含 ClosestPoint / Normal / DistSqr / Distance。

Scene-obstacle RVO data from scene traces: constructed from an FHitResult with ClosestPoint / Normal / DistSqr / Distance.

FOrcaLine struct (头文件公开)

2D 有向线段,替换 RVO::Line——ORCA 线性规划的约束线(point + direction)。

2D directed line replacing RVO::Line — the ORCA linear-program constraint lines (point + direction).

FWallConstraint struct (头文件公开)

PBD 与 RVO 共用的墙约束:ClosestPoint / Normal / DistanceSq / bIsTouching(均带默认初始化)。仅平面约束语义:线段/盒/场景障碍在此统一为最近点 + agent 相对法线,求解器一视同仁。

Unified wall constraint for both PBD and RVO: ClosestPoint / Normal / DistanceSq / bIsTouching (all default-initialized). Plane-constraint only: every obstacle kind (segment, box, scene) resolves to a closest point + agent-relative normal here, so the solver treats them identically.

FTrafficEncounter struct (头文件公开)

L1 遭遇分类缓存(TrafficRedesignPlan Phase 0+):每个已采集的 agent 邻居一条,预解算偏置运行前每 agent 填充一次;消费方与邻居数组平行索引。缓存原先各交通规则重复计算的共享逐对几何量——一次计算,多处消费;数值表达式与原内联版本一致,行为不变。

L1 encounter-classification cache (TrafficRedesignPlan Phase 0+): one entry per gathered agent neighbor, filled once per agent right before the pre-solve biases run; consumers index it parallel to the neighbor array. It caches the shared per-pair geometry the traffic rules used to recompute — one pass, many readers; values use the exact expressions the rules computed inline, so the cached path is behavior-identical.

成员变量 Members
名称 Name类型 Type默认值说明 Description
RelPosLenSqfloat0中心间距平方(|relPos|²)。Squared distance between centers (|relPos|²).
HeadingDotfloat2.0归一化自身 DV·邻居 DV;2.0 哨兵 = 无效(任一 DV ≈ 0)——消费方须先跳过退化 DV 邻居。Normalized selfDV·otherDV; the 2.0 sentinel = invalid (either DV ≈ 0) — consumers skip degenerate-DV neighbors before reading.
ApproachDotfloat2.0归一化邻居 DV·相对位置;2.0 哨兵 = 无效。Normalized otherDV·relPos; 2.0 sentinel = invalid.
ForwardDotfloat0自身 DV·相对位置(未归一化;>0 即对方在前)。selfDV·relPos (unnormalized; > 0 ⇒ the other is ahead).
CrossHeadOnfloat0cross(selfDV, relPos):>0 即对方在自身左侧 → 右转(CW)。cross(selfDV, relPos): > 0 ⇒ the other is on self's LEFT → steer right (CW).
CrossSidefloat0侧让判侧:cross(−otherDV, relPos),>0 即自身在对方左侧。Sidestep side: cross(−otherDV, relPos) — > 0 ⇒ self is on the other's LEFT.
bWillReachSelfboolfalse邻居剩余路径能否行进至自身避障椭圆(否则它会先停下)。Whether the neighbor's remaining path reaches self's avoidance ellipse (else it stops first).
bAttackerFilteredboolfalse该对被攻击者旁路过滤跳过(规则必须同样跳过)。Pair skipped by the attacker bypass filter (rules must skip identically).
Yieldfloat0.5L2 责任值——该对中自身承担的避障责任比例 [0,1]。分类时一次计算;机动幅度与 ORCA 求解器的责任比例共用(双环公理:两环读同一数值)。L2 yield — self's avoidance-responsibility share for this pair, [0,1]. Computed once during classification; consumed by BOTH the maneuver magnitude weighting and the ORCA solver's responsibility ratio (dual-ring axiom: both rings read the same number).
EffRankint320邻居的交通档位(原始发布档位的镜像缓存);LaneShift/SideStep/OtherVel 等规则消费方读它。仅分类运行后有效。Effective traffic rank of this neighbor (cached mirror of the raw published rank); read by the LaneShift/SideStep/OtherVel consumers. Valid only after classification ran.
FAgentMoveScratchContext struct (头文件公开)

线程本地临时上下文(过大无法放 fragment):ORCA 约束线、去重集合、RVO/PBD 邻居列表(inline allocator 提升缓存局部性)、PBD 预计算最近点、场景平面(障碍/地面/天花板)、L1 遭遇缓存 TrafficEncounters 与逐 agent 路径坐标系(路径切向/右向/侧偏/目标前向投影/自身档位)、求解器触达限位(bSolverRangeCapped / SolverAgentDetectDist,ORCA 跳过超出制动距离的已采集邻居而远距交通规则保留完整视野)、逐帧交通标志(bSideStepObligationThisFrame / bFlankActiveThisFrame / bSelfFarReturning / bAnyForceHybridFFObst)、LocalMoveEvents / LocalPatrolEvents / LocalChaseEvents、路径修补数组与临时逻辑旗标。Reset() 只清内容保留容量(LocalMoveEvents 按 chunk 手动重置;全部标志/路径字段每帧复位,无滞后)。

Thread-local scratch context (too large for a fragment): ORCA lines, dedup sets, RVO/PBD neighbor lists (inline allocators for cache locality), precomputed PBD closest points, scene planes (obstacle/ground/ceiling), the L1 encounter cache TrafficEncounters plus the per-agent path frame (path tangent/right, lateral offset, goal forward projection, self rank), the solver reach cap (bSolverRangeCapped / SolverAgentDetectDist — the ORCA loop skips gathered neighbors beyond the braking distance while long-range traffic rules keep their full DetectRange view), per-frame traffic flags (bSideStepObligationThisFrame / bFlankActiveThisFrame / bSelfFarReturning / bAnyForceHybridFFObst), LocalMoveEvents / LocalPatrolEvents / LocalChaseEvents, path-patch scratch, and temp logic flags. Reset() clears contents keeping capacity (LocalMoveEvents reset manually per chunk; all flags/path fields reset fresh each frame — no one-frame lag).

FPendingFlowFieldLoad struct (头文件公开)

异步流场加载请求(Entity + 软引用 SoftField),经 MPSC PendingFlowFieldLoads 队列提交。

Async flow-field load request (Entity + soft reference SoftField), submitted via the MPSC PendingFlowFieldLoads queue.

EntityQuery / PendingFlowFieldLoads FMassEntityQuery / TQueue<FPendingFlowFieldLoad, EQueueMode::Mpsc> (private)

EntityQuery 为主查询;MPSC 队列承载跨线程提交的流场加载请求,Execute 帧首排空。

EntityQuery is the main query; the MPSC queue carries cross-thread flow-field load requests, drained at the head of Execute.

管线角色 Pipeline Role

注册于 UMassBattleSubsystem 的 SimStages[4](倒数第二阶段,Host 之后),Subtick1/Subtick2 两个子帧按 UniqueID 分区执行;与 UMassBattleAgentMoveProcessorFP 互斥(bUseFixPointMath 门控,两者都注册但只有一个运行)。消费:LaunchGatherer(Behavior/Projectile 同 tick 收集的击退)、GridUpdateProcessor 帧起始重建的网格快照(只读)、FNavigating.FlowFieldToUsePtr(异步加载)、Behavior 处理器写入的 Moving.Goal。产物被 AgentRenderProcessor(FVisualizing 速度缓存)与 HostMonoProcessor(实体位置)消费。

Registered in UMassBattleSubsystem's SimStages[4] (second-to-last stage, after Host), partitioned across Subtick1/Subtick2 by UniqueID; mutually exclusive with UMassBattleAgentMoveProcessorFP (gated by bUseFixPointMath; both are registered but only one runs). Consumes: LaunchGatherer (knockback gathered same-tick by Behavior/Projectile), the grid snapshot rebuilt at start of frame by GridUpdateProcessor (read-only), FNavigating.FlowFieldToUsePtr (async-loaded), and Moving.Goal written by the Behavior processor. Outputs are consumed by AgentRenderProcessor (FVisualizing velocity caches) and HostMonoProcessor (entity positions).