feat(ground-ai): add the trigger decision channel

Estimate hit probability and request movement speed from the weapon solution.
Use visible aim samples, stock shell penetration, and separate burst paths.
This commit is contained in:
N0VAN0M4LY committed 2026-12-06 01:11:55 +08:00
1 parent 1590a2fea9
commit 4e658cae9c
20 files changed
+693 -113

No files matched your search

@@ -555,7 +555,7 @@
"estimation": "Sample-based velocity lead, exit watch and natural shot spread",
"threat": "How dangerous each discovered enemy is: distance, aim, line of sight and recent hits",
"turret": "Where the turret looks without a target: threats, cues and scanning along the route",
"fireControl": "Range bands, speed gates, barrel settle and ballistic safety",
"fireControl": "Hit probability and fire threshold, autocannon bursts, secondary weapons, barrel settle and ballistic safety",
"navigation": "Drive backend, pivot turns and tactical reverse",
"navEngine": "Baked map navigation packs, their fallback, and path costs per surface for tracked and wheeled vehicles",
"pathFollow": "Replanning, lookahead steering, corner and arrival braking, narrow passages, bumper rays, passing stopped vehicles and wrecks, giving way, three-level unstick and temporary path costs",
@@ -699,12 +699,33 @@
"stopSpeedMaxMps": "Stopped speed threshold",
"longRangeWindowSec": "Long-range clear LOS window",
"baseAlignDeg": "Base gun alignment tolerance",
"closeHitRadiusM": "Close-range hit acceptance radius",
"barrelSettleDegSec": "Max aim error drift outside close range",
"closeSettleHoldSec": "Close-range settle hold time",
"settleHoldSec": "Standard settle hold time",
"unstabilizedStopSpeedMps": "Unstabilized stop speed cap",
"stabilizedCreepSpeedMps": "Stabilized creep fire speed cap",
"aimErrorDeg": "Crew aim error (spread)",
"moveErrDegPerMps": "Aim error per m/s of own speed",
"turnErrDegPerDegSec": "Aim error per deg/s of hull turn",
"stabErrFactor": "Motion error factor with a stabilizer",
"targetHalfHeightM": "Half height of a fully visible target",
"fireThreshold": "Base hit probability needed to fire",
"minFireThreshold": "Lowest fire threshold",
"aimingThresholdBonus": "Threshold drop when the target aims at the bot",
"closeThresholdBonus": "Threshold drop at point blank",
"enemyReloadThresholdBonus": "Threshold drop after the target fired",
"enemyReloadSec": "How long a target counts as reloading after it fired",
"fleetingThresholdBonus": "Threshold drop for a target about to slip away",
"fleetingLateralMps": "Crossing speed of a slipping-away target",
"bigGunThresholdPenalty": "Threshold rise for big slow-loading guns",
"retreatThresholdPenalty": "Threshold rise while pulling back to cover",
"minShotIntervalSec": "Minimum main-gun shot interval",
"autocannonAimSlack": "Autocannon aim slack (times target size)",
"burstSec": "Burst length",
"burstPauseSec": "Pause between bursts",
"burstRecheckSec": "Safety re-check interval within a burst",
"autocannonReloadDetectSec": "Autocannon not-ready time that counts as a reload",
"auxWeapons": "Fire secondary and coaxial weapons",
"auxMaxRangeM": "Secondary and coaxial weapon range",
"auxFireAtArmor": "Secondary and coaxial weapons also fire at armored targets",
"friendlyCorridorM": "Friendly fire corridor width",
"ballisticStepMaxM": "Ballistic occlusion step length",
"ballisticSweepRadiusM": "Ballistic sphere sweep radius",
@@ -555,7 +555,7 @@
"estimation": "本车目击测速、守出口时长与自然散布",
"threat": "每个已发现敌人的危险程度:距离、是否瞄着本车、视线与最近是否命中本车",
"turret": "没有目标时炮塔看哪里:威胁、线索与沿路线扫视",
"fireControl": "距离分档、车速门槛、稳定等待与弹道防误伤",
"fireControl": "命中概率与开火门槛、机炮点射、副武器、炮管稳定和弹道安全",
"navigation": "驱动方式、原地转向与战术倒车",
"navEngine": "离线地图导航包的启用与降级,以及履带 / 轮式车在各类地表上的寻路代价",
"pathFollow": "重新寻路、前瞻跟路、弯道与到达前减速、窄路限速、车头射线、绕过停车和残骸、会车让路、三级脱困与临时寻路代价",
@@ -699,12 +699,33 @@
"stopSpeedMaxMps": "停稳判定最高车速",
"longRangeWindowSec": "远距连续射界观察窗",
"baseAlignDeg": "主炮对准允许角误差",
"closeHitRadiusM": "近距命中判定半径",
"barrelSettleDegSec": "近距以外瞄准误差最大变化速度",
"closeSettleHoldSec": "近距稳定保持时间",
"settleHoldSec": "常规稳定保持时间",
"unstabilizedStopSpeedMps": "无稳定器停稳车速上限",
"stabilizedCreepSpeedMps": "带稳定器慢速射击上限",
"aimErrorDeg": "炮手瞄准误差(散布)",
"moveErrDegPerMps": "本车每 m/s 车速增加的瞄准误差",
"turnErrDegPerDegSec": "车体每 °/s 转向增加的瞄准误差",
"stabErrFactor": "有稳定器时行进误差的倍数",
"targetHalfHeightM": "完全露出的目标半高",
"fireThreshold": "开火所需的基础命中概率",
"minFireThreshold": "开火门槛下限",
"aimingThresholdBonus": "目标瞄着本车时门槛降低",
"closeThresholdBonus": "贴脸时门槛降低(近距内按距离过渡)",
"enemyReloadThresholdBonus": "目标刚开过火时门槛降低",
"enemyReloadSec": "目标开火后视为装填中的时长",
"fleetingThresholdBonus": "目标即将离开视线时门槛降低",
"fleetingLateralMps": "视为即将离开视线的横穿速度",
"bigGunThresholdPenalty": "大口径慢装填火炮的门槛升高",
"retreatThresholdPenalty": "退入掩体途中的门槛升高",
"minShotIntervalSec": "主炮最短开火间隔",
"autocannonAimSlack": "机炮放宽倍数(目标尺寸的倍数)",
"burstSec": "点射时长",
"burstPauseSec": "点射间隔",
"burstRecheckSec": "点射中复查弹道和友军的间隔",
"autocannonReloadDetectSec": "机炮持续未就绪多久算换弹",
"auxWeapons": "使用副炮和并列武器",
"auxMaxRangeM": "副炮和并列武器的射击距离",
"auxFireAtArmor": "副炮和并列武器也打装甲目标",
"friendlyCorridorM": "友军弹道禁射走廊宽度",
"ballisticStepMaxM": "弹道硬遮挡检测步长",
"ballisticSweepRadiusM": "弹道扫掠半径",
@@ -54,7 +54,7 @@ function hasValidCrossFieldRules(effective: GroundAiTuningValues, patch: TuningP
if (est.watchMaxSec < est.watchMinSec || est.velStableSpanSec <= est.velSampleMinSpanSec) return false;
const fc = mergeSection(effective.fireControl, patch.fireControl);
if (fc.midRangeM <= fc.closeRangeM || fc.longRangeM <= fc.midRangeM) return false;
return fc.pointBlankMaxSpeedKmh >= fc.closeRangeMaxSpeedKmh;
return fc.minFireThreshold <= fc.fireThreshold && fc.pointBlankMaxSpeedKmh >= fc.closeRangeMaxSpeedKmh;
}
export function BotTuningPanel({ data, saving, onSave }: Props) {
@@ -270,12 +270,33 @@ export const BOT_TUNING_GROUPS: readonly BotTuningGroup[] = [
num('fireControl', 'stopSpeedMaxMps', 0.1, 2, 'm/s'),
num('fireControl', 'longRangeWindowSec', 1, 15, 's'),
num('fireControl', 'baseAlignDeg', 0.1, 3, '°'),
num('fireControl', 'closeHitRadiusM', 0.25, 2.2, 'm'),
num('fireControl', 'barrelSettleDegSec', 0.2, 12, '°/s'),
num('fireControl', 'closeSettleHoldSec', 0.02, 0.5, 's'),
num('fireControl', 'settleHoldSec', 0.05, 1.5, 's'),
num('fireControl', 'unstabilizedStopSpeedMps', 0.1, 3, 'm/s'),
num('fireControl', 'stabilizedCreepSpeedMps', 1.5, 15, 'm/s'),
num('fireControl', 'aimErrorDeg', 0.01, 2, '°'),
num('fireControl', 'moveErrDegPerMps', 0, 3, '°'),
num('fireControl', 'turnErrDegPerDegSec', 0, 0.5),
num('fireControl', 'stabErrFactor', 0.02, 1),
num('fireControl', 'targetHalfHeightM', 0.3, 2, 'm'),
num('fireControl', 'fireThreshold', 0.05, 0.95),
num('fireControl', 'minFireThreshold', 0.01, 0.9),
num('fireControl', 'aimingThresholdBonus', 0, 0.5),
num('fireControl', 'closeThresholdBonus', 0, 0.5),
num('fireControl', 'enemyReloadThresholdBonus', 0, 0.5),
num('fireControl', 'enemyReloadSec', 0, 15, 's'),
num('fireControl', 'fleetingThresholdBonus', 0, 0.5),
num('fireControl', 'fleetingLateralMps', 0.5, 15, 'm/s'),
num('fireControl', 'bigGunThresholdPenalty', 0, 0.5),
num('fireControl', 'retreatThresholdPenalty', 0, 0.6),
num('fireControl', 'minShotIntervalSec', 0.1, 5, 's'),
num('fireControl', 'autocannonAimSlack', 1, 10),
num('fireControl', 'burstSec', 0.2, 6, 's'),
num('fireControl', 'burstPauseSec', 0, 5, 's'),
num('fireControl', 'burstRecheckSec', 0.05, 2, 's'),
num('fireControl', 'autocannonReloadDetectSec', 0.1, 3, 's'),
{ id: 'groundAi.fireControl.auxWeapons', section: 'fireControl', field: 'auxWeapons', kind: 'bool' },
num('fireControl', 'auxMaxRangeM', 30, 1500, 'm'),
{ id: 'groundAi.fireControl.auxFireAtArmor', section: 'fireControl', field: 'auxFireAtArmor', kind: 'bool' },
num('fireControl', 'friendlyCorridorM', 1, 10, 'm'),
num('fireControl', 'ballisticStepMaxM', 5, 80, 'm'),
num('fireControl', 'ballisticSweepRadiusM', 0.02, 0.5, 'm'),
+24 -3
View File
@@ -257,12 +257,33 @@ const GroundAiFireControlSchema = z.object({
stopSpeedMaxMps: z.number().min(0.1).max(2),
longRangeWindowSec: z.number().min(1).max(15),
baseAlignDeg: z.number().min(0.1).max(3),
closeHitRadiusM: z.number().min(0.25).max(2.2),
barrelSettleDegSec: z.number().min(0.2).max(12),
closeSettleHoldSec: z.number().min(0.02).max(0.5),
settleHoldSec: z.number().min(0.05).max(1.5),
unstabilizedStopSpeedMps: z.number().min(0.1).max(3),
stabilizedCreepSpeedMps: z.number().min(1.5).max(15),
aimErrorDeg: z.number().min(0.01).max(2),
moveErrDegPerMps: z.number().min(0).max(3),
turnErrDegPerDegSec: z.number().min(0).max(0.5),
stabErrFactor: z.number().min(0.02).max(1),
targetHalfHeightM: z.number().min(0.3).max(2),
fireThreshold: z.number().min(0.05).max(0.95),
minFireThreshold: z.number().min(0.01).max(0.9),
aimingThresholdBonus: z.number().min(0).max(0.5),
closeThresholdBonus: z.number().min(0).max(0.5),
enemyReloadThresholdBonus: z.number().min(0).max(0.5),
enemyReloadSec: z.number().min(0).max(15),
fleetingThresholdBonus: z.number().min(0).max(0.5),
fleetingLateralMps: z.number().min(0.5).max(15),
bigGunThresholdPenalty: z.number().min(0).max(0.5),
retreatThresholdPenalty: z.number().min(0).max(0.6),
minShotIntervalSec: z.number().min(0.1).max(5),
autocannonAimSlack: z.number().min(1).max(10),
burstSec: z.number().min(0.2).max(6),
burstPauseSec: z.number().min(0).max(5),
burstRecheckSec: z.number().min(0.05).max(2),
autocannonReloadDetectSec: z.number().min(0.1).max(3),
auxWeapons: z.boolean(),
auxMaxRangeM: z.number().min(30).max(1500),
auxFireAtArmor: z.boolean(),
friendlyCorridorM: z.number().min(1).max(10),
ballisticStepMaxM: z.number().min(5).max(80),
ballisticSweepRadiusM: z.number().min(0.02).max(0.5),
+29 -3
View File
@@ -413,6 +413,11 @@ function readFireControlSection(fc: TuningReader): GroundAiTuning['fireControl']
if (pointBlankMaxSpeedKmh < closeRangeMaxSpeedKmh) {
throw new TuningError('tuning file ground-ai.jsonc: fireControl.pointBlankMaxSpeedKmh must be >= closeRangeMaxSpeedKmh');
}
const fireThreshold = fc.number('fireThreshold', { min: 0.05, max: 0.95 });
const minFireThreshold = fc.number('minFireThreshold', { min: 0.01, max: 0.9 });
if (minFireThreshold > fireThreshold) {
throw new TuningError('tuning file ground-ai.jsonc: fireControl.minFireThreshold must be <= fireThreshold');
}
return {
maxEngageRangeM: fc.number('maxEngageRangeM', { min: 150, max: 3000 }),
closeRangeM,
@@ -425,12 +430,33 @@ function readFireControlSection(fc: TuningReader): GroundAiTuning['fireControl']
stopSpeedMaxMps: fc.number('stopSpeedMaxMps', { min: 0.1, max: 2.0 }),
longRangeWindowSec: fc.number('longRangeWindowSec', { min: 1.0, max: 15.0 }),
baseAlignDeg: fc.number('baseAlignDeg', { min: 0.1, max: 3.0 }),
closeHitRadiusM: fc.number('closeHitRadiusM', { min: 0.25, max: 2.2 }),
barrelSettleDegSec: fc.number('barrelSettleDegSec', { min: 0.2, max: 12.0 }),
closeSettleHoldSec: fc.number('closeSettleHoldSec', { min: 0.02, max: 0.5 }),
settleHoldSec: fc.number('settleHoldSec', { min: 0.05, max: 1.5 }),
unstabilizedStopSpeedMps: fc.number('unstabilizedStopSpeedMps', { min: 0.1, max: 3.0 }),
stabilizedCreepSpeedMps: fc.number('stabilizedCreepSpeedMps', { min: 1.5, max: 15.0 }),
aimErrorDeg: fc.number('aimErrorDeg', { min: 0.01, max: 2 }),
moveErrDegPerMps: fc.number('moveErrDegPerMps', { min: 0, max: 3 }),
turnErrDegPerDegSec: fc.number('turnErrDegPerDegSec', { min: 0, max: 0.5 }),
stabErrFactor: fc.number('stabErrFactor', { min: 0.02, max: 1 }),
targetHalfHeightM: fc.number('targetHalfHeightM', { min: 0.3, max: 2 }),
fireThreshold,
minFireThreshold,
aimingThresholdBonus: fc.number('aimingThresholdBonus', { min: 0, max: 0.5 }),
closeThresholdBonus: fc.number('closeThresholdBonus', { min: 0, max: 0.5 }),
enemyReloadThresholdBonus: fc.number('enemyReloadThresholdBonus', { min: 0, max: 0.5 }),
enemyReloadSec: fc.number('enemyReloadSec', { min: 0, max: 15 }),
fleetingThresholdBonus: fc.number('fleetingThresholdBonus', { min: 0, max: 0.5 }),
fleetingLateralMps: fc.number('fleetingLateralMps', { min: 0.5, max: 15 }),
bigGunThresholdPenalty: fc.number('bigGunThresholdPenalty', { min: 0, max: 0.5 }),
retreatThresholdPenalty: fc.number('retreatThresholdPenalty', { min: 0, max: 0.6 }),
minShotIntervalSec: fc.number('minShotIntervalSec', { min: 0.1, max: 5 }),
autocannonAimSlack: fc.number('autocannonAimSlack', { min: 1, max: 10 }),
burstSec: fc.number('burstSec', { min: 0.2, max: 6 }),
burstPauseSec: fc.number('burstPauseSec', { min: 0, max: 5 }),
burstRecheckSec: fc.number('burstRecheckSec', { min: 0.05, max: 2 }),
autocannonReloadDetectSec: fc.number('autocannonReloadDetectSec', { min: 0.1, max: 3 }),
auxWeapons: fc.bool('auxWeapons'),
auxMaxRangeM: fc.number('auxMaxRangeM', { min: 30, max: 1500 }),
auxFireAtArmor: fc.bool('auxFireAtArmor'),
friendlyCorridorM: fc.number('friendlyCorridorM', { min: 1.0, max: 10.0 }),
ballisticStepMaxM: fc.number('ballisticStepMaxM', { min: 5.0, max: 80.0 }),
ballisticSweepRadiusM: fc.number('ballisticSweepRadiusM', { min: 0.02, max: 0.5 }),
+44 -4
View File
@@ -352,6 +352,18 @@
"scanPeriodSec": 6.0
},
// Fire permission (decision layer design, section 6). A main-gun shot needs its estimated hit
// probability to reach the fire threshold. The hit probability compares the visible part of the
// target (its projected width, targetHalfHeightM high, shrunk when only part of it is visible)
// with the expected angular error: aimErrorDeg, plus moveErrDegPerMps per m/s of own speed and
// turnErrDegPerDegSec per deg/s of hull turn (times stabErrFactor with a stabilizer), plus the
// lead uncertainty on a crossing target, with the barrel's current offset as the mean error.
// The threshold starts at fireThreshold and drops by aimingThresholdBonus when the target aims
// at the bot, by up to closeThresholdBonus inside closeRangeM, by enemyReloadThresholdBonus for
// enemyReloadSec after the target fired, and by fleetingThresholdBonus when it crosses faster
// than fleetingLateralMps partly hidden; it rises by up to bigGunThresholdPenalty for guns above
// 75 mm and by retreatThresholdPenalty while pulling back to cover, and never goes below
// minFireThreshold. Main-gun shots are at least minShotIntervalSec apart.
"fireControl": {
"maxEngageRangeM": 1250.0,
"closeRangeM": 100.0,
@@ -359,19 +371,47 @@
"longRangeM": 800.0,
"midSlowSpeedRatio": 0.45,
"midSlowMaxMps": 5.5,
// Moving-fire speed rises from the mid-range limit through the close-range boundary to point blank.
"closeRangeMaxSpeedKmh": 30.0,
"pointBlankMaxSpeedKmh": 35.0,
// At or below this speed the bot counts as standing (also the answer "stop" to a speed request).
"stopSpeedMaxMps": 0.45,
"longRangeWindowSec": 4.0,
// Fixed (casemate) guns: how far off the gun may be before the hull is asked to turn.
"baseAlignDeg": 0.42,
"closeHitRadiusM": 0.85,
// Outside close range, the rate at which barrel alignment drifts relative to the aim direction.
"barrelSettleDegSec": 1.8,
"closeSettleHoldSec": 0.08,
"settleHoldSec": 0.20,
"unstabilizedStopSpeedMps": 0.45,
"stabilizedCreepSpeedMps": 5.5,
"aimErrorDeg": 0.12,
"moveErrDegPerMps": 0.35,
"turnErrDegPerDegSec": 0.03,
"stabErrFactor": 0.2,
"targetHalfHeightM": 1.0,
"fireThreshold": 0.35,
"minFireThreshold": 0.1,
"aimingThresholdBonus": 0.1,
"closeThresholdBonus": 0.15,
"enemyReloadThresholdBonus": 0.08,
"enemyReloadSec": 3.0,
"fleetingThresholdBonus": 0.1,
"fleetingLateralMps": 3.0,
"bigGunThresholdPenalty": 0.08,
"retreatThresholdPenalty": 0.2,
"minShotIntervalSec": 0.65,
// Belt-fed autocannons (6.3): fire while within autocannonAimSlack times the target's angular
// half size, in bursts of burstSec with burstPauseSec between, checking barrel, trajectory and
// friendlies again every burstRecheckSec. Not ready for longer than autocannonReloadDetectSec
// counts as a reload.
"autocannonAimSlack": 3.0,
"burstSec": 1.2,
"burstPauseSec": 0.6,
"burstRecheckSec": 0.3,
"autocannonReloadDetectSec": 0.6,
// Secondary cannon and coaxial weapons (6.4) fire bursts alongside the main gun at light
// vehicles within auxMaxRangeM (at any vehicle with auxFireAtArmor).
"auxWeapons": true,
"auxMaxRangeM": 300.0,
"auxFireAtArmor": false,
"friendlyCorridorM": 3.2,
"ballisticStepMaxM": 25.0,
"ballisticSweepRadiusM": 0.12,
+36 -1
View File
@@ -20,7 +20,8 @@ let public WTO_BLOCK_FOLIAGE = 6
let public WTO_DENY_OK = 0
let public WTO_DENY_NO_TARGET = 1
let public WTO_DENY_NOT_READY = 2
let public WTO_DENY_SPEED = 3
// The estimated hit probability is below the fire threshold (decision layer design, 6.1).
let public WTO_DENY_HIT_PROB = 3
let public WTO_DENY_LONG_WINDOW = 4
let public WTO_DENY_AIM_ERR = 5
let public WTO_DENY_SETTLE = 6
@@ -30,6 +31,9 @@ let public WTO_DENY_ARC_HARD = 9
let public WTO_DENY_FRIENDLY = 10
let public WTO_DENY_MULTI_GUN = 11
let public WTO_DENY_TRAVERSE = 12
// An autocannon between two bursts (decision layer design, 6.3).
let public WTO_DENY_BURST_PAUSE = 13
let public WTO_DENY_COUNT = 14
[safe_when_uninitialized]
struct public WtoShellProfile
@@ -40,6 +44,8 @@ struct public WtoShellProfile
caliberM : float = 0.09
isSoftShell : bool = false
isAntiArmor : bool = true
// Stock maximum penetration (calc_max_penetration), mm.
penMm : float = 0.0
[safe_when_uninitialized]
struct public WtoPerceiveState
@@ -80,6 +86,8 @@ struct public WtoPerceiveState
expPos : float3[8]
nextLookAroundAt : float = 0.0
lookAroundUntil : float = -100.0
// When the engaged target was last seen firing (it is likely reloading for a while after).
targetShotAt : float = -100.0
// One discovered enemy in the bot's threat table (decision layer design, section 4). `seen`: seen
// clearly (fireable); `seesMe`: in line of sight this tick; `aiming`: its hull points at the bot or
@@ -110,6 +118,32 @@ struct public WtoTurretState
lookEid : EntityId = INVALID_ENTITY_ID
holdUntil : float = -100.0
// Trigger channel (decision layer design, section 6). hitProb / threshold: the last estimate for
// the main weapon (hitProbAligned: the same with the barrel on target); aimSlackDeg: how far off
// an autocannon may be and still fire; wantSpeedMps: the highest own speed at which the shot
// would reach the threshold (99 = no limit, 0 = only standing), a request the hull channel
// weighs. biasEpoch changes the aiming bias once per shooting opportunity (per shot, or per
// autocannon burst). burst*: the autocannon's current burst and pause; coax*: the same for the
// secondary and coaxial weapons, coaxBlocked a bit per weapon group failing its last check.
[safe_when_uninitialized]
struct public WtoTriggerState
hitProb : float = 0.0
hitProbAligned : float = 0.0
threshold : float = 1.0
aimSlackDeg : float = 1.0
wantSpeedMps : float = 99.0
wantSpeedAt : float = -100.0
biasEpoch : int = 0
burstUntil : float = -100.0
burstPauseUntil : float = -100.0
burstCheckedUntil : float = -100.0
coaxBurstUntil : float = -100.0
coaxPauseUntil : float = -100.0
coaxCheckedUntil : float = -100.0
coaxBlocked : int = 0
coaxShots : int = 0
lastLogAt : float = -100.0
[safe_when_uninitialized]
struct public WtoGunTraverse
known : bool = false
@@ -128,6 +162,7 @@ struct public WtoFireState
gunReady : bool = false
reloading : bool = false
gunDamaged : bool = false
notReadySince : float = -100.0
loadedBulletIdx : int = -1
activeSpeedMps : float = 880.0
activeDragCx : float = 0.35
+1 -1
View File
@@ -113,7 +113,7 @@ def public wto_est_compute_biased_lead(muzzlePos, myVel, aimBase : float3;
// Sample bounded natural bias ONCE per shooting opportunity (target + shot + state + 12m grid).
let gx = uint(int(muzzlePos.x / 12.0) + 4096)
let gz = uint(int(muzzlePos.z / 12.0) + 4096)
let key = (uint(p.targetEid) ^ (uint(slot.fire.shotCount) * 2654435761u) ^
let key = (uint(p.targetEid) ^ (uint(slot.trigger.biasEpoch) * 2654435761u) ^
(uint(slot.tactics.state) * 40503u) ^ (gx * 73856093u) ^ (gz * 19349663u))
if !p.oppSeeded || p.oppKey != key
p.oppKey = key
+114
View File
@@ -0,0 +1,114 @@
// Secondary cannon and coaxial weapons (decision layer design, 6.4): each weapon group decides for
// itself, alongside the main gun, so they can fire in the same moment. They fire bursts at the
// engaged target while their own barrel is within the aim slack of it, at light vehicles (any
// vehicle with fireControl.auxFireAtArmor) within fireControl.auxMaxRangeM. Before a burst and
// every burstRecheckSec, each group's straight line from its own muzzle is checked for hard cover
// and friendlies; a group that fails is held until the next check.
options indenting = 2
options no_global_heap = true
module wto_ai_fire_aux_common shared
require ecs
require math
require DagorMath
require Mission
require Unit
require Weapon
require %game.utils.utils_common
require %appGame.wtoai.wto_ai_config_common
require %appGame.wtoai.wto_ai_math_common
require %appGame.wtoai.wto_ai_combat_types_common
require %appGame.wtoai.wto_ai_types_common
require %appGame.wtoai.wto_ai_world_common
require %appGame.wtoai.wto_ai_sight_common
require %appGame.wtoai.wto_ai_trigger_common
require %appGame.wtoai.wto_ai_fire_gate_common
let private AUX_SECONDARY_BIT = 1
let private AUX_COAXIAL_BIT = 2
// The group's first working weapon that is ready to fire: its muzzle and barrel direction.
[never_inline]
def private wto_aux_ready_barrel(unit : Unit const?; group : WeaponTriggerGroups; var outPos, outDir : float3&) : bool
var found = false
get_weapons_by_trigger_group(unit.weap.Weapons, group) <| $(weapons : array<Weapon const? const> const#)
for i in range(length(weapons))
if found
break
assume weapon = weapons[i]
if weapon == null || weapon.isDummyGun
continue
let gun = as_gun(weapon)
if gun == null || gun.isInoperable || !gun.isReadyToShoot
continue
var tm : float3x4
weapon_calcShootTm(weapon, unit.unitTm, tm)
if length_sq(tm[0]) > 0.25
outPos = tm[3]
outDir = normalize(tm[0])
found = true
return found
// Hard cover or a friendly on the straight line from the group's muzzle (or no ready weapon).
[never_inline]
def private wto_aux_blocked(world : WtoWorldSnap const&; unit : Unit const?; group : WeaponTriggerGroups;
aimPt : float3; slot : WtoBotSlot const&) : bool
var muzzle = unit.pos
var dir = unit.unitTm[0]
if !wto_aux_ready_barrel(unit, group, muzzle, dir)
return true
if wto_sight_hard_segment_blocked(world, slot.eid, slot.perceive.targetEid, muzzle, aimPt, 0.05, 0.35, 0.65) != WTO_BLOCK_NONE
return true
let flightSec = length(aimPt - muzzle) / 900.0
return !wto_gate_friendly_segment_clear(world, slot.eid, slot.army, muzzle, aimPt, flightSec * 0.5)
// Fires the group once when its ready barrel is within the aim slack and it passed the last check.
[never_inline]
def private wto_aux_fire_group(var unit : Unit?; group : WeaponTriggerGroups; bit : int; aimPt : float3;
var slot : WtoBotSlot&)
assume tr = slot.trigger
if (tr.coaxBlocked & bit) != 0
return
var muzzle = unit.pos
var dir = unit.unitTm[0]
if !wto_aux_ready_barrel(unit, group, muzzle, dir)
return
let toAim = aimPt - muzzle
let dist = length(toAim)
if dist < 1.0 || dot(dir, toAim / dist) < cos(tr.aimSlackDeg * WTO_DEG_TO_RAD)
return
unit_single_shot(unit, int(group))
tr.coaxShots++
def private wto_aux_target_allowed(world : WtoWorldSnap const&; slot : WtoBotSlot const&) : bool
let idx = wto_world_find_unit(world, slot.perceive.targetEid)
if idx < 0
return false
assume tgt = world.units[idx]
return WTO_AI_FC_AUX_FIRE_AT_ARMOR || tgt.isLightTag || tgt.halfWid < 1.35
// Per frame while the main weapon is engaging a target in sight.
[never_inline]
def public wto_fire_aux_update(world : WtoWorldSnap const&; var unit : Unit?; now, distXZ : float; aimPt : float3;
var slot : WtoBotSlot&; var fireBudget : int&)
assume tr = slot.trigger
if !WTO_AI_FC_AUX_ENABLED || unit == null || unit.weap == null || distXZ > WTO_AI_FC_AUX_MAX_RANGE_M
return
if !wto_aux_target_allowed(world, slot)
return
var started = false
let onTarget = slot.fire.lastAimErrDeg <= tr.aimSlackDeg
if wto_trig_burst_gate(now, onTarget, tr.coaxBurstUntil, tr.coaxPauseUntil, started) != WTO_DENY_OK
return
if started || now >= tr.coaxCheckedUntil
if fireBudget <= 0
return
fireBudget--
tr.coaxBlocked = 0
if wto_aux_blocked(world, unit, WeaponTriggerGroups.TRIGGER_GROUP_SECONDARY, aimPt, slot)
tr.coaxBlocked |= AUX_SECONDARY_BIT
if wto_aux_blocked(world, unit, WeaponTriggerGroups.TRIGGER_GROUP_COAXIAL_GUN, aimPt, slot)
tr.coaxBlocked |= AUX_COAXIAL_BIT
tr.coaxCheckedUntil = now + WTO_AI_FC_BURST_RECHECK_SEC
wto_aux_fire_group(unit, WeaponTriggerGroups.TRIGGER_GROUP_SECONDARY, AUX_SECONDARY_BIT, aimPt, slot)
wto_aux_fire_group(unit, WeaponTriggerGroups.TRIGGER_GROUP_COAXIAL_GUN, AUX_COAXIAL_BIT, aimPt, slot)
+45 -17
View File
@@ -1,5 +1,6 @@
// Turret servo, active loaded-shell inspection, and ballistic aim solver.
// All ground weapon firing goes exclusively through wto_fire_gate_try_shoot.
// Main weapon firing goes exclusively through wto_fire_gate_try_shoot, secondary and coaxial
// weapons through wto_fire_aux_update.
options indenting = 2
options no_global_heap = true
module wto_ai_fire_common shared
@@ -24,6 +25,8 @@ require %appGame.wtoai.wto_ai_estimate_common
require %appGame.wtoai.wto_ai_fire_gate_common
require %appGame.wtoai.wto_ai_traverse_common
require %appGame.wtoai.wto_ai_turret_common
require %appGame.wtoai.wto_ai_trigger_common
require %appGame.wtoai.wto_ai_fire_aux_common
[never_inline]
def private wto_sync_active_shell(gun : WTGun const?; spec : WtoVehicleSpec const&; var fc : WtoFireState&)
@@ -60,6 +63,7 @@ def private wto_select_next_shell(var gun : WTGun?; spec : WtoVehicleSpec const&
return
var bestSoft = -1
var bestArmor = -1
var bestArmorPen = -1.0
var firstAvail = -1
for bsIdx in range(setCount)
assume bs = gun.properties.bulletSets[bsIdx]
@@ -76,8 +80,9 @@ def private wto_select_next_shell(var gun : WTGun?; spec : WtoVehicleSpec const&
continue
if spec.shells[si].isSoftShell && bestSoft < 0
bestSoft = bsIdx
elif spec.shells[si].isAntiArmor && bestArmor < 0
elif spec.shells[si].isAntiArmor && spec.shells[si].penMm > bestArmorPen
bestArmor = bsIdx
bestArmorPen = spec.shells[si].penMm
break
var wantIdx = wantSoft ? (bestSoft >= 0 ? bestSoft : bestArmor) : (bestArmor >= 0 ? bestArmor : firstAvail)
if wantIdx < 0
@@ -85,6 +90,16 @@ def private wto_select_next_shell(var gun : WTGun?; spec : WtoVehicleSpec const&
if wantIdx >= 0 && int(gun.nextBulletType) != wantIdx
gun.nextBulletType = uint8(wantIdx)
// The first working gun of the primary group becomes the weapon the fire control aims and loads.
[never_inline]
def private wto_take_primary_gun(var gun : WTGun?; turretNo, previousTurret : int; spec : WtoVehicleSpec const&;
wantSoftShell : bool; var fc : WtoFireState&)
fc.turretNo = turretNo
if fc.turretNo != previousTurret
fc.loadedBulletIdx = -1
wto_select_next_shell(gun, spec, wantSoftShell)
wto_sync_active_shell(gun, spec, fc)
[never_inline]
def private wto_inspect_primary_weapon(var unit : Unit?; now : float;
spec : WtoVehicleSpec const&; wantSoftShell : bool;
@@ -125,18 +140,25 @@ def private wto_inspect_primary_weapon(var unit : Unit?; now : float;
anyAlive = true
if selected < 0
selected = index
fc.turretNo = weapon.turretNo
if fc.turretNo != previousTurret
fc.loadedBulletIdx = -1
wto_select_next_shell(gun, spec, wantSoftShell)
wto_sync_active_shell(gun, spec, fc)
wto_take_primary_gun(gun, int(weapon.turretNo), previousTurret, spec, wantSoftShell, fc)
if gun.isReadyToShoot
fc.gunReady = true
totalLoaded += max(0, gun.currentLoadedAmmoCount)
if gun.currentLoadedAmmoCount > 0 || gun.currentBulletSet.bulletsCount > 0 || weapon.countBullets > 0
anyReserve = true
wto_finish_weapon_state(now, spec, anyGun, anyAlive, anyReserve, totalLoaded, fc)
return selected
// Damage, reload and shot confirmation from what wto_inspect_primary_weapon found.
[never_inline]
def private wto_finish_weapon_state(now : float; spec : WtoVehicleSpec const&; anyGun, anyAlive, anyReserve : bool;
totalLoaded : int; var fc : WtoFireState&)
fc.gunDamaged = anyGun && !anyAlive
fc.reloading = anyAlive && !fc.gunReady && anyReserve
// A belt-fed autocannon is not ready between two rounds; only a longer wait is a reload.
if fc.gunReady || !anyAlive
fc.notReadySince = now
let acReload = (now - fc.notReadySince) > WTO_AI_FC_AC_RELOAD_DETECT_SEC
fc.reloading = anyAlive && !fc.gunReady && anyReserve && (!spec.isAutocannonBelt || acReload)
if fc.pendingShotConfirm
if (fc.prevLoadedAmmo >= 0 && totalLoaded < fc.prevLoadedAmmo) || !fc.gunReady
fc.shotCount++
@@ -144,7 +166,6 @@ def private wto_inspect_primary_weapon(var unit : Unit?; now : float;
elif (now - fc.pendingShotAt) > 0.35
fc.pendingShotConfirm = false
fc.prevLoadedAmmo = totalLoaded
return selected
[never_inline]
def private wto_solve_ballistic_aim(muzzlePos, myVel : float3; var slot : WtoBotSlot&;
@@ -191,20 +212,25 @@ def private wto_clear_aim_tracking(var fc : WtoFireState&)
fc.lastAligned = false
fc.lastDenyReason = WTO_DENY_NO_TARGET
// SPAA vs aircraft only delegates to stock air-target fire control (never ground targets).
[never_inline]
def private wto_yield_air_fire(var unit : Unit?; var slot : WtoBotSlot&)
wto_set_hull_aim(unit, false, 0.0, unit.unitTm[0], slot)
wto_clear_aim_tracking(slot.fire)
wto_trig_clear(slot.trigger)
var gm = as_gm(unit)
if gm != null
*gm |> set_check_visibility_target(true)
*gm |> set_ignore_stop_for_fire(true)
set_unit_attack_type(unit, "attack_target")
[never_inline]
def public wto_fire_update(world : WtoWorldSnap const&; var unit : Unit?; className : string;
now, dt : float; var slot : WtoBotSlot&; var fireBudget : int&)
if !WTO_AI_LAYER_FIRE_CONTROL || unit == null || unit.weap == null
return
// SPAA vs aircraft only delegates to stock air-target fire control (never ground targets).
if slot.tactics.spaaYieldAir
wto_set_hull_aim(unit, false, 0.0, unit.unitTm[0], slot)
wto_clear_aim_tracking(slot.fire)
var gm = as_gm(unit)
if gm != null
*gm |> set_check_visibility_target(true)
*gm |> set_ignore_stop_for_fire(true)
set_unit_attack_type(unit, "attack_target")
wto_yield_air_fire(unit, slot)
return
set_unit_attack_type(unit, "dont_aim")
var wantSoftShell = false
@@ -239,6 +265,8 @@ def public wto_fire_update(world : WtoWorldSnap const&; var unit : Unit?; classN
wto_set_hull_aim(unit, canEngage, wishYaw, liveBarrelDir, slot)
if !canEngage
wto_clear_aim_tracking(slot.fire)
wto_trig_clear(slot.trigger)
return
let distXZ = sqrt(wto_xz_dist_sq(unit.pos, slot.perceive.knownPos))
wto_fire_gate_try_shoot(world, unit, now, distXZ, muzzlePos, aimPt, liveBarrelDir, wishWorldDir, slot, fireBudget)
wto_fire_aux_update(world, unit, now, distXZ, aimPt, slot, fireBudget)
+103 -55
View File
@@ -1,7 +1,10 @@
// Single fire-permission gate for every ground weapon (main cannon, launcher, SPAA self-defense).
// Every shot must pass visual confirmation, weapon readiness, distance-tier speed limits,
// 800 m continuous LOS window, aim settle, frame pre-fire budget, muzzle hard-ray, drag-integrated
// ballistic trajectory sweep, predicted friendly corridor, and multi-barrel group validation.
// Single fire-permission gate for the main weapon (cannon, launcher, SPAA self-defense).
// Every shot must pass visual confirmation, weapon readiness, the 800 m continuous LOS window, the
// trigger channel's hit probability against its fire threshold (wto_ai_trigger_common.das), aim
// settle, frame pre-fire budget, muzzle hard-ray, drag-integrated ballistic trajectory sweep,
// predicted friendly corridor, and multi-barrel group validation. A belt-fed autocannon fires in
// bursts whenever it is roughly on target and repeats the expensive checks only every
// fireControl.burstRecheckSec within a burst.
options indenting = 2
options no_global_heap = true
module wto_ai_fire_gate_common shared
@@ -16,12 +19,12 @@ require %game.utils.utils_common
require %appGame.wtoai.wto_ai_config_common
require %appGame.wtoai.wto_ai_math_common
require %appGame.wtoai.wto_ai_combat_types_common
require %appGame.wtoai.wto_ai_fire_speed_common
require %appGame.wtoai.wto_ai_types_common
require %appGame.wtoai.wto_ai_sight_common
require %appGame.wtoai.wto_ai_trigger_common
[never_inline]
def private wto_gate_friendly_segment_clear(world : WtoWorldSnap const&; selfEid : EntityId;
def public wto_gate_friendly_segment_clear(world : WtoWorldSnap const&; selfEid : EntityId;
army : int; p0, p1 : float3; tMid : float) : bool
let delta = p1 - p0
let segLen = length(delta)
@@ -43,7 +46,7 @@ def private wto_gate_friendly_segment_clear(world : WtoWorldSnap const&; selfEid
def private wto_gate_check_ballistic_arc(world : WtoWorldSnap const&;
selfEid, targetEid : EntityId; army : int;
muzzlePos, liveDir, carrierVel, aimPt : float3;
speedMps, dragCx, massKg, caliberM : float;
speedMps, dragCx, massKg, caliberM : float; checkMiss : bool;
var outBlock : int&) : int
let toAim = aimPt - muzzlePos
let targetDist = length(toAim)
@@ -85,14 +88,14 @@ def private wto_gate_check_ballistic_arc(world : WtoWorldSnap const&;
t += dt
if isLast
let missTol = max(3.2, targetDist * 0.012)
if length_sq(cur - aimPt) > missTol * missTol
if checkMiss && length_sq(cur - aimPt) > missTol * missTol
return WTO_DENY_AIM_ERR
return WTO_DENY_OK
return WTO_DENY_AIM_ERR
[never_inline]
def private wto_gate_check_barrel(world : WtoWorldSnap const&; unit : Unit const?;
slot : WtoBotSlot const&; muzzlePos, liveDir, aimPt : float3;
slot : WtoBotSlot const&; muzzlePos, liveDir, aimPt : float3; checkMiss : bool;
var outBlock : int&) : int
let straightBlk = wto_sight_hard_segment_blocked(world, slot.eid, slot.perceive.targetEid, muzzlePos, aimPt, 0.05, 0.35, 0.65)
if straightBlk != WTO_BLOCK_NONE
@@ -100,13 +103,13 @@ def private wto_gate_check_barrel(world : WtoWorldSnap const&; unit : Unit const
return WTO_DENY_MUZZLE_HARD
return wto_gate_check_ballistic_arc(world, slot.eid, slot.perceive.targetEid, slot.army,
muzzlePos, liveDir, unit.vel, aimPt,
slot.fire.activeSpeedMps, slot.fire.activeDragCx, slot.fire.activeMassKg, slot.fire.activeCaliberM, outBlock)
slot.fire.activeSpeedMps, slot.fire.activeDragCx, slot.fire.activeMassKg, slot.fire.activeCaliberM, checkMiss, outBlock)
[never_inline]
def private wto_gate_check_all_primary_guns(world : WtoWorldSnap const&; unit : Unit const?;
slot : WtoBotSlot const&; primaryMuzzle, primaryDir, aimPt : float3;
var outBlock : int&) : int
let primaryRes = wto_gate_check_barrel(world, unit, slot, primaryMuzzle, primaryDir, aimPt, outBlock)
checkMiss : bool; var outBlock : int&) : int
let primaryRes = wto_gate_check_barrel(world, unit, slot, primaryMuzzle, primaryDir, aimPt, checkMiss, outBlock)
if primaryRes != WTO_DENY_OK
return primaryRes
if unit == null || unit.weap == null
@@ -121,7 +124,7 @@ def private wto_gate_check_all_primary_guns(world : WtoWorldSnap const&; unit :
weapon_calcShootTm(weapon, unit.unitTm, gunTm)
if length_sq(gunTm[0]) <= 0.25
continue
let secRes = wto_gate_check_barrel(world, unit, slot, gunTm[3], normalize(gunTm[0]), aimPt, outBlock)
let secRes = wto_gate_check_barrel(world, unit, slot, gunTm[3], normalize(gunTm[0]), aimPt, checkMiss, outBlock)
if secRes != WTO_DENY_OK
return secRes == WTO_DENY_FRIENDLY ? WTO_DENY_FRIENDLY : WTO_DENY_MULTI_GUN
return WTO_DENY_OK
@@ -147,20 +150,22 @@ def private wto_gate_track_aim(now : float; offset : float3; target : EntityId;
fc.settleHoldSec = max(0.0, fc.settleHoldSec - age)
[never_inline]
def private wto_gate_log_deny(now, distXZ, measuredSpeed, speedLimit : float; reason, blk : int; var slot : WtoBotSlot&)
def private wto_gate_log_deny(now, distXZ : float; reason, blk : int; var slot : WtoBotSlot&)
assume fc = slot.fire
assume tr = slot.trigger
let changed = fc.lastDenyReason != reason || fc.lastDenyBlock != blk
fc.lastDenyReason = reason
fc.lastDenyBlock = blk
if WTO_AI_DIAG_TELEMETRY && reason >= WTO_DENY_SPEED && (changed || (now - fc.lastDenyLogAt) >= 4.0)
let logged = reason >= WTO_DENY_HIT_PROB && reason != WTO_DENY_BURST_PAUSE
if WTO_AI_DIAG_TELEMETRY && logged && (changed || (now - fc.lastDenyLogAt) >= 4.0)
fc.lastDenyLogAt = now
print("WTO_AI|DENY|eid={uint(slot.eid)}|reason={reason}|block={blk}|dist={distXZ}|spd={measuredSpeed}|limit={speedLimit}|err={fc.lastAimErrDeg}|drift={fc.aimDriftDegSec}\n")
print("WTO_AI|DENY|eid={uint(slot.eid)}|reason={reason}|block={blk}|dist={distXZ}|p={tr.hitProb}|pAligned={tr.hitProbAligned}|thr={tr.threshold}|wantV={tr.wantSpeedMps}|err={fc.lastAimErrDeg}|drift={fc.aimDriftDegSec}\n")
[never_inline]
def private wto_gate_request_primary_shot(var unit : Unit?; now, distXZ, measuredSpeed, speedLimit : float;
var slot : WtoBotSlot&)
def private wto_gate_request_primary_shot(var unit : Unit?; now, distXZ : float; var slot : WtoBotSlot&)
assume fc = slot.fire
unit_single_shot(unit, int(WeaponTriggerGroups.TRIGGER_GROUP_PRIMARY))
let firstOfBurst = !slot.spec.isAutocannonBelt || (now - fc.lastShotAt) > 0.5
fc.lastShotAt = now
fc.pendingShotConfirm = true
fc.pendingShotAt = now
@@ -170,8 +175,80 @@ def private wto_gate_request_primary_shot(var unit : Unit?; now, distXZ, measure
fc.maxShotErrDeg = max(fc.maxShotErrDeg, fc.lastAimErrDeg)
if !slot.spec.isAutocannonBelt
fc.settleHoldSec = 0.0
if WTO_AI_DIAG_TELEMETRY
print("WTO_AI|SHOT|eid={uint(slot.eid)}|tgt={uint(slot.perceive.targetEid)}|dist={distXZ}|spd={measuredSpeed}|limit={speedLimit}|v0={fc.activeSpeedMps}|err={fc.lastAimErrDeg}\n")
slot.trigger.biasEpoch++
if WTO_AI_DIAG_TELEMETRY && firstOfBurst
print("WTO_AI|SHOT|eid={uint(slot.eid)}|tgt={uint(slot.perceive.targetEid)}|dist={distXZ}|spd={length(unit.vel)}|p={slot.trigger.hitProb}|thr={slot.trigger.threshold}|v0={fc.activeSpeedMps}|err={fc.lastAimErrDeg}\n")
// Main gun: one shot per permission, once the hit probability reaches the threshold and the
// barrel has settled on the target.
[never_inline]
def private wto_gate_try_single(world : WtoWorldSnap const&; var unit : Unit?; now, distXZ : float;
muzzlePos, aimPt, liveDir, wishDir : float3; probOk, withinTraverse : bool;
var slot : WtoBotSlot&; var fireBudget : int&)
assume fc = slot.fire
let close = distXZ <= WTO_AI_FC_CLOSE_RANGE_M
wto_gate_track_aim(now, liveDir - wishDir, slot.perceive.targetEid, withinTraverse && probOk, close, fc)
let reqHold = close ? WTO_AI_FC_CLOSE_SETTLE_HOLD_SEC : WTO_AI_FC_SETTLE_HOLD_SEC
var deny = WTO_DENY_OK
if !withinTraverse
deny = WTO_DENY_TRAVERSE
elif !fc.gunReady || (now - fc.lastShotAt) < WTO_AI_FC_MIN_SHOT_INTERVAL_SEC
deny = WTO_DENY_NOT_READY
elif distXZ > WTO_AI_FC_LONG_RANGE_M && (slot.perceive.goodLosSec < WTO_AI_FC_LONG_WINDOW_SEC || slot.perceive.visiblePointCount < 2)
deny = WTO_DENY_LONG_WINDOW
elif !probOk
// Only the barrel still swinging onto the target, or the shot itself not good enough.
deny = slot.trigger.hitProbAligned >= slot.trigger.threshold ? WTO_DENY_AIM_ERR : WTO_DENY_HIT_PROB
elif !fc.lastAligned || fc.settleHoldSec < reqHold
deny = WTO_DENY_SETTLE
elif fireBudget <= 0
deny = WTO_DENY_BUDGET
if deny != WTO_DENY_OK
wto_gate_log_deny(now, distXZ, deny, WTO_BLOCK_NONE, slot)
return
fireBudget--
var blk = WTO_BLOCK_NONE
let gateRes = wto_gate_check_all_primary_guns(world, unit, slot, muzzlePos, liveDir, aimPt, true, blk)
if gateRes != WTO_DENY_OK
wto_gate_log_deny(now, distXZ, gateRes, blk, slot)
return
wto_gate_request_primary_shot(unit, now, distXZ, slot)
// Belt-fed autocannon (decision layer design, 6.3): bursts while within the aim slack, without
// waiting for the barrel to settle; the barrel, trajectory and friendly checks run at the start
// of a burst and every burstRecheckSec, not for every round.
[never_inline]
def private wto_gate_try_burst(world : WtoWorldSnap const&; var unit : Unit?; now, distXZ : float;
muzzlePos, aimPt, liveDir : float3; aimErrDeg : float; withinTraverse : bool;
var slot : WtoBotSlot&; var fireBudget : int&)
assume fc = slot.fire
assume tr = slot.trigger
var deny = WTO_DENY_OK
var started = false
if !withinTraverse
deny = WTO_DENY_TRAVERSE
elif !fc.gunReady
deny = WTO_DENY_NOT_READY
elif distXZ > WTO_AI_FC_LONG_RANGE_M && slot.perceive.goodLosSec < WTO_AI_FC_LONG_WINDOW_SEC
deny = WTO_DENY_LONG_WINDOW
else
deny = wto_trig_burst_gate(now, aimErrDeg <= tr.aimSlackDeg, tr.burstUntil, tr.burstPauseUntil, started)
if started
tr.biasEpoch++
tr.burstCheckedUntil = -100.0
var blk = WTO_BLOCK_NONE
if deny == WTO_DENY_OK && now >= tr.burstCheckedUntil
if fireBudget <= 0
deny = WTO_DENY_BUDGET
else
fireBudget--
deny = wto_gate_check_all_primary_guns(world, unit, slot, muzzlePos, liveDir, aimPt, false, blk)
if deny == WTO_DENY_OK
tr.burstCheckedUntil = now + WTO_AI_FC_BURST_RECHECK_SEC
if deny != WTO_DENY_OK
wto_gate_log_deny(now, distXZ, deny, blk, slot)
return
wto_gate_request_primary_shot(unit, now, distXZ, slot)
[never_inline]
def public wto_fire_gate_try_shoot(world : WtoWorldSnap const&; var unit : Unit?;
@@ -180,39 +257,10 @@ def public wto_fire_gate_try_shoot(world : WtoWorldSnap const&; var unit : Unit?
assume fc = slot.fire
let aimErrDeg = acos(clamp(dot(liveDir, wishDir), -1.0, 1.0)) * WTO_RAD_TO_DEG
fc.lastAimErrDeg = aimErrDeg
let measuredSpeed = length(unit.vel)
let halting = slot.drive.routeBOwned && slot.tactics.state == WTO_STATE_SHORT_HALT
let speedLimit = halting ? WTO_AI_FC_STOP_SPEED_MAX_MPS : wto_fire_speed_limit_mps(distXZ, slot.spec.vMaxFwd)
let speedOk = measuredSpeed <= speedLimit
let close = distXZ <= WTO_AI_FC_CLOSE_RANGE_M
let allowErrDeg = clamp(atan2(WTO_AI_FC_CLOSE_HIT_RADIUS_M, max(distXZ, 6.0)) * WTO_RAD_TO_DEG, WTO_AI_FC_BASE_ALIGN_DEG, 2.4)
let turnDegSec = abs(slot.drive.omegaYawRad) * WTO_RAD_TO_DEG
let probOk = wto_trig_evaluate(world, now, unit.pos, length(unit.vel), turnDegSec, distXZ, aimErrDeg, slot)
let withinTraverse = fc.hullAimTarget == INVALID_ENTITY_ID
wto_gate_track_aim(now, liveDir - wishDir, slot.perceive.targetEid, withinTraverse && aimErrDeg <= allowErrDeg && speedOk, close, fc)
let minCadence = slot.spec.isAutocannonBelt ? 0.12 : 0.65
let reqHold = close ? WTO_AI_FC_CLOSE_SETTLE_HOLD_SEC : WTO_AI_FC_SETTLE_HOLD_SEC
var deny = WTO_DENY_OK
if !withinTraverse
deny = WTO_DENY_TRAVERSE
elif !fc.gunReady || (now - fc.lastShotAt) < minCadence
deny = WTO_DENY_NOT_READY
elif !speedOk
deny = WTO_DENY_SPEED
elif distXZ > WTO_AI_FC_LONG_RANGE_M && (slot.perceive.goodLosSec < WTO_AI_FC_LONG_WINDOW_SEC || slot.perceive.visiblePointCount < 2)
deny = WTO_DENY_LONG_WINDOW
elif aimErrDeg > allowErrDeg
deny = WTO_DENY_AIM_ERR
elif !fc.lastAligned || fc.settleHoldSec < reqHold
deny = WTO_DENY_SETTLE
elif fireBudget <= 0
deny = WTO_DENY_BUDGET
if deny != WTO_DENY_OK
wto_gate_log_deny(now, distXZ, measuredSpeed, speedLimit, deny, WTO_BLOCK_NONE, slot)
return
fireBudget--
var blk = WTO_BLOCK_NONE
let gateRes = wto_gate_check_all_primary_guns(world, unit, slot, muzzlePos, liveDir, aimPt, blk)
if gateRes != WTO_DENY_OK
wto_gate_log_deny(now, distXZ, measuredSpeed, speedLimit, gateRes, blk, slot)
return
wto_gate_request_primary_shot(unit, now, distXZ, measuredSpeed, speedLimit, slot)
if slot.spec.isAutocannonBelt
wto_gate_try_burst(world, unit, now, distXZ, muzzlePos, aimPt, liveDir, aimErrDeg, withinTraverse, slot, fireBudget)
else
wto_gate_try_single(world, unit, now, distXZ, muzzlePos, aimPt, liveDir, wishDir, probOk, withinTraverse, slot, fireBudget)
@@ -216,6 +216,8 @@ def public wto_perceive_update(var world : WtoWorldSnap&; now, dt : float;
wto_scan_visual_exposure(world, now, dt, myEye, lookDir, hullDir, lookAround, slot, bestIdx, visCount, goodLosSec, aimPt)
if bestIdx >= 0
assume tgt = world.units[bestIdx]
if tgt.isShooting || p.targetEid != tgt.eid
p.targetShotAt = tgt.isShooting ? now : -100.0
p.targetEid = tgt.eid
p.targetIsAir = tgt.isAir
p.hasClearLos = true
+6 -4
View File
@@ -116,11 +116,13 @@ def public wto_sight_check_target_samples(world : WtoWorldSnap const&;
pts[3] = tgt.pos - left * sideOff + float3(0.0, 1.25, 0.0)
let count = clamp(maxSamples, 1, 4)
var vis = 0
var picked = false
var sum = float3(0.0, 0.0, 0.0)
for s in range(count)
if wto_sight_visual_clear(world, selfEid, tgt.eid, eyePos, pts[s]) == WTO_BLOCK_NONE
if !picked
outBestPt = pts[s]
picked = true
sum += pts[s]
vis++
// Aim at the middle of what is visible (decision layer design, 6.2), not at the first visible
// point, which with the hull hidden is the gun mantlet every time.
if vis > 0
outBestPt = sum / float(vis)
return vis
+3 -1
View File
@@ -1,6 +1,6 @@
// Authoritative per-vehicle specification loader: reads unit & weapon DataBlocks once per
// spawned bot (`gamedata/units/<className>.blk`) to extract role, gun stabilizer,
// turret slew rates, shell muzzle velocity, and chassis capabilities.
// turret slew rates, shell muzzle velocity and stock maximum penetration, and chassis capabilities.
options indenting = 2
options no_global_heap = true
module wto_ai_specs_common shared
@@ -15,6 +15,7 @@ require Unit
require IGroundModel
require HeavyVehicleModel
require Weapon
require WTBallistics
require %game.utils.utils_common
require %appGame.wtoai.wto_ai_math_common
require %appGame.wtoai.wto_ai_combat_types_common
@@ -65,6 +66,7 @@ def private wto_record_shell_block(bBlk : DataBlock const&; var spec : WtoVehicl
spec.shells[idx].caliberM = cal
spec.shells[idx].isSoftShell = isSoft
spec.shells[idx].isAntiArmor = !isSoft && !isNonCombat
spec.shells[idx].penMm = float(calc_max_penetration(bBlk))
spec.shellCount = idx + 1
[never_inline]
+9 -4
View File
@@ -37,9 +37,10 @@ struct public WtoBattleStats
movingShots : int[5]
bandShots : int[3]
bandMoving : int[3]
denySec : float[13]
denySec : float[14]
acWindowSec : float = 0.0
acShots : int = 0
auxShots : int = 0
def private wto_stats_role(slot : WtoBotSlot const&) : int
return clamp(slot.spec.role, 0, 4)
@@ -90,6 +91,8 @@ def private wto_stats_spot(now : float; groundTgt : bool; var slot : WtoBotSlot&
[never_inline]
def private wto_stats_shots(myPos : float3; var slot : WtoBotSlot&; var bs : WtoBattleStats&)
assume st = slot.stats
bs.auxShots += slot.trigger.coaxShots - st.lastAuxShots
st.lastAuxShots = slot.trigger.coaxShots
let fired = slot.fire.shotCount - st.lastShots
st.lastShots = slot.fire.shotCount
if fired <= 0
@@ -108,12 +111,14 @@ def private wto_stats_shots(myPos : float3; var slot : WtoBotSlot&; var bs : Wto
[never_inline]
def private wto_stats_window(dt : float; myPos : float3; groundTgt : bool; slot : WtoBotSlot const&;
var bs : WtoBattleStats&)
if !groundTgt || !slot.fire.gunReady || slot.fire.reloading
// A belt-fed autocannon is briefly not ready between rounds; that still counts as a window.
let ready = slot.fire.gunReady || slot.spec.isAutocannonBelt
if !groundTgt || !ready || slot.fire.reloading
return
if wto_xz_dist_sq(myPos, slot.perceive.knownPos) > WTO_AI_FC_MAX_RANGE_M * WTO_AI_FC_MAX_RANGE_M
return
bs.windowSec[wto_stats_role(slot)] += dt
bs.denySec[clamp(slot.fire.lastDenyReason, 0, 12)] += dt
bs.denySec[clamp(slot.fire.lastDenyReason, 0, WTO_DENY_COUNT - 1)] += dt
if slot.spec.isAutocannonBelt
bs.acWindowSec += dt
@@ -195,7 +200,7 @@ def private wto_stats_log(now : float; why : string; bs : WtoBattleStats const&)
if bs.spotted[role] + bs.samples[role] + bs.shots[role] > 0
wto_stats_log_role(now, why, role, bs)
assume d = bs.denySec
print("WTO_AI|BATTLE_STATS_FIRE|why={why}|t={now}|shotsBand={bs.bandShots[0]}/{bs.bandShots[1]}/{bs.bandShots[2]}|movingBand={bs.bandMoving[0]}/{bs.bandMoving[1]}/{bs.bandMoving[2]}|denySec=ok:{d[0]},noTarget:{d[1]},notReady:{d[2]},speed:{d[3]},longWindow:{d[4]},aimErr:{d[5]},settle:{d[6]},budget:{d[7]},muzzle:{d[8]},arc:{d[9]},friendly:{d[10]},multiGun:{d[11]},traverse:{d[12]}|acWindowSec={bs.acWindowSec}|acShots={bs.acShots}\n")
print("WTO_AI|BATTLE_STATS_FIRE|why={why}|t={now}|shotsBand={bs.bandShots[0]}/{bs.bandShots[1]}/{bs.bandShots[2]}|movingBand={bs.bandMoving[0]}/{bs.bandMoving[1]}/{bs.bandMoving[2]}|denySec=ok:{d[0]},noTarget:{d[1]},notReady:{d[2]},hitProb:{d[3]},longWindow:{d[4]},aimErr:{d[5]},settle:{d[6]},budget:{d[7]},muzzle:{d[8]},arc:{d[9]},friendly:{d[10]},multiGun:{d[11]},traverse:{d[12]},burstPause:{d[13]}|acWindowSec={bs.acWindowSec}|acShots={bs.acShots}|auxShots={bs.auxShots}\n")
// Per world tick: the cumulative statistics every statsLogIntervalSec.
[never_inline]
+1 -1
View File
@@ -120,7 +120,7 @@ def private wto_sm_march_speed(slot : WtoBotSlot const&; distGoal : float) : flo
def private wto_sm_waited_for_moving_shot(now : float; aimReady : bool; var slot : WtoBotSlot&) : bool
assume tac = slot.tactics
let deny = slot.fire.lastDenyReason
let blocked = deny == WTO_DENY_SPEED || deny == WTO_DENY_AIM_ERR || deny == WTO_DENY_SETTLE
let blocked = deny == WTO_DENY_HIT_PROB || deny == WTO_DENY_AIM_ERR || deny == WTO_DENY_SETTLE
if tac.state != WTO_STATE_RUN_AND_GUN || !aimReady || !blocked
tac.movingShotBlockedSince = -100.0
return false
+151
View File
@@ -0,0 +1,151 @@
// Trigger channel (decision layer design, section 6): instead of a speed limit per distance band,
// a shot is taken when its estimated hit probability reaches a fire threshold that moves with the
// situation. The hit probability comes from the angular size of the target's visible part against
// the expected angular error of the shot: the crew's aim, the bot's own motion (much less with a
// stabilizer), the uncertainty of the lead on a crossing target, and where the barrel points now.
// It also asks the hull channel for the highest speed at which the shot would be good enough.
options indenting = 2
options no_global_heap = true
module wto_ai_trigger_common shared
require ecs
require math
require %appGame.wtoai.wto_ai_config_common
require %appGame.wtoai.wto_ai_math_common
require %appGame.wtoai.wto_ai_combat_types_common
require %appGame.wtoai.wto_ai_types_common
require %appGame.wtoai.wto_ai_world_common
require %appGame.wtoai.wto_ai_threat_common
// Error function, Abramowitz and Stegun 7.1.26 (absolute error below 1.5e-7).
def private wto_trig_erf(x : float) : float
let ax = abs(x)
let t = 1.0 / (1.0 + 0.3275911 * ax)
let poly = ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t
let y = 1.0 - poly * exp(-ax * ax)
return x >= 0.0 ? y : -y
// Chance that a shot with mean error `offset` and normal spread `sigma` lands within +-half.
def private wto_trig_window(half, offset, sigma : float) : float
let s = max(1.0e-5, sigma) * 1.41421356
return clamp(0.5 * (wto_trig_erf((half - offset) / s) + wto_trig_erf((half + offset) / s)), 0.0, 1.0)
// Hit probability against a target `halfW` x `halfH` metres at `dist` (angles in radians).
def private wto_trig_prob(halfW, halfH, dist, offsetRad, sigmaRad : float) : float
let o = offsetRad * 0.7071
let d = max(dist, 5.0)
return wto_trig_window(atan2(halfW, d), o, sigmaRad) * wto_trig_window(atan2(halfH, d), o, sigmaRad)
// Expected angular spread of a shot (radians) at own speed and hull turn rate.
def private wto_trig_sigma(spec : WtoVehicleSpec const&; speedMps, turnDegSec, leadErrM, dist : float) : float
let stab = spec.hasVertStab ? WTO_AI_FC_STAB_ERR_FACTOR : 1.0
let moveDeg = (speedMps * WTO_AI_FC_MOVE_ERR_DEG_PER_MPS + turnDegSec * WTO_AI_FC_TURN_ERR_DEG_PER_DEG_SEC) * stab
let base = WTO_AI_FC_AIM_ERROR_DEG * WTO_DEG_TO_RAD
let move = moveDeg * WTO_DEG_TO_RAD
let lead = leadErrM / max(dist, 10.0)
return sqrt(base * base + move * move + lead * lead)
// Half width and half height (m) of the visible part of the target as seen from `myPos`.
def private wto_trig_target_half(myPos : float3; tgt : WtoUnitSnap const&; dist : float; visCount : int;
var halfW, halfH : float&)
let los = wto_xz_normalize(tgt.pos - myPos, float3(1.0, 0.0, 0.0))
let perp = float3(-los.z, 0.0, los.x)
let fwd = wto_xz_normalize(tgt.hullFwd, los)
let left = float3(-fwd.z, 0.0, fwd.x)
let sampled = dist > WTO_AI_FC_LONG_RANGE_M ? 2.0 : 4.0
let part = 0.35 + 0.65 * clamp(float(visCount) / sampled, 0.0, 1.0)
halfW = (abs(dot(fwd, perp)) * tgt.halfLen + abs(dot(left, perp)) * tgt.halfWid) * part
halfH = WTO_AI_FC_TARGET_HALF_HEIGHT_M * part
// Fire threshold (decision layer design, 6.1): lower when the target aims at the bot, is close,
// has just fired (reloading) or is about to slip out of sight; higher for big slow-loading guns
// and while pulling back to cover.
[never_inline]
def private wto_trig_threshold(now, dist : float; fleeting : bool; slot : WtoBotSlot const&) : float
assume p = slot.perceive
var thr = WTO_AI_FC_FIRE_THRESHOLD
for i in range(slot.threat.count)
if slot.threat.entries[i].eid == p.targetEid && slot.threat.entries[i].aiming
thr -= WTO_AI_FC_AIMING_BONUS
if dist < WTO_AI_FC_CLOSE_RANGE_M
thr -= WTO_AI_FC_CLOSE_BONUS * (1.0 - dist / WTO_AI_FC_CLOSE_RANGE_M)
if now - p.targetShotAt <= WTO_AI_FC_ENEMY_RELOAD_SEC
thr -= WTO_AI_FC_ENEMY_RELOAD_BONUS
if fleeting
thr -= WTO_AI_FC_FLEETING_BONUS
thr += WTO_AI_FC_BIG_GUN_PENALTY * clamp((slot.fire.activeCaliberM - 0.075) / 0.05, 0.0, 1.0)
if slot.tactics.state == WTO_STATE_RETREAT_COVER
thr += WTO_AI_FC_RETREAT_PENALTY
return clamp(thr, WTO_AI_FC_MIN_THRESHOLD, 0.95)
// Highest own speed (driving straight, barrel on target) at which the shot still reaches the
// threshold: 99 when the current speed is fine or when even standing would not help.
[never_inline]
def private wto_trig_speed_request(spec : WtoVehicleSpec const&; halfW, halfH, dist, leadErrM, speedNow, thr : float) : float
if wto_trig_prob(halfW, halfH, dist, 0.0, wto_trig_sigma(spec, speedNow, 0.0, leadErrM, dist)) >= thr
return 99.0
if wto_trig_prob(halfW, halfH, dist, 0.0, wto_trig_sigma(spec, 0.0, 0.0, leadErrM, dist)) < thr
return 99.0
var lo = 0.0
var hi = speedNow
for _i in range(6)
let mid = 0.5 * (lo + hi)
if wto_trig_prob(halfW, halfH, dist, 0.0, wto_trig_sigma(spec, mid, 0.0, leadErrM, dist)) >= thr
lo = mid
else
hi = mid
return lo <= WTO_AI_FC_STOP_SPEED_MAX_MPS ? 0.0 : lo
// Evaluates the main weapon's shot at the engaged target this frame and fills slot.trigger:
// hitProb (with the barrel where it points now), hitProbAligned (barrel on target), threshold,
// the autocannon aim slack and the speed request. True when the shot is good enough.
[never_inline]
def public wto_trig_evaluate(world : WtoWorldSnap const&; now : float; myPos : float3; speedNow, turnDegSec,
dist, aimErrDeg : float; var slot : WtoBotSlot&) : bool
assume tr = slot.trigger
assume p = slot.perceive
let tgtIdx = wto_world_find_unit(world, p.targetEid)
if tgtIdx < 0
tr.hitProb = 0.0
tr.hitProbAligned = 0.0
tr.wantSpeedMps = 99.0
return false
assume tgt = world.units[tgtIdx]
var halfW = 1.5
var halfH = 1.0
wto_trig_target_half(myPos, tgt, dist, p.visiblePointCount, halfW, halfH)
let los = wto_xz_normalize(tgt.pos - myPos, float3(1.0, 0.0, 0.0))
let latSpeed = abs(dot(p.estVel, float3(-los.z, 0.0, los.x)))
let tof = dist / max(120.0, slot.fire.activeSpeedMps)
let leadErrM = latSpeed * tof * WTO_AI_EST_LEAD_ERR_FRAC * (1.0 - 0.72 * p.velQuality)
let sigma = wto_trig_sigma(slot.spec, speedNow, turnDegSec, leadErrM, dist)
let fleeting = latSpeed >= WTO_AI_FC_FLEETING_LAT_MPS && p.visiblePointCount < 3
tr.threshold = wto_trig_threshold(now, dist, fleeting, slot)
tr.hitProb = wto_trig_prob(halfW, halfH, dist, aimErrDeg * WTO_DEG_TO_RAD, sigma)
tr.hitProbAligned = wto_trig_prob(halfW, halfH, dist, 0.0, sigma)
tr.aimSlackDeg = max(WTO_AI_FC_BASE_ALIGN_DEG, WTO_AI_FC_AC_AIM_SLACK * atan2(0.5 * (halfW + halfH), max(dist, 5.0)) * WTO_RAD_TO_DEG)
tr.wantSpeedMps = wto_trig_speed_request(slot.spec, halfW, halfH, dist, leadErrM, speedNow, tr.threshold)
tr.wantSpeedAt = now
return tr.hitProb >= tr.threshold
// Autocannon and coaxial bursts (decision layer design, 6.3): fire for burstSec, pause for
// burstPauseSec. Within a burst the weapon fires whenever it is roughly on target and stops while
// it is not; a new burst starts only when it is. `started` is set when this call opened a burst.
def public wto_trig_burst_gate(now : float; aimOk : bool; var burstUntil, pauseUntil : float&; var started : bool&) : int
started = false
if now < burstUntil
return aimOk ? WTO_DENY_OK : WTO_DENY_AIM_ERR
if now < pauseUntil
return WTO_DENY_BURST_PAUSE
if !aimOk
return WTO_DENY_AIM_ERR
burstUntil = now + WTO_AI_FC_BURST_SEC
pauseUntil = burstUntil + WTO_AI_FC_BURST_PAUSE_SEC
started = true
return WTO_DENY_OK
// No engaged target: nothing is requested from the hull.
def public wto_trig_clear(var tr : WtoTriggerState&)
tr.hitProb = 0.0
tr.hitProbAligned = 0.0
tr.wantSpeedMps = 99.0
+2 -1
View File
@@ -166,7 +166,6 @@ struct public WtoTacticsState
stateEnteredAt : float = -100.0
moveGoal : float3 = float3(0.0, 0.0, 0.0)
desiredSpeedMps : float = 10.0
movingShotBlockedSince : float = -100.0
haltEnterAt : float = -100.0
haltStartShots : int = 0
shortHaltCooldownUntil : float = -100.0
@@ -229,6 +228,7 @@ struct public WtoBotStats
spotShots : int = 0
spotPending : bool = false
lastShots : int = 0
lastAuxShots : int = 0
nextSampleAt : float = 0.0
[safe_when_uninitialized]
@@ -253,3 +253,4 @@ struct public WtoBotSlot
stats : WtoBotStats = WtoBotStats()
threat : WtoThreatTable = WtoThreatTable()
turret : WtoTurretState = WtoTurretState()
trigger : WtoTriggerState = WtoTriggerState()
@@ -269,12 +269,33 @@ export interface GroundAiConfig {
readonly stopSpeedMaxMps: number;
readonly longRangeWindowSec: number;
readonly baseAlignDeg: number;
readonly closeHitRadiusM: number;
readonly barrelSettleDegSec: number;
readonly closeSettleHoldSec: number;
readonly settleHoldSec: number;
readonly unstabilizedStopSpeedMps: number;
readonly stabilizedCreepSpeedMps: number;
readonly aimErrorDeg: number;
readonly moveErrDegPerMps: number;
readonly turnErrDegPerDegSec: number;
readonly stabErrFactor: number;
readonly targetHalfHeightM: number;
readonly fireThreshold: number;
readonly minFireThreshold: number;
readonly aimingThresholdBonus: number;
readonly closeThresholdBonus: number;
readonly enemyReloadThresholdBonus: number;
readonly enemyReloadSec: number;
readonly fleetingThresholdBonus: number;
readonly fleetingLateralMps: number;
readonly bigGunThresholdPenalty: number;
readonly retreatThresholdPenalty: number;
readonly minShotIntervalSec: number;
readonly autocannonAimSlack: number;
readonly burstSec: number;
readonly burstPauseSec: number;
readonly burstRecheckSec: number;
readonly autocannonReloadDetectSec: number;
readonly auxWeapons: boolean;
readonly auxMaxRangeM: number;
readonly auxFireAtArmor: boolean;
readonly friendlyCorridorM: number;
readonly ballisticStepMaxM: number;
readonly ballisticSweepRadiusM: number;
@@ -473,12 +494,33 @@ function collectConfigEntries(c: GroundAiConfig): readonly DasEntry[] {
['WTO_AI_FC_STOP_SPEED_MAX_MPS', 'float', c.fireControl.stopSpeedMaxMps],
['WTO_AI_FC_LONG_WINDOW_SEC', 'float', c.fireControl.longRangeWindowSec],
['WTO_AI_FC_BASE_ALIGN_DEG', 'float', c.fireControl.baseAlignDeg],
['WTO_AI_FC_CLOSE_HIT_RADIUS_M', 'float', c.fireControl.closeHitRadiusM],
['WTO_AI_FC_BARREL_SETTLE_DEG_SEC', 'float', c.fireControl.barrelSettleDegSec],
['WTO_AI_FC_CLOSE_SETTLE_HOLD_SEC', 'float', c.fireControl.closeSettleHoldSec],
['WTO_AI_FC_SETTLE_HOLD_SEC', 'float', c.fireControl.settleHoldSec],
['WTO_AI_FC_UNSTAB_STOP_MPS', 'float', c.fireControl.unstabilizedStopSpeedMps],
['WTO_AI_FC_STAB_CREEP_MPS', 'float', c.fireControl.stabilizedCreepSpeedMps],
['WTO_AI_FC_AIM_ERROR_DEG', 'float', c.fireControl.aimErrorDeg],
['WTO_AI_FC_MOVE_ERR_DEG_PER_MPS', 'float', c.fireControl.moveErrDegPerMps],
['WTO_AI_FC_TURN_ERR_DEG_PER_DEG_SEC', 'float', c.fireControl.turnErrDegPerDegSec],
['WTO_AI_FC_STAB_ERR_FACTOR', 'float', c.fireControl.stabErrFactor],
['WTO_AI_FC_TARGET_HALF_HEIGHT_M', 'float', c.fireControl.targetHalfHeightM],
['WTO_AI_FC_FIRE_THRESHOLD', 'float', c.fireControl.fireThreshold],
['WTO_AI_FC_MIN_THRESHOLD', 'float', c.fireControl.minFireThreshold],
['WTO_AI_FC_AIMING_BONUS', 'float', c.fireControl.aimingThresholdBonus],
['WTO_AI_FC_CLOSE_BONUS', 'float', c.fireControl.closeThresholdBonus],
['WTO_AI_FC_ENEMY_RELOAD_BONUS', 'float', c.fireControl.enemyReloadThresholdBonus],
['WTO_AI_FC_ENEMY_RELOAD_SEC', 'float', c.fireControl.enemyReloadSec],
['WTO_AI_FC_FLEETING_BONUS', 'float', c.fireControl.fleetingThresholdBonus],
['WTO_AI_FC_FLEETING_LAT_MPS', 'float', c.fireControl.fleetingLateralMps],
['WTO_AI_FC_BIG_GUN_PENALTY', 'float', c.fireControl.bigGunThresholdPenalty],
['WTO_AI_FC_RETREAT_PENALTY', 'float', c.fireControl.retreatThresholdPenalty],
['WTO_AI_FC_MIN_SHOT_INTERVAL_SEC', 'float', c.fireControl.minShotIntervalSec],
['WTO_AI_FC_AC_AIM_SLACK', 'float', c.fireControl.autocannonAimSlack],
['WTO_AI_FC_BURST_SEC', 'float', c.fireControl.burstSec],
['WTO_AI_FC_BURST_PAUSE_SEC', 'float', c.fireControl.burstPauseSec],
['WTO_AI_FC_BURST_RECHECK_SEC', 'float', c.fireControl.burstRecheckSec],
['WTO_AI_FC_AC_RELOAD_DETECT_SEC', 'float', c.fireControl.autocannonReloadDetectSec],
['WTO_AI_FC_AUX_ENABLED', 'bool', c.fireControl.auxWeapons],
['WTO_AI_FC_AUX_MAX_RANGE_M', 'float', c.fireControl.auxMaxRangeM],
['WTO_AI_FC_AUX_FIRE_AT_ARMOR', 'bool', c.fireControl.auxFireAtArmor],
['WTO_AI_FC_FRIENDLY_CORRIDOR_M', 'float', c.fireControl.friendlyCorridorM],
['WTO_AI_FC_BALLISTIC_STEP_M', 'float', c.fireControl.ballisticStepMaxM],
['WTO_AI_FC_BALLISTIC_SWEEP_R_M', 'float', c.fireControl.ballisticSweepRadiusM],