Mass Battle Frameworkv1.20.0

UMassBattleAgentMoveProcessorFP

UCLASS Processor AUTO-DRIVEN · NO SETUP

Source/MassBattle/Public/Processors/MassBattleAgentMoveProcessorFP.h

继承Inheritance

UMassProcessor → UMassBattleAgentMoveProcessorFP

概述Overview

单位移动处理器的定点数版本:与浮点版行为一致,数值路径使用 Fix64 定点运算,供需要跨平台逐位一致的项目选用。由插件自动调度,无需配置;可配置项与浮点版相同。

The fixed-point twin of the movement processor: identical behavior, numeric path in Fix64 fixed-point for projects needing bit-identical results across platforms. Auto-scheduled; the tunables are the same as the float version.

重要:本处理器仍属实验性质——它是通向全定点、跨平台确定性 MassBattle 的地基,本身不是一个完成的确定性功能。物理、抛射物、行为、空间网格与网络哈希等其余系统仍走浮点,现在只打开定点移动拿不到跨平台逐位一致的锁步;不要在这一假设上构建生产玩法。入口由子系统开关 bUseFixPointMath 门控:关闭时本处理器立即返回,移动阶段交给浮点版。

Important: this processor is still experimental — it is groundwork toward a fully fixed-point, cross-platform-deterministic MassBattle, not a finished determinism feature. Physics, projectiles, behavior, the spatial grid and the network hash still run float, so enabling fixed-point move alone does not yet deliver bit-identical cross-platform lockstep; do not build production gameplay on that assumption. The entry is gated by the subsystem switch bUseFixPointMath: with it off this processor returns immediately and the movement stage belongs to the float twin.

FEllipseParamsFP

方向性避障半径的椭圆参数。解算器用它回答「沿某个来向看,自身还有多少避让半径」——侧向与正向可以有不同距离,单一圆半径表达不了这件事。三个字段都是定点类型,参与逐位一致的运算与比较。

Ellipse parameters for a directional avoidance radius. The solver uses them to answer "how much clearance does this agent still have along this approach direction" — lateral and forward distances may differ, which a single circle radius cannot express. All three fields are fixed-point, so the arithmetic and comparisons stay bit-identical across machines.

成员变量Members

名称Name类型Type默认值说明Description
SemiMajorFFix64—椭圆的半长轴。Semi-major axis of the ellipse.
SemiMinorFFix64—椭圆的半短轴。Semi-minor axis of the ellipse.
MajorDirFFixVector2—长轴在水平面上的方向。Direction of the major axis in the horizontal plane.

FForecastDriveSpeedsFP

对齐到路径 / 对齐到移动方向时,「向前追」与「倒回去」两种方案的预测驱动速度。两个标量都由基础移动速度与倒车速度比算出,调用方比较两者后决定这次对齐朝哪个方向开。

Forecast drive speeds for the forward-versus-reverse decision when aligning to a path or to the movement direction. Both scalars derive from the base move speed and the reverse speed ratio; the caller compares them and picks which way to drive for this alignment.

成员变量Members

名称Name类型Type默认值说明Description
ForwardFFix64—朝前进方向行驶时的预测驱动速度。Forecast drive speed when travelling forward.
ReverseFFix64—倒车时的预测驱动速度。Forecast drive speed when reversing.

FSceneObstRVODataFP

由场景射线命中整理出的障碍数据:最近点、表面法线、距离与距离平方。它把一个 FHitResult 与自身位置压成解算器需要的形状——最近点取命中点,法线取命中法线,距离取命中距离,距离平方由自身位置到最近点现算。

Obstacle data distilled from a scene trace hit: closest point, surface normal, distance and squared distance. It compresses an FHitResult plus the agent's location into the shape the solver wants — the closest point is the impact point, the normal is the impact normal, the distance is the hit distance, and the squared distance is computed from the agent's location to the closest point.

成员变量Members

名称Name类型Type默认值说明Description
ClosestPointFFixVector3—障碍上离自身最近的点。Point on the obstacle closest to the agent.
NormalFFixVector3—最近点处的表面法线。Surface normal at the closest point.
DistSqrFFix64—自身位置到最近点的距离平方。Squared distance from the agent's location to the closest point.
DistanceFFix64—命中距离,取自 FHitResult::Distance。Hit distance, taken from FHitResult::Distance.

FOrcaLineFP

ORCA 求解器的一条二维有向线:约束点加方向。邻居产生的半平面约束以这种形状进入线列表,再由三个线性规划函数逐一求解;字段全部是定点类型,使整个求解过程可以跨架构逐位一致。

A 2D directed line for the ORCA solver: a point plus a direction. Each half-plane constraint produced by a neighbour enters the line list in this shape and is then solved by the three linear-program functions; every field is fixed-point so the whole solve can be bit-identical across architectures.

成员变量Members

名称Name类型Type默认值说明Description
pointFFixVector2—约束线上的一点。A point on the constraint line.
directionFFixVector2—线的方向。Direction of the line.

FWallConstraintFP

PBD 与 ORCA 共用的墙体约束:只保留平面约束——最近点、相对自身的法线与距离平方,外加一个「正在接触」标记。线段、盒体与场景三类障碍在进入解算器之前都先归约成这一种形状,于是求解器不必为障碍种类分支。

The wall constraint shared by PBD and ORCA: plane constraints only — closest point, agent-relative normal, squared distance, plus a "currently touching" flag. Segments, boxes and scene hits are all reduced to this one shape before reaching the solver, so the solver never branches on obstacle kind.

成员变量Members

名称Name类型Type默认值说明Description
ClosestPointFFixVector2—障碍上离自身最近的点(水平面)。Point on the obstacle closest to the agent (horizontal plane).
NormalFFixVector2—相对自身的法线,指向可从该侧推开的一边。Agent-relative normal, pointing to the side the agent can be pushed away from.
DistanceSqFFix64—到最近点的距离平方。Squared distance to the closest point.
bIsTouchingboolfalse本帧是否已经与这段约束接触。Whether this constraint is already in contact this frame.

FTrafficEncounterFP

交通规则分类缓存:每个聚集到的邻居槽位一条,每单位每帧在求解前的交通偏置之前填一次。字段保存分类所需的点积 / 叉积结果、两个路径判定,以及该邻居对本单位的让行份额;后续交通规则消费者只读这里,不重新计算。HeadingDot 与 ApproachDot 的初值 2.0 是「无效」哨兵——两个单位方向的点积不可能达到 2。

Traffic classification cache: one entry per gathered neighbour slot, filled once per agent per frame right before the pre-solve traffic biases. The fields hold the dot and cross products the classification needs, two path verdicts, and this neighbour's share of the yielding responsibility toward the agent; downstream traffic consumers read them instead of recomputing. HeadingDot and ApproachDot start at 2.0 as an invalid sentinel — a dot product of two unit directions can never reach 2.

成员变量Members

名称Name类型Type默认值说明Description
RelPosLenSqFFix64FFix64::Zero()相对位置的平方长度,即两者的中心距平方。Squared length of the relative position, i.e. the squared centre distance.
HeadingDotFFix64FFix64::FromFloat(2.f)归一化后自身方向与邻居方向的点积;2.0 表示无效(某一侧方向退化)。Dot of the normalized self direction and the neighbour direction; 2.0 means invalid (one side's direction is degenerate).
ApproachDotFFix64FFix64::FromFloat(2.f)归一化后的邻居方向与相对位置的标准化点积;2.0 表示无效。Normalized dot of the neighbour direction and the relative position; 2.0 means invalid.
ForwardDotFFix64FFix64::Zero()自身方向与相对位置的点积(不归一化)。Dot of the self direction and the relative position (not normalized).
CrossHeadOnFFix64FFix64::Zero()cross(自身方向, 相对位置) 的二维叉积。2D cross of the self direction and the relative position.
CrossSideFFix64FFix64::Zero()cross(-邻居方向, 相对位置) 的二维叉积。2D cross of the negated neighbour direction and the relative position.
YieldFxFFix64FFix64::FromFloat(0.5f)本单位在这对关系里的避让责任份额,范围 [0,1]。分类时算一次,同时供机动幅度加权与 ORCA 求解器的责任比使用。The agent's avoidance-responsibility share for this pair, in [0,1]. Computed once during classification and consumed both by the maneuver magnitude weighting and by the ORCA solver's responsibility ratio.
EffRankint320该邻居在这对关系中的交通等级(已发布等级的缓存)。交通规则消费者读它;只有分类跑过之后才有效。Traffic rank of this neighbour for the pair (a cache of the published rank). Traffic-rule consumers read it; valid only after classification ran.
bWillReachSelfboolfalse该邻居的路径是否会到达本单位的椭圆范围。Whether the neighbour's path reaches the agent's ellipse.
bAttackerFilteredboolfalse该邻居是否因攻击者规则被跳过。Whether this neighbour was skipped by the attacker rule.

FAgentMoveScratchContextFP

每个单位一帧的临时工作区。这些数据体积远超一个 fragment 该有的尺寸,所以不进 chunk,而是线程局部的 scratch;每处理一个单位复用同一份缓冲,Reset() 只清空容器、保留已分配的容量。内容分五族:RVO 的速度线与去重集合、按障碍种类分开的邻居列表、PBD 的邻居与预计算好的最近点、场景约束平面、以及交通与侧让的临时状态。

Per-agent, per-frame scratch space. This data is far larger than a fragment should be, so it lives outside the chunk as thread-local scratch; the same buffer is reused for each agent and Reset() only empties the containers while keeping the allocated capacity. Contents fall into five families: ORCA velocity lines and dedup sets, per-obstacle-kind neighbour lists, PBD neighbours and precomputed closest points, scene constraint planes, and traffic / side-step temporary state.

成员变量Members

名称Name类型Type默认值说明Description
OrcaLinesTArray<FOrcaLineFP, TInlineAllocator<32>>—ORCA 求解器本帧的约束线缓冲,求解时被覆盖写。Constraint-line buffer for this frame's ORCA solve; overwritten during the solve.
SeenAgentsTSet<int32>—按 UniqueID 对已聚集的邻居单位去重。Deduplicates gathered neighbour agents by UniqueID.
SeenObstaclesTSet<FMassEntityHandle>—对已聚集的障碍实体去重。Deduplicates gathered obstacle entities.
AgentRVONeighborsTArray<FCapsuleRVOData, TInlineAllocator<16>>—ORCA 的邻居单位列表。内联容量放在数组头旁边以利于密集人群的缓存局部性;某个桶超出内联容量后回落到堆,线程局部持久使这些分配保持热。ORCA neighbour agent list. The inline capacity sits next to the array header for cache locality in dense crowds; once a bucket exceeds it the array falls back to the heap, and thread-local persistence keeps those allocations warm.
CapsuleObstRVONeighborsTArray<FCapsuleRVOData, TInlineAllocator<8>>—ORCA 的胶囊障碍列表。ORCA capsule-obstacle list.
SegmentObstRVONeighborsTArray<FSegmentObstRVOData, TInlineAllocator<8>>—ORCA 的线段障碍列表。ORCA segment-obstacle list.
BoxObstRVONeighborsTArray<FBoxObstRVOData, TInlineAllocator<8>>—ORCA 的盒体障碍列表。ORCA box-obstacle list.
SceneObstRVONeighborsTArray<FSceneObstRVODataFP, TInlineAllocator<8>>—ORCA 的场景障碍列表(由场景射线命中整理)。ORCA scene-obstacle list (built from scene trace hits).
bAnyForceHybridFFObstboolfalse任一聚集到的障碍带 bForceHybridFF 时为真。混合求解器的选择读它:被标记的障碍让单位在本帧继续走力场,而不是一接触就切到 ORCA 求解。每帧重新计算,没有一帧延迟;仅存在于 scratch,不进快照。True when any gathered obstacle carries bForceHybridFF. The hybrid solver pick reads it: a flagged obstacle keeps the agent on the force field this frame instead of switching to the ORCA solver on contact. Recomputed every frame with no one-frame lag; scratch only, never serialized.
WallConstraintsTArray<FWallConstraintFP, TInlineAllocator<32>>—PBD 与 ORCA 共用的墙体约束列表。Wall-constraint list shared by PBD and ORCA.
AgentPBDNeighborsTArray<FAgentPBDData, TInlineAllocator<32>>—PBD 的邻居单位列表;预测位置存放在 FAgentPBDData 上,不另开数组。PBD neighbour agent list; the predicted position lives on FAgentPBDData, so there is no separate prediction array.
CapsuleObstPBDNeighborsTArray<FCapsulePBDData, TInlineAllocator<8>>—PBD 的胶囊障碍列表。PBD capsule-obstacle list.
SegmentObstPBDNeighborsTArray<FSegmentPBDData, TInlineAllocator<8>>—PBD 的线段障碍列表。PBD segment-obstacle list.
BoxObstPBDNeighborsTArray<FBoxObstPBDData, TInlineAllocator<8>>—PBD 的盒体障碍列表。PBD box-obstacle list.
PBD_CA1TArray<FVector, TInlineAllocator<32>>—PBD 单趟解算前预计算一次的最近点(自身 → 邻居单位,C1 组)。Precomputed PBD closest points for agent neighbours, group C1, filled once before the single-pass solve.
PBD_CA2TArray<FVector, TInlineAllocator<32>>—同一组邻居的 C2 最近点:解算中原样复用,C1 被自身位移修正一次。C2 closest points for the same neighbours: reused as-is during the solve, while C1 is adjusted once by the self delta.
PBD_CC1TArray<FVector, TInlineAllocator<8>>—胶囊障碍的最近点,C1 组。Closest points for capsule obstacles, group C1.
PBD_CC2TArray<FVector, TInlineAllocator<8>>—胶囊障碍的最近点,C2 组。Closest points for capsule obstacles, group C2.
PBD_CS1TArray<FVector, TInlineAllocator<8>>—线段障碍的最近点,C1 组。Closest points for segment obstacles, group C1.
PBD_CS2TArray<FVector, TInlineAllocator<8>>—线段障碍的最近点,C2 组。Closest points for segment obstacles, group C2.
ObstaclePlanesTArray<FPlane, TInlineAllocator<8>>—墙面与水平障碍平面——唯一会被真正填充的平面列表。Walls and horizontal obstacles — the only plane list that is ever filled.
GroundPlanesTArray<FPlane, TInlineAllocator<8>>—地面平面(法线朝上)。只声明与清空,从不填充:地面接触由处理器自己的地面射线处理。Ground planes (upward normals). Declared and reset only, never filled: ground contact is handled by the processor's own ground trace.
CeilingPlanesTArray<FPlane, TInlineAllocator<8>>—天花板平面(法线朝下)。同样从不填充。Ceiling planes (downward normals). Never filled either.
SceneHitsTArray<FHitResult>—本帧场景射线的原始命中结果,由 PBD 段直接复用。Raw scene trace hits for this frame; the PBD section reuses them directly.
LocalPatrolEventsTArray<FPatrolData>—本块的巡逻子状态事件。按块手工清空,Reset() 刻意不碰它。Patrol substate events for this chunk. Cleared manually per chunk; Reset() deliberately leaves them alone.
LocalChaseEventsTArray<FChaseData>—本块的追击子状态事件,清空方式同上。Chase substate events for this chunk, cleared the same way.
PatchPathTArray<FVector>—补丁路径的临时缓冲,跨单位复用。Scratch buffer for patch paths, reused across agents.
bAgentNeighborsSortedboolfalse邻居列表本帧是否已排序。Whether the neighbour list has been sorted this frame.
bSolverRangeCappedboolfalse求解器的可达范围是否被刹车距离限制。为真时 ORCA 循环跳过中心距超出该限制的邻居;为假则不作跳过。Whether the solver's reach is capped by braking distance. When true the ORCA loop skips neighbours beyond that centre distance; when false nothing is skipped.
SolverAgentDetectDistfloat0.f刹车距离限制下的求解器可达中心距(世界单位)。Solver reach centre distance under the braking cap (world units).
bSideStepObligationThisFrameboolfalse本帧的侧让义务:真正静止的自身欠至少一个通行者一次让行步进。解算后导出到运动状态,下一帧的反应准入读它——侧让优先于返回,所以即使零延迟也不会在让行中途发起返回。This frame's side-step obligation: a genuinely idle agent owes at least one passer a clearance step. Exported to the movement state after the solve and read by next frame's return admission — side-stepping outranks returning, so even a zero delay cannot start a return mid-yield.
bFlankActiveThisFrameboolfalse本帧是否真的向速度施加了侧翼旋转。Whether a flank rotation was actually applied to the velocity this frame.
bSelfFarReturningboolfalse自身正在返回,且已超过返回优先级的距离阈值(与网格发布同一套二维「到目标距离」)。分类据此把自身排在 rank 3——只低于战斗,高于普通移动。The agent is returning and is beyond the return-priority distance threshold (the same 2D distance-to-goal measure used by the grid publication). Classification then gives the agent rank 3 — below combat only, above ordinary moving.
TrafficEncountersTArray<FTrafficEncounterFP, TInlineAllocator<16>>—交通遭遇缓存,每个邻居槽位一条;由分类在求解前的交通偏置之前填充,只有分类跑过才有效。Traffic encounter cache, one entry per neighbour slot; filled by classification right before the pre-solve traffic biases, and valid only when that ran.
TrafficPathDirFxFFixVector2FFixVector2::Zero()归一化的路径切线。Normalized path tangent.
TrafficPathRightFxFFixVector2FFixVector2::Zero()路径切线的右向,按 (dir.Y, -dir.X) 取得。Right vector of the path tangent, taken as (dir.Y, -dir.X).
TrafficSelfLateralFromPathFxFFix64FFix64::Zero()自身相对路径的横向偏移,取 -(PathRight · SelfToPathVec)。Lateral offset of the agent from the path, taken as -(PathRight · SelfToPathVec).
TrafficGoalForwardAlongPathFxFFix64FFix64::Zero()PathDir · (Goal - Self)。当前只写不读:定点侧的侧翼路径没有目标侧过滤,而浮点版有——两个版本在这一点上不同。PathDir · (Goal - Self). Written but not read: the fixed-point flank path has no goal-side filter while the float version does — the two versions differ here.
TrafficSelfEffRankint320自身的交通等级,是分类的输出,由侧让门控读取。The agent's own traffic rank; a classification output, read by the side-step gate.
bTrafficPathValidboolfalse路径方向是否有效:自身路径方向的平方长度大于小量。Whether the path direction is valid: the squared length of the agent's path direction exceeds a small epsilon.
bSceneTracePerformedboolfalse本帧是否跑过场景射线。只写不读,没有任何消费者;场景命中数组由 PBD 段直接复用,不靠这个标记。Whether a scene trace ran this frame. Write-only with no reader; the PBD section reuses the scene hit array directly instead of consulting this flag.
SupportZfloat-FLT_MAX本帧可站立支撑面的最高世界 Z。按最大值累积,与格子遍历顺序无关,因此不需要额外排序。Highest walkable support surface world Z this frame. Accumulated by maximum, so the result does not depend on cell traversal order and needs no extra sort.
SupportNormalFVector3fFVector3f::UpVector该支撑面的法线。Normal of that support surface.
SupportEntityFEntityHandle—支撑面来源实体,只用于调试与归属。Entity the support surface came from; debug and attribution only.
CeilingZfloatFLT_MAX本帧天花板面的最低世界 Z,按最小值累积。Lowest ceiling surface world Z this frame, accumulated by minimum.
CeilingEntityFEntityHandle—天花板来源实体,只用于调试与归属。Entity the ceiling surface came from; debug and attribution only.

方法Methods

Reset void

把整个 scratch 复位到可复用状态:所有容器清空但保留容量(PBD 的六个最近点数组清空后按 32 / 16 重新预留),标志与计数器回到默认值,交通缓存字段归零,支撑面记录回到 -FLT_MAX、天花板记录回到 FLT_MAX,两个来源实体清空。LocalPatrolEvents 与 LocalChaseEvents 刻意不复位——它们按块手工清空。

Resets the whole scratch to a reusable state: every container is emptied but keeps its capacity (the six PBD closest-point arrays are re-reserved at 32 / 16 after clearing), flags and counters return to defaults, the traffic cache fields are zeroed, the support record returns to -FLT_MAX, the ceiling record to FLT_MAX, and both source entities are cleared. LocalPatrolEvents and LocalChaseEvents are deliberately not reset — they are cleared manually per chunk.

Input

无参数。

No parameters.

Output

无返回值。副作用:清空全部容器并复位标志、计数器、交通缓存与支撑面 / 天花板记录;已分配的容量全部保留。

No return value. Side effects: clears every container and resets flags, counters, the traffic cache and the support / ceiling records; all allocated capacity is kept.

FPendingFlowFieldLoadFP

排队中的流场同步加载请求:目标实体加该流场的软指针。它们由处理器持有的队列收集,每帧在 Execute 开头排空——实体仍然有效时解析软指针并登记到运行期对象表,再把结果写进该实体的导航状态。

A queued synchronous flow-field load request: the target entity plus a soft pointer to the field. Requests are collected in the processor's queue and drained at the head of Execute every frame — if the entity is still active the soft pointer is resolved and registered in the runtime object table, and the result is written into that entity's navigation state.

成员变量Members

名称Name类型Type默认值说明Description
EntityFMassEntityHandle—等待该流场的实体。排空时若实体已不活跃,请求被丢弃。Entity waiting for the field. The request is dropped if the entity is no longer active when it is drained.
SoftFieldTSoftObjectPtr<AFlowField>—该实体的流场软指针。Soft pointer to the field for that entity.

自由函数Free Functions

三个 ORCA 线性规划函数,构成定点求解器的核心:LP1 沿一条约束线求解一维问题,LP2 求解带圆形约束的二维问题并报告第一个失败的约束,LP3 从失败处继续修正。三者都实现在 .cpp 中,头文件只提供声明。

The three ORCA linear-program functions that form the core of the fixed-point solver: LP1 solves a one-dimensional problem along a single constraint line, LP2 solves the two-dimensional problem with the circular constraint and reports the first failing constraint, and LP3 continues from that failure to repair the result. All three are implemented in the .cpp; the header only declares them.

LinearProgram1FP bool

沿第 LineNo 条约束线求解一维线性规划。可行时把解写入 Result 并返回真;该行与圆形约束不相容时返回假,由调用方交给后续步骤处理。

Solves the one-dimensional linear program along constraint line number LineNo. When feasible it writes the solution into Result and returns true; when that line is incompatible with the circular constraint it returns false and leaves the case to the caller.

Input
参数Param类型Type说明Description
Linesconst TArray<FOrcaLineFP, TInlineAllocator<32>>&待求解的约束线列表。Constraint lines to solve against.
LineNoint32本次沿其求解的约束线下标。Index of the constraint line to solve along.
RadiusFFix64圆形约束的半径(避让半径)。Radius of the circular constraint (the avoidance radius).
OptVelocityconst FFixVector2&首选速度。Preferred velocity.
bDirectionOptbool为真时按方向而非速度向量取最优。When true, optimise for direction rather than the velocity vector.
ResultFFixVector2&输出:成功时的解。Output: the solution on success.
Output

返回是否求解成功;成功时 Result 写出该约束下的可行速度。无其它副作用。

Returns whether the solve succeeded; on success Result receives the feasible velocity for that constraint. No other side effects.

LinearProgram2FP int32

求解带圆形约束的二维线性规划:遍历全部约束线,任一条不可行即停止并把该线下标带回。返回值同时编码成功与失败——成功时是约束线的数量,失败时是第一个失败约束的下标。

Solves the two-dimensional linear program with the circular constraint: walks the constraint lines and stops at the first infeasible one, returning its index. The return value encodes both outcomes — the number of constraint lines when successful, the index of the first failing constraint otherwise.

Input
参数Param类型Type说明Description
Linesconst TArray<FOrcaLineFP, TInlineAllocator<32>>&待求解的约束线列表。Constraint lines to solve against.
RadiusFFix64圆形约束的半径。Radius of the circular constraint.
OptVelocityconst FFixVector2&首选速度。Preferred velocity.
bDirectionOptbool为真时按方向而非速度向量取最优。When true, optimise for direction rather than the velocity vector.
ResultFFixVector2&输出:可行时的解。Output: the solution when feasible.
Output

成功返回约束线数量,失败返回第一个失败约束的下标;可行时 Result 接收解。无其它副作用。

Returns the number of constraint lines on success, or the index of the first failing constraint on failure; Result receives the solution when feasible. No other side effects.

LinearProgram3FP void

处理 LP2 留下的失败约束:从 BeginLine 开始对剩余约束逐条修正,把可能的解推向可行区域。NumObstLines 划定障碍约束与邻居约束的边界,修正时只针对邻居约束。

Handles the failure left by LP2: starting at BeginLine, it repairs the remaining constraints one by one and pushes the candidate solution toward the feasible region. NumObstLines marks the boundary between obstacle constraints and neighbour constraints, so only the latter are repaired.

Input
参数Param类型Type说明Description
Linesconst TArray<FOrcaLineFP, TInlineAllocator<32>>&约束线列表。Constraint line list.
NumObstLinesint32前多少条线是障碍约束。How many leading lines are obstacle constraints.
BeginLineint32从哪条线开始修正(通常是 LP2 报告失败的那条)。Line index to start repairing from (usually the one LP2 reported as failing).
RadiusFFix64圆形约束的半径。Radius of the circular constraint.
ResultFFixVector2&输入输出:候选解,被就地修正。Input and output: the candidate solution, repaired in place.
Output

无返回值。副作用:就地修正 Result,使其满足从 BeginLine 起的邻居约束。

No return value. Side effect: repairs Result in place so it satisfies the neighbour constraints from BeginLine onward.

公开静态函数Public Static Functions

十四个公开静态函数,分三族:导航辅助、椭圆与避障几何、车辆物理。它们不读处理器实例状态,参数与返回值即全部输入输出,因此也可以在处理器之外直接调用。

Fourteen public static functions in three families: navigation helpers, ellipse and avoidance geometry, and vehicle physics. None of them reads processor instance state — parameters and return value are their entire interface — so they can also be called from outside the processor.

ProjectPointDownToNavmesh static bool

把一个世界坐标点沿竖直方向投影到导航网格上:向下射线最多走 VerticalSearchDist(默认 500 厘米),在给定碰撞通道上命中导航面即算成功,落点由 OutNavLocation 带回。

Projects a world point down onto the navigation mesh: the downward trace travels at most VerticalSearchDist (500 cm by default) and counts as a hit when it meets a nav surface on the given collision channel, with the landing point returned through OutNavLocation.

Input
参数Param类型Type说明Description
WorldUWorld*提供导航系统与射线的世界。World providing the navigation system and the trace.
InPointconst FVector&待投影的世界坐标。World point to project.
TraceChannelECollisionChannel向下射线使用的碰撞通道。Collision channel for the downward trace.
OutNavLocationFVector&输出:命中的导航面位置。Output: the nav surface position that was hit.
VerticalSearchDistfloat = 500.f向下搜索的最大距离(厘米),默认 500。Maximum downward search distance in centimetres; 500 by default.
Output

返回是否投影成功;成功时 OutNavLocation 接收落点,失败时不产生有效落点。

Returns whether the projection succeeded; on success OutNavLocation receives the landing point, and on failure no valid landing point is produced.

QueryFlowFieldNav static FFlowFieldNavResult

在指定流场上为自身查询导航结果:输入自身的碰撞体几何(胶囊半高、半径、中心到地面偏移)、移动与运动配置、导航配置,以及一块流场查询用的临时缓冲,返回结构化的查询结果。LayerHandle 可省略,缺省为空句柄,表示不指定流场层。

Queries the given flow field for the agent's navigation result: inputs are the agent's collider geometry (capsule half height, radius, capsule-centre-to-ground offset), its move and moving state, its navigation settings, and a scratch buffer for the query; the result comes back as a structured value. LayerHandle may be omitted and defaults to an empty handle, meaning no specific flow-field layer.

Input
参数Param类型Type说明Description
FlowFieldAFlowField*查询所用的流场。Flow field to query.
SelfLocationconst FVector&自身的世界位置。The agent's world location.
ColliderUpconst FVector&碰撞体的上方向。Up direction of the collider.
SelfShaftHalfHeightfloat自身胶囊的半高。Half height of the agent's capsule.
SelfRadiusfloat自身的半径。The agent's radius.
CapsuleCenterToGroundOffsetfloat胶囊中心到地面的偏移。Offset from the capsule centre to the ground.
Colliderconst FCollider&碰撞体配置。Collider configuration.
Moveconst FMove&移动配置。Move configuration.
Movingconst FMoving&当前运动状态(只读)。Current movement state (read only).
Navigationconst FNavigation&导航配置。Navigation configuration.
ScratchCtxFFlowfieldScratchContext&流场查询的工作缓冲。Working buffer for the flow-field query.
LayerHandleconst FFlowFieldLayerHandle& = FFlowFieldLayerHandle()流场层句柄;缺省为空句柄。Flow-field layer handle; defaults to an empty handle.
Output

返回 FFlowFieldNavResult,即流场查询的结果;无返回值以外的副作用,ScratchCtx 以引用传入,查询期间用作工作缓冲。

Returns FFlowFieldNavResult, the flow-field query result; no side effects beyond that, with ScratchCtx passed by reference as a working buffer during the query.

TryFlyingFallbackOutsideField static bool

单位位于流场之外时的飞行兜底:只有 bCanFly 为真才可能接管;接管时改写运动状态,并把选定的导航模式与方向写到两个输出参数里。

The flying fallback for an agent that is outside its flow field: it can only take over when bCanFly is true; when it does, it rewrites the movement state and writes the chosen nav mode and direction into the two output parameters.

Input
参数Param类型Type说明Description
FlowFieldAFlowField*相关流场。The flow field in question.
SelfLocationconst FVector&自身的世界位置。The agent's world location.
bCanFlybool该单位是否允许飞行兜底。Whether this agent may use the flying fallback.
MovingFMoving&运动状态,接管时被改写。Movement state, rewritten when the fallback takes over.
OutNavModeENavMode&输出:选定的导航模式。Output: the chosen nav mode.
OutDirectionFVector&输出:选定的飞行方向。Output: the chosen flight direction.
Output

返回是否由飞行兜底接管;接管时写 Moving、OutNavMode 与 OutDirection。

Returns whether the flying fallback took over; when it does, it writes Moving, OutNavMode and OutDirection.

ApplyFlowFieldReactionTime static FVector

给流场给出的方向施加反应时间:同一批采样格子(由哈希标识)与导航配置、自身的导航状态和确定性状态一起,决定这一帧实际采用的方向。返回处理后的方向。

Applies reaction time to the direction the flow field produced: the same batch of sampled cells (identified by the hash), the navigation settings, the agent's navigating state and its determinism state together decide the direction actually used this frame. Returns the processed direction.

Input
参数Param类型Type说明Description
TargetDirconst FVector&流场给出的目标方向。Target direction produced by the flow field.
SampledCellsHashuint32采样格子的哈希,使同批格子的反应时间一致。Hash of the sampled cells so that the same batch shares the same reaction time.
Navigationconst FNavigation&导航配置。Navigation configuration.
NavigatingFNavigating&导航运行期状态,反应计时会被推进。Runtime navigation state; the reaction clock is advanced.
DetFDeterminism&确定性状态(可写)。Determinism state (writable).
DeltaTimefloat本帧时间步长(秒)。Frame time step in seconds.
Output

返回施加反应时间后的方向;副作用:推进 FNavigating 的反应计时,并可能写入 FDeterminism。

Returns the direction after reaction time is applied; side effects: advances the reaction clock in FNavigating and may write to FDeterminism.

EllipseRadiusAtAngleFP static FFix64

求椭圆在某个来向上的半径:给定两条半轴、长轴方向与接近方向,返回该方向的椭圆半径。它是把「方向性避障半径」折成一个沿来向的标量的入口,全程定点运算。

Returns the ellipse radius along a given approach direction: given the two semi-axes, the major-axis direction and the approach direction, it returns the radius in that direction. This is the entry that reduces a directional avoidance radius to a single scalar along the approach, entirely in fixed point.

Input
参数Param类型Type说明Description
aFFix64半长轴。Semi-major axis.
bFFix64半短轴。Semi-minor axis.
majorDirconst FFixVector2&长轴方向。Major-axis direction.
approachDirconst FFixVector2&接近方向(来向)。Approach direction.
Output

返回该来向上的椭圆半径(FFix64),无副作用。

Returns the ellipse radius along that approach direction (FFix64); no side effects.

SelectFrictionForwardFFix static FFixVector2

按移动模型挑选用于前向 / 摩擦计算的方向向量:输入移动模型、2D 朝向、期望速度与解算器速度,返回选中的方向。不同移动模型对「前」的定义不同,这个函数把选择集中在一处,避免每个调用点各自判断。

Picks the direction vector used for forward and friction calculations according to the movement model: it takes the model, the 2D heading, the desired velocity and the solver velocity and returns the chosen direction. Movement models differ in what "forward" means, and this function centralises that choice instead of leaving each call site to decide.

Input
参数Param类型Type说明Description
MovementModelEMovementModel当前移动模型。Current movement model.
Heading2Dconst FFixVector2&2D 朝向。2D heading.
DesiredVel2Dconst FFixVector2&期望速度(2D)。Desired velocity (2D).
SolverVel2DFxconst FFixVector2&解算器给出的速度(2D,定点)。Velocity produced by the solver (2D, fixed-point).
Output

返回选中的方向向量(FFixVector2),无副作用。

Returns the selected direction vector (FFixVector2); no side effects.

Rotate2DFix static FFixVector2

把二维向量绕原点旋转给定角度(度),返回旋转后的向量。角度以度为单位,结果用定点类型承载,便于与其它定点量逐位一致地比较。

Rotates a 2D vector about the origin by the given angle in degrees and returns the rotated vector. The angle is in degrees and the result is fixed-point, so it compares bit-identically with the other fixed-point quantities.

Input
参数Param类型Type说明Description
Vconst FFixVector2&待旋转的二维向量。2D vector to rotate.
DegreesFFix64旋转角度(度)。Rotation angle in degrees.
Output

返回旋转后的向量(FFixVector2),无副作用。

Returns the rotated vector (FFixVector2); no side effects.

ComputeEllipseFromMult static FEllipseParamsFP

由基础半径与逐轴避障倍率换算出两条半轴,并结合上方向给出长轴方向,返回一份椭圆参数。用于把作者配置的「避障距离倍率」变成解算器直接可用的椭圆。

Converts a base radius plus per-axis avoidance multipliers into the two semi-axes, and derives the major-axis direction from the up vector, returning the ellipse parameters. It turns the authored avoidance-distance multipliers into an ellipse the solver can use directly.

Input
参数Param类型Type说明Description
BaseRadiusfloat基础避障半径。Base avoidance radius.
AvoidDistMultconst FVector2f&逐轴(2D)的避障距离倍率。Per-axis (2D) avoidance distance multipliers.
UpVectorconst FVector3f&单位 / 碰撞体的上方向,用于确定椭圆的水平朝向。Up direction of the unit or collider, used to orient the ellipse horizontally.
Output

返回 FEllipseParamsFP(半长轴、半短轴与长轴方向),无副作用。

Returns FEllipseParamsFP (semi-major, semi-minor and major direction); no side effects.

ComputeEllipseFromNeighbor static FEllipseParamsFP

由邻居的避障半径(逐轴 2D 值)与上方向构建同一套椭圆参数,让解算器把邻居也当作椭圆处理,而不是当作圆。

Builds the same ellipse parameters from a neighbour's avoidance radius (per-axis 2D values) and up direction, so the solver treats neighbours as ellipses rather than circles.

Input
参数Param类型Type说明Description
AvoidRadiusconst FVector2f&邻居的逐轴避障半径。The neighbour's per-axis avoidance radius.
UpVectorconst FVector3f&邻居碰撞体的上方向。Up direction of the neighbour's collider.
Output

返回 FEllipseParamsFP,无副作用。

Returns FEllipseParamsFP; no side effects.

ComputeForecastDriveSpeeds static FForecastDriveSpeedsFP

由基础移动速度与倒车速度比算出前进 / 倒车两档预测驱动速度,供对齐到路径与对齐到移动方向时判断该向前追还是倒回去。

Computes the forward and reverse forecast drive speeds from the base move speed and the reverse speed ratio, so path alignment and movement alignment can decide whether to drive forward or reverse.

Input
参数Param类型Type说明Description
BaseMoveSpeedfloat基础移动速度。Base move speed.
ReverseSpeedRatiofloat倒车速度相对基础速度的比例。Reverse speed as a ratio of the base speed.
Output

返回 FForecastDriveSpeedsFP:前进与倒车两档预测速度都是定点标量;无副作用。

Returns FForecastDriveSpeedsFP: both the forward and reverse forecast speeds are fixed-point scalars; no side effects.

ComputeCapsuleCenterToGroundOffset static float

由胶囊半高、半径与碰撞体上方向算出「胶囊中心到地面」的偏移量。算出的值随后作为 CapsuleCenterToGroundOffset 传给流场导航查询。

Computes the offset from the capsule centre to the ground from the capsule's half height, radius and up direction. The result is then passed to the flow-field navigation query as CapsuleCenterToGroundOffset.

Input
参数Param类型Type说明Description
ShaftHalfHeightfloat胶囊半高。Capsule half height.
Radiusfloat胶囊半径。Capsule radius.
ColliderUpconst FVector3f&碰撞体的上方向。Up direction of the collider.
Output

返回偏移量(世界单位);无副作用。

Returns the offset in world units; no side effects.

ApplyCMCVelocity static void

按加速度与减速度上限、以给定时间步长把当前速度推向目标速度;当前速度以引用传入,就地更新。

Pushes the current velocity toward the target velocity over the given time step, bounded by separate acceleration and deceleration limits; the current velocity is passed by reference and updated in place.

Input
参数Param类型Type说明Description
CurrentVelFVector&当前速度,就地更新。Current velocity, updated in place.
TargetVelconst FVector&目标速度。Target velocity.
Accelfloat加速度上限。Acceleration limit.
Decelfloat减速度上限。Deceleration limit.
DTfloat时间步长(秒)。Time step in seconds.
Output

无返回值。副作用:就地改写 CurrentVel。

No return value. Side effect: rewrites CurrentVel in place.

ComputeVehicleDriveDirection static FVector

计算轮式转向的驱动方向:输入车体前向、期望的 2D 方向、最大转向角与转向速率、时间步长与当前前向速度,并把更新后的转向角写回 InOutSteeringAngleDeg。调用点只在最大转向角大于小量时才走这条路径,否则直接用前向方向。

Computes the drive direction for wheel steering: inputs are the body forward, the desired 2D direction, the maximum steering angle and steering rate, the time step and the current forward speed, and the updated steering angle is written back through InOutSteeringAngleDeg. The call site only takes this path when the maximum steering angle exceeds a small epsilon; otherwise it uses the forward direction directly.

Input
参数Param类型Type说明Description
ForwardDirectionconst FVector&车体前向。Body forward direction.
DesiredDir2Dconst FVector&期望的 2D 行驶方向。Desired 2D driving direction.
MaxSteeringAngleDegfloat最大转向角(度)。Maximum steering angle in degrees.
SteeringRateDegPerSecfloat转向速率(度/秒)。Steering rate in degrees per second.
DeltaTimefloat时间步长(秒)。Time step in seconds.
CurrentForwardSpeedfloat当前前向速度。Current forward speed.
InOutSteeringAngleDegfloat&输入输出:当前转向角(度),被更新后写回。Input and output: the current steering angle in degrees, updated and written back.
Output

返回驱动方向(FVector);副作用:就地更新 InOutSteeringAngleDeg。

Returns the drive direction (FVector); side effect: updates InOutSteeringAngleDeg in place.

ApplyVehiclePhysicsTail static FVector

车辆物理的收尾一步:接收目标前向速度(引用)、驱动方向、当前 2D 速度与移动 / 运动状态,产出本帧最终速度。调用点直接把它的返回值当作单位速度使用,并允许它在内部修正目标前向速度。

The final step of vehicle physics: it takes the target forward speed (by reference), the drive direction, the current 2D velocity and the move / moving state, and produces this frame's final velocity. The call site uses its return value directly as the agent's velocity and lets it adjust the target forward speed internally.

Input
参数Param类型Type说明Description
TargetForwardSpeedfloat&目标前向速度(引用,可在内部被修正)。Target forward speed (by reference; may be adjusted inside).
DriveDirectionconst FVector&驱动方向。Drive direction.
CurrentVelocity2Dconst FVector&当前 2D 速度。Current 2D velocity.
Moveconst FMove&移动配置。Move configuration.
Movingconst FMoving&当前运动状态。Current movement state.
DeltaTimefloat时间步长(秒)。Time step in seconds.
SelfLocationconst FVector&自身的世界位置。The agent's world location.
Output

返回本帧最终速度(FVector);TargetForwardSpeed 以引用传入,可能被就地修正。

Returns this frame's final velocity (FVector); TargetForwardSpeed is passed by reference and may be adjusted in place.

处理器方法Processor Methods

UMassBattleAgentMoveProcessorFP UMassBattleAgentMoveProcessorFP()

构造函数只配置执行方式:关闭随 processing phase 的自动注册、声明必须跑在游戏线程、把执行域设为 Standalone / Server / Client。因此本处理器不随 processing phase 自动注册,Execute 自己用子系统的子帧状态判断本帧是否要跑。

The constructor only configures how the processor runs: it turns off auto-registration with processing phases, declares that it must execute on the game thread, and sets the execution domain to Standalone / Server / Client. As a result the processor is not auto-registered with processing phases, and Execute itself consults the subsystem's sub-frame state to decide whether to run this frame.

Input

无参数。

No parameters.

Output

无返回值。副作用:写入三个执行属性(bAutoRegisterWithProcessingPhases = false、bRequiresGameThreadExecution = true、ExecutionFlags = Standalone | Server | Client)。

No return value. Side effects: sets three execution properties (bAutoRegisterWithProcessingPhases = false, bRequiresGameThreadExecution = true, ExecutionFlags = Standalone | Server | Client).

ConfigureQueries virtual void

初始化实体查询并向本处理器注册。约束分三组:第一组 All 覆盖只读片段——FAgentTag 加缩放、碰撞体、物理、追踪、防御、巡逻、追击、增援、移动、返回、攻击、攻击状态、瞄准、瞄准状态、死亡、死亡状态、事件、调试、控制器、避障、行为、队伍、风格选择器、交通共享与动画共享共 25 项;第二组 All 覆盖读写片段——定位、旋转、Debuff、导航、导航状态、追踪状态、避障状态、运动、返回状态、追击状态、统计、确定性、实体标志与动画状态共 14 项;另加一个可选的 FNotifyShared。

Initialises the entity query and registers it with this processor. The requirements come in three groups: the first All covers read-only fragments — FAgentTag plus scaling, collider, physics, trace, defence, patrol, chase, reinforce, move, return, attack, attacking, aim, aiming, death, dying, events, debug, controller, avoidance, behavior, team, style selector, traffic shared and animation shared, 25 in total; the second All covers writable fragments — locating, rotating, debuff, navigation, navigating, tracing, avoiding, moving, returning, chasing, statistics, determinism, entity flag and animating, 14 in total; plus one optional FNotifyShared.

Input
参数Param类型Type说明Description
EntityManagerconst TSharedRef<FMassEntityManager>&实体管理器,查询在其中初始化。Entity manager in which the query is initialised.
Output

无返回值。副作用:EntityQuery 被初始化并挂到本处理器上。

No return value. Side effect: EntityQuery is initialised and registered on this processor.

Execute virtual void

每逻辑帧的移动阶段入口,带一串前置门禁:战斗子系统必须可解析、定点开关 bUseFixPointMath 必须开启、Subtick1 与 Subtick2 至少一个被调度。过关后排空异步流场加载队列,再按确定性开关决定发射力是合并排序后应用还是由生产者直接写入;随后以带并行开关的实体遍历进入移动与物理解算。定点模式下物理子步数被压回 1,所以内联的 PBD 解算始终参与。

The movement-stage entry for each logic frame, behind a chain of gates: the battle subsystem must resolve, the fixed-point switch bUseFixPointMath must be on, and at least one of Subtick1 / Subtick2 must be scheduled. Past the gates it drains the async flow-field load queue, then lets the determinism switch decide whether launch forces are merged and sorted before being applied or written directly by their producers; afterwards the entity pass, behind a parallel toggle, enters movement and physics solving. In fixed-point mode the physics substep count is clamped back to 1, so the inline PBD solve always participates.

Input
参数Param类型Type说明Description
EntityManagerFMassEntityManager&本帧的实体管理器。Entity manager for this frame.
ContextFMassExecutionContext&本帧执行上下文,实体遍历需要。Execution context for this frame, required by the entity pass.
Output

无返回值。副作用:排空 PendingFlowFieldLoads 并写入 FNavigating::FlowFieldToUse_Previous / FlowFieldToUsePtr;确定性模式下合并、排序并把发射力累加进 FMoving::LaunchVelSum;实体遍历改写定位、旋转、运动、避障状态等读写片段。

No return value. Side effects: drains PendingFlowFieldLoads into FNavigating::FlowFieldToUse_Previous / FlowFieldToUsePtr; in deterministic mode merges, sorts and accumulates launch forces into FMoving::LaunchVelSum; the entity pass rewrites the writable fragments such as locating, rotating, moving and avoiding.

常量Constants

处理器缓存的实体标志枚举值:全部是 static constexpr EEntityFlags,直接取 EBattleFlags 的对应项,用于 HasFlag / SetFlag / ClearFlag 的快速比较,避免每次调用都做枚举转换。编译期常量,不是可配置项。

Entity-flag enum values cached on the processor: all are static constexpr EEntityFlags taken directly from the matching EBattleFlags entry, used for fast HasFlag / SetFlag / ClearFlag comparisons so no enum conversion happens per call. Compile-time constants, not settings.

名称Name值Value说明Description
FallingFlagEBattleFlags::Falling下落标志的缓存值。Cached value of the falling flag.
JumpingFlagEBattleFlags::Jumping跳跃标志的缓存值。主动起跳在冲量当帧就被视为离地:土狼时间用于让单位从边缘恢复,而跳跃明确宣告离开地面,所以动画的跳跃状态机不等下降标志出现。Cached value of the jumping flag. A deliberate jump is airborne from the impulse tick: coyote time exists to let an agent recover a ledge, while a jump explicitly declares that the ground is being left, so the animation jump machine does not wait for the falling flag.
LaunchingFlagEBattleFlags::Launching击飞标志的缓存值。Cached value of the launching flag.
BeingHitFlagEBattleFlags::BeingHit受击标志的缓存值;受击与推挤是休眠节流的唤醒源。Cached value of the being-hit flag; hit and push are the wake sources of the dormancy throttle.
BeingPushedFlagEBattleFlags::BeingPushed被推挤标志的缓存值;同为休眠唤醒源。Cached value of the being-pushed flag; also a dormancy wake source.
DyingFlagEBattleFlags::Dying死亡中标志的缓存值。Cached value of the dying flag.
AppearingFlagEBattleFlags::Appearing出场中标志的缓存值。Cached value of the appearing flag.
SleepingFlagEBattleFlags::Sleeping休眠标志的缓存值。Cached value of the sleeping flag.
PatrollingFlagEBattleFlags::Patrolling巡逻标志的缓存值。Cached value of the patrolling flag.
AttackingFlagEBattleFlags::Attacking攻击中标志的缓存值。Cached value of the attacking flag.
ChasingFlagEBattleFlags::Chasing追击中标志的缓存值。Cached value of the chasing flag.
ReturningFlagEBattleFlags::Returning返回中标志的缓存值。Cached value of the returning flag.
ReinforcingFlagEBattleFlags::Reinforcing增援中标志的缓存值。Cached value of the reinforcing flag.
PlayerDrivenFlagEBattleFlags::PlayerDriven玩家驱动标志的缓存值。Cached value of the player-driven flag.
AStarMovingToFlagEBattleFlags::AStarMovingToA* 寻路移动中标志的缓存值。Cached value of the A* moving-to flag.
PendingDestroyFlagEBattleFlags::PendingDestroy待销毁标志的缓存值。Cached value of the pending-destroy flag.
ActivatedFlagEBattleFlags::Activated已激活标志的缓存值。Cached value of the activated flag.
SelectedFlagEBattleFlags::Selected被选中标志的缓存值。Cached value of the selected flag.
BeingSelectFlagEBattleFlags::BeingSelect选择框正在覆盖标志的缓存值。Cached value of the being-select flag.

成员变量Members

公开成员只有两项:实体查询与流场加载队列。上面那张常量表里的标志缓存也是类成员,但它们是编译期常量,不参与运行期状态。

Only two public members exist: the entity query and the flow-field load queue. The flag caches in the constants table above are class members too, but they are compile-time constants and carry no runtime state.

名称Name类型Type默认值说明Description
EntityQueryFMassEntityQuery—由 ConfigureQueries 初始化的实体查询,Execute 用它决定哪些单位进入移动解算。Entity query initialised by ConfigureQueries; Execute uses it to decide which agents enter the movement solve.
PendingFlowFieldLoadsTQueue<FPendingFlowFieldLoadFP, EQueueMode::Mpsc>—待处理的流场加载请求队列,多生产者单消费者。Execute 开头逐个排空:实体仍有效时解析软指针并登记到运行期对象表,再写入该实体的 FNavigating。Queue of pending flow-field load requests, multi-producer single-consumer. Drained one by one at the head of Execute: if the entity is still active, the soft pointer is resolved, registered in the runtime object table, and written into that entity's FNavigating.

私有方法Private Methods

三个私有助手,只在处理器内部使用,不构成对外接口;它们负责把解算前的准备工作与两个避障求解器分开。

Three private helpers used only inside the processor and not part of its interface; they separate the pre-solve preparation from the two avoidance solvers.

名称Name类型Type说明Description
PrecomputeWallConstraintsvoid由自身位置与半径预计算墙体约束,结果写进本次处理的 scratch。Precomputes wall constraints from the agent's position and radius into the current scratch context.
ComputeRVO2AvoidingVelocityFPvoid (19 个参数params)ORCA 求解入口:输入 Mass API 子系统、避障状态、时间步长、scratch、自身椭圆 / 半径 / 质量、路径方向与目标相对位置,以及一组开关(移动、返回、抑制侧让、攻击者、避障障碍、交通规则、是否带路径折线),结果写入 FAvoiding。ORCA solve entry: takes the Mass API subsystem, the avoidance state, the time step, the scratch context, the agent's ellipse / radius / mass, the path direction and goal-relative position, plus switches (moving, returning, side-step suppression, attacker, avoiding an obstacle, traffic rules, has-path-polyline); writes the result into FAvoiding.
ComputeForceFieldAvoidingVelocityFPvoid (21 个参数params)力场求解入口,参数与 ORCA 版同构,另加力场强度、分离速度上限比例与速度阻尼;结果同样写入 FAvoiding。Force-field solve entry with the same parameter shape as the ORCA version plus force strength, the separation speed cap fraction and velocity damping; the result is likewise written into FAvoiding.

管线角色Pipeline Role

调度:执行域覆盖 Standalone / Server / Client,并要求游戏线程;构造时关闭了随 processing phase 的自动注册。每个逻辑帧先过定点开关——bUseFixPointMath 关闭时立即返回,移动阶段由浮点版承担;开启时再看子帧状态,Subtick1 与 Subtick2 恰好一个被调度则只处理本帧对应分区,两个都被调度则一次跑完全部单位(按 UniqueID 取模分区)。移动阶段排在行为与抛射之后、宿主操作之前,因为之后的挂载解析要读本帧最终的父级变换。

Scheduling: the execution domain covers Standalone / Server / Client and requires the game thread; auto-registration with processing phases is off. Each logic frame first checks the fixed-point switch — with bUseFixPointMath off it returns immediately and the movement stage belongs to the float twin; with it on it checks the sub-frame state, running only the partition for this frame when exactly one of Subtick1 / Subtick2 is scheduled, or the whole population when both are (partitioned by UniqueID modulo). The movement stage sits after behavior and projectiles and before host operations, because the later mount resolve must read this frame's final parent transforms.

帧内流程:排空流场加载队列 → 确定性模式下合并、按力大小与施害者 ID 排序再把发射力累加进运动状态 → 以带并行开关的实体遍历读取只读片段、写入读写片段,并在其中完成期望速度、寻路、RVO / PBD 解算与位置积分;数值路径为 FFix64 / FFixVector2 / FFixVector3,包括角度换算与映射曲线都走定点实现。流场导航查询与飞行兜底分别由 QueryFlowFieldNav 与 TryFlyingFallbackOutsideField 提供,ORCA 的二维线列表结构就是本页的 FOrcaLineFP。

Within a frame: drain the flow-field load queue → in deterministic mode merge, sort by force magnitude and instigator ID, then accumulate launch forces into the movement state → the entity pass behind a parallel toggle reads the read-only fragments, writes the writable ones, and performs desired-velocity resolution, pathfinding, the RVO / PBD solve and position integration; the numeric path is FFix64 / FFixVector2 / FFixVector3, including angle conversion and the speed-mapping curve in fixed point. Flow-field navigation queries and the flying fallback come from QueryFlowFieldNav and TryFlyingFallbackOutsideField, and the ORCA 2D line list uses this page's FOrcaLineFP.

补充说明Notes

① 定点与确定性是两个独立开关:四种组合都成立——(关, 关) 单机浮点、(开, 关) 同平台确定性重放、(关, 开) 定点数学试验、(开, 开) 跨平台确定性。本处理器只在定点开关开启时运行;确定性开关只决定排序与随机次序。
② 物理子步被压回 1:定点模式下子系统把物理子步数限制为 1,所以「独立物理处理器接管碰撞」的旁路在本处理器上实际不会开启,内联的 PBD 解算始终承担碰撞。
③ scratch 是线程局部的:FAgentMoveScratchContextFP 体积远超 fragment,按单位复用、不进快照;Reset() 清空容器但保留容量,而巡逻 / 追击子状态事件按块手工清空,不在 Reset() 里复位。

① Fixed point and determinism are separate switches: all four combinations are valid — (off, off) single-player float, (on, off) same-platform deterministic replay, (off, on) a fixed-point math test, (on, on) cross-platform determinism. This processor runs only with the fixed-point switch on; the determinism switch decides only ordering and random sequence.
② Physics substeps are clamped to 1: in fixed-point mode the subsystem limits the physics substep count to 1, so the bypass where a standalone physics processor owns collision never opens on this processor and the inline PBD solve always handles collision.
③ The scratch is thread-local: FAgentMoveScratchContextFP is far larger than a fragment, so it is reused per agent and never serialized; Reset() empties containers but keeps capacity, while the patrol / chase substate events are cleared manually per chunk and are not reset there.

④ 部分字段当前只写不读:TrafficGoalForwardAlongPathFx 被写入但没有消费者——定点侧的侧翼路径没有目标侧过滤,浮点版有;bSceneTracePerformed 同样只写不读。另有两处列表只声明不填充:GroundPlanes 与 CeilingPlanes 从不填充,只有 ObstaclePlanes 会真正收集墙面与水平障碍;地面接触由处理器自己的地面射线处理。
⑤ 哨兵约定:FTrafficEncounterFP 的两个方向点积以 2.0 表示无效(单位方向点积不可能达到 2),让行份额以 [0,1] 为界。

④ Some fields are currently written but never read: TrafficGoalForwardAlongPathFx is written with no consumer — the fixed-point flank path has no goal-side filter while the float version does; bSceneTracePerformed is likewise write-only. Two lists are declared but never filled: GroundPlanes and CeilingPlanes stay empty, and only ObstaclePlanes collects walls and horizontal obstacles; ground contact is handled by the processor's own ground trace.
⑤ Sentinel conventions: the two direction dots in FTrafficEncounterFP use 2.0 for invalid (a dot of unit directions cannot reach 2), and the yield share is bounded by [0,1].