MassBattleTrafficConstants.h
Source/MassBattle/Public/Processors/MassBattleTrafficConstants.h
概述Overview
浮点与定点两条移动处理器共用的交通规则结构阈值。两条实现必须用同一套阈值判定遭遇类型,否则同一场遭遇会在两条路径上得到不同分类;手抄常量是最容易漂移的做法,所以五个阈值集中放在这里,由两边共同读取。它们是编译期常量,不是 ini 配置项——改的是分类契约本身,不是某次运行的调参。
The structural traffic-rule thresholds shared by the float and the fixed-point move processors. Both implementations must classify an encounter with the same thresholds, otherwise the same encounter gets different classifications on the two paths; hand-copied constants are the easiest way to make them drift, so the five thresholds live here and both sides read them. They are compile-time constants, not ini settings — changing one changes the classification contract itself, not a single run's tuning.
常量Constants
命名空间内全部为 constexpr float,无运行时可写状态,插件自动读取,无需配置。
Everything in the namespace is a constexpr float; there is no writable runtime state, the plugin reads them automatically and there is nothing to configure.
| 名称Name | 值Value | 说明Description |
|---|---|---|
HeadOnConeDot | -0.7f | 对头锥的点积阈值(约 135° 夹角)。两端朝向满足该阈值时判为对头遭遇。Dot threshold for the head-on cone (≈135° apart). Facing directions meeting this threshold classify as a head-on encounter. |
CrossingSameDirDot | 0.7071f | 交叉带的上缘(cos45°,供 CrossShift 使用):点积 ≥ 该值即为同向带(Flank / SameLane)。Upper edge of the crossing band (cos45°, used by CrossShift): a dot at or above this value is the same-direction band (Flank / SameLane). |
ApproachConeDot | -0.7f | 来袭锥的点积阈值——用于把「迎面接近」与其它方向关系区分开。Dot threshold for the approach cone — separates "closing head-on" from the other directional relations. |
BreakthroughSpeedEps | 0.15f | 塌缩判定:移动结果低于最大速度的 15%、而意图速度超过它时,视为塌缩(意图没有转化为实际位移)。Collapse test: when the resulting speed is below 15% of max speed while the intended speed exceeds it, the move is treated as collapsed (intent did not turn into displacement). |
BreakthroughMassRatio | 4.f | 突破判定:自身质量须达到已聚集邻居中最重者的 4 倍,才可能推开对方继续前进。Breakthrough test: the unit's mass must be 4× the heaviest gathered neighbour before it can push through and keep advancing. |
管线角色Pipeline Role
两条移动处理器在解算单位间移动时读取这些阈值,把每对靠近的单位归类为对头 / 交叉 / 同向 / 来袭 / 可突破等情形,再据此决定减速、让行或推开。插件自动使用,无需调度或配置;除非同时修改两条处理器,否则不要假设两侧阈值可以不同。
Both move processors read these thresholds while resolving unit-to-unit movement, classifying each approaching pair as head-on / crossing / same-direction / approach / breakthrough-capable, and then deciding to slow down, yield or push through. The plugin uses them automatically with no scheduling or configuration; unless both processors are changed together, never assume the two sides may carry different thresholds.
补充说明Notes
① 共享是纪律,不是巧合:这五个值只应在此处存在一份。把数值复制进某一个处理器,会让两条路径在边界情形上分叉,于是同一场遭遇在浮点侧与定点侧得到不同分类——而它们本应逐项一致。
② 编译期常量:没有 ini / DataAsset 开关,改阈值等于改所有关卡的交通行为并需要重新编译;不要把它们当作运行时可调参数。
③ 边界语义:CrossingSameDirDot 是包含式上缘(点积 ≥ 该值即同向带);其余阈值是分类判定边界,改动任一个都会同时改变两条路径对边界输入的归类。
① Sharing is discipline, not coincidence: each of the five values should exist once, here. Copying a value into one processor forks the two paths at the boundary cases, so the same encounter is classified differently on the float and fixed-point sides — while they are supposed to agree item by item.
② Compile-time constants: there is no ini or DataAsset switch; changing a threshold changes traffic behaviour in every level and requires a rebuild. Do not treat them as runtime-tunable parameters.
③ Boundary semantics: CrossingSameDirDot is an inclusive upper edge (a dot at or above it is the same-direction band); the other thresholds are classification boundaries, and changing any of them reclassifies boundary inputs on both paths at once.