fix(ground-ai): improve firing on the move
Share a distance-based speed cap between tactics and the fire gate. Brake toward it and try a short halt when speed or aim keeps blocking a ready shot. Measure tracking drift relative to the aim direction and use the close-range alignment window for quick shots. Expose the controls in the launcher and record measured and permitted speeds in diagnostics. Verified both TypeScript typechecks, 2.61.0.58 and 2.61.0.60 patch checks and builds, and daScript loading in the guarded 2.61.0.58 client.
This commit is contained in:
1 parent
0167c3ea7d
commit
688406bb76
17 files changed
+218
-114
No files matched your search
@@ -590,6 +590,7 @@
|
||||
},
|
||||
"stateMachine": {
|
||||
"preaimAngleDeg": "Moving pre-aim angle threshold",
|
||||
"movingShotWaitSec": "Time to attempt a moving shot before halting",
|
||||
"shortHaltMaxSec": "Short halt max duration",
|
||||
"shortHaltCooldownSec": "Short halt cooldown",
|
||||
"turnLaunchSpeedMps": "Turn launch target speed",
|
||||
@@ -645,11 +646,13 @@
|
||||
"longRangeM": "Long range band threshold",
|
||||
"midSlowSpeedRatio": "Mid-range fire-on-move speed ratio",
|
||||
"midSlowMaxMps": "Mid-range fire-on-move speed cap",
|
||||
"closeRangeMaxSpeedKmh": "Moving-fire speed cap at the close-range boundary",
|
||||
"pointBlankMaxSpeedKmh": "Moving-fire speed cap at point blank",
|
||||
"stopSpeedMaxMps": "Stopped speed threshold",
|
||||
"longRangeWindowSec": "Long-range clear LOS window",
|
||||
"baseAlignDeg": "Base gun alignment tolerance",
|
||||
"closeHitRadiusM": "Close-range hit acceptance radius",
|
||||
"barrelSettleDegSec": "Max barrel angular rate to settle",
|
||||
"barrelSettleDegSec": "Max aim error drift outside close range",
|
||||
"closeSettleHoldSec": "Close-range settle hold time",
|
||||
"settleHoldSec": "Standard settle hold time",
|
||||
"unstabilizedStopSpeedMps": "Unstabilized stop speed cap",
|
||||
@@ -666,6 +669,7 @@
|
||||
"deadEchoSec": "Dead-echo detection timeout",
|
||||
"controlTimeoutSec": "Native control release timeout",
|
||||
"cornerBrakeAccel": "Corner braking deceleration",
|
||||
"movingFireSpeedRampMps": "Speed error for full throttle or braking while firing on the move",
|
||||
"pivotAngleDeg": "Neutral pivot turn angle threshold",
|
||||
"stuckWindowSec": "Stuck detection window",
|
||||
"stuckMinMoveM": "Stuck min movement distance",
|
||||
|
||||
@@ -590,6 +590,7 @@
|
||||
},
|
||||
"stateMachine": {
|
||||
"preaimAngleDeg": "行进预瞄角度阈值",
|
||||
"movingShotWaitSec": "转入短停前尝试行进射击的时间",
|
||||
"shortHaltMaxSec": "单次短停最长时间",
|
||||
"shortHaltCooldownSec": "短停冷却时间",
|
||||
"turnLaunchSpeedMps": "甩弯起步目标车速",
|
||||
@@ -645,11 +646,13 @@
|
||||
"longRangeM": "远距交战分界距离",
|
||||
"midSlowSpeedRatio": "中距行进射击最高车速比",
|
||||
"midSlowMaxMps": "中距行进射击最高车速",
|
||||
"closeRangeMaxSpeedKmh": "近距分界处行进射击最高车速",
|
||||
"pointBlankMaxSpeedKmh": "贴身时行进射击最高车速",
|
||||
"stopSpeedMaxMps": "停稳判定最高车速",
|
||||
"longRangeWindowSec": "远距连续射界观察窗",
|
||||
"baseAlignDeg": "主炮对准允许角误差",
|
||||
"closeHitRadiusM": "近距命中判定半径",
|
||||
"barrelSettleDegSec": "炮管稳定最大角速度",
|
||||
"barrelSettleDegSec": "近距以外瞄准误差最大变化速度",
|
||||
"closeSettleHoldSec": "近距稳定保持时间",
|
||||
"settleHoldSec": "常规稳定保持时间",
|
||||
"unstabilizedStopSpeedMps": "无稳定器停稳车速上限",
|
||||
@@ -666,6 +669,7 @@
|
||||
"deadEchoSec": "无响应回声判定时长",
|
||||
"controlTimeoutSec": "原生控制超时归还时长",
|
||||
"cornerBrakeAccel": "弯道减速制动强度",
|
||||
"movingFireSpeedRampMps": "行进射击时全油门或全制动对应的速度差",
|
||||
"pivotAngleDeg": "原地中性转向角度阈值",
|
||||
"stuckWindowSec": "卡死检测窗口时长",
|
||||
"stuckMinMoveM": "卡死判定最小位移",
|
||||
|
||||
@@ -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 true;
|
||||
return fc.pointBlankMaxSpeedKmh >= fc.closeRangeMaxSpeedKmh;
|
||||
}
|
||||
|
||||
export function BotTuningPanel({ data, saving, onSave }: Props) {
|
||||
|
||||
@@ -156,6 +156,7 @@ export const BOT_TUNING_GROUPS: readonly BotTuningGroup[] = [
|
||||
customOnly: true,
|
||||
fields: [
|
||||
num('stateMachine', 'preaimAngleDeg', 1, 30, '°'),
|
||||
num('stateMachine', 'movingShotWaitSec', 0.25, 5, 's'),
|
||||
num('stateMachine', 'shortHaltMaxSec', 0.5, 12, 's'),
|
||||
num('stateMachine', 'shortHaltCooldownSec', 0.5, 20, 's'),
|
||||
num('stateMachine', 'turnLaunchSpeedMps', 0.5, 6, 'm/s'),
|
||||
@@ -231,6 +232,8 @@ export const BOT_TUNING_GROUPS: readonly BotTuningGroup[] = [
|
||||
num('fireControl', 'longRangeM', 300, 1500, 'm'),
|
||||
num('fireControl', 'midSlowSpeedRatio', 0.1, 1),
|
||||
num('fireControl', 'midSlowMaxMps', 1, 15, 'm/s'),
|
||||
num('fireControl', 'closeRangeMaxSpeedKmh', 3.6, 100, 'km/h'),
|
||||
num('fireControl', 'pointBlankMaxSpeedKmh', 3.6, 100, 'km/h'),
|
||||
num('fireControl', 'stopSpeedMaxMps', 0.1, 2, 'm/s'),
|
||||
num('fireControl', 'longRangeWindowSec', 1, 15, 's'),
|
||||
num('fireControl', 'baseAlignDeg', 0.1, 3, '°'),
|
||||
@@ -257,6 +260,7 @@ export const BOT_TUNING_GROUPS: readonly BotTuningGroup[] = [
|
||||
num('navigation', 'deadEchoSec', 0.3, 10, 's'),
|
||||
num('navigation', 'controlTimeoutSec', 0.3, 10, 's'),
|
||||
num('navigation', 'cornerBrakeAccel', 0.5, 8),
|
||||
num('navigation', 'movingFireSpeedRampMps', 0.2, 5, 'm/s'),
|
||||
num('navigation', 'pivotAngleDeg', 25, 150, '°'),
|
||||
num('navigation', 'stuckWindowSec', 1, 15, 's'),
|
||||
num('navigation', 'stuckMinMoveM', 0.5, 10, 'm'),
|
||||
|
||||
@@ -91,6 +91,7 @@ const GroundAiNavigationSchema = z.object({
|
||||
deadEchoSec: z.number().min(0.3).max(10),
|
||||
controlTimeoutSec: z.number().min(0.3).max(10),
|
||||
cornerBrakeAccel: z.number().min(0.5).max(8),
|
||||
movingFireSpeedRampMps: z.number().min(0.2).max(5),
|
||||
pivotAngleDeg: z.number().min(25).max(150),
|
||||
stuckWindowSec: z.number().min(1).max(15),
|
||||
stuckMinMoveM: z.number().min(0.5).max(10),
|
||||
@@ -113,6 +114,7 @@ const GroundAiPerceptionSchema = z.object({
|
||||
|
||||
const GroundAiStateMachineSchema = z.object({
|
||||
preaimAngleDeg: z.number().min(1).max(30),
|
||||
movingShotWaitSec: z.number().min(0.25).max(5),
|
||||
shortHaltMaxSec: z.number().min(0.5).max(12),
|
||||
shortHaltCooldownSec: z.number().min(0.5).max(20),
|
||||
turnLaunchSpeedMps: z.number().min(0.5).max(6),
|
||||
@@ -160,6 +162,8 @@ const GroundAiFireControlSchema = z.object({
|
||||
longRangeM: z.number().min(300).max(1500),
|
||||
midSlowSpeedRatio: z.number().min(0.1).max(1),
|
||||
midSlowMaxMps: z.number().min(1).max(15),
|
||||
closeRangeMaxSpeedKmh: z.number().min(3.6).max(100),
|
||||
pointBlankMaxSpeedKmh: z.number().min(3.6).max(100),
|
||||
stopSpeedMaxMps: z.number().min(0.1).max(2),
|
||||
longRangeWindowSec: z.number().min(1).max(15),
|
||||
baseAlignDeg: z.number().min(0.1).max(3),
|
||||
|
||||
@@ -190,6 +190,7 @@ function readNavigationSection(nav: TuningReader): GroundAiTuning['navigation']
|
||||
deadEchoSec: nav.number('deadEchoSec', { min: 0.3, max: 10 }),
|
||||
controlTimeoutSec: nav.number('controlTimeoutSec', { min: 0.3, max: 10 }),
|
||||
cornerBrakeAccel: nav.number('cornerBrakeAccel', { min: 0.5, max: 8 }),
|
||||
movingFireSpeedRampMps: nav.number('movingFireSpeedRampMps', { min: 0.2, max: 5 }),
|
||||
pivotAngleDeg: nav.number('pivotAngleDeg', { min: 25, max: 150 }),
|
||||
stuckWindowSec: nav.number('stuckWindowSec', { min: 1, max: 15 }),
|
||||
stuckMinMoveM: nav.number('stuckMinMoveM', { min: 0.5, max: 10 }),
|
||||
@@ -221,6 +222,7 @@ function readStateMachineSection(sm: TuningReader): GroundAiTuning['stateMachine
|
||||
}
|
||||
return {
|
||||
preaimAngleDeg: sm.number('preaimAngleDeg', { min: 1.0, max: 30.0 }),
|
||||
movingShotWaitSec: sm.number('movingShotWaitSec', { min: 0.25, max: 5.0 }),
|
||||
shortHaltMaxSec: sm.number('shortHaltMaxSec', { min: 0.5, max: 12.0 }),
|
||||
shortHaltCooldownSec: sm.number('shortHaltCooldownSec', { min: 0.5, max: 20.0 }),
|
||||
turnLaunchSpeedMps: sm.number('turnLaunchSpeedMps', { min: 0.5, max: 6.0 }),
|
||||
@@ -283,6 +285,11 @@ function readFireControlSection(fc: TuningReader): GroundAiTuning['fireControl']
|
||||
if (midRangeM <= closeRangeM || longRangeM <= midRangeM) {
|
||||
throw new TuningError('tuning file ground-ai.jsonc: fireControl ranges must satisfy closeRangeM < midRangeM < longRangeM');
|
||||
}
|
||||
const closeRangeMaxSpeedKmh = fc.number('closeRangeMaxSpeedKmh', { min: 3.6, max: 100 });
|
||||
const pointBlankMaxSpeedKmh = fc.number('pointBlankMaxSpeedKmh', { min: 3.6, max: 100 });
|
||||
if (pointBlankMaxSpeedKmh < closeRangeMaxSpeedKmh) {
|
||||
throw new TuningError('tuning file ground-ai.jsonc: fireControl.pointBlankMaxSpeedKmh must be >= closeRangeMaxSpeedKmh');
|
||||
}
|
||||
return {
|
||||
maxEngageRangeM: fc.number('maxEngageRangeM', { min: 150, max: 3000 }),
|
||||
closeRangeM,
|
||||
@@ -290,6 +297,8 @@ function readFireControlSection(fc: TuningReader): GroundAiTuning['fireControl']
|
||||
longRangeM,
|
||||
midSlowSpeedRatio: fc.number('midSlowSpeedRatio', { min: 0.1, max: 1.0 }),
|
||||
midSlowMaxMps: fc.number('midSlowMaxMps', { min: 1.0, max: 15.0 }),
|
||||
closeRangeMaxSpeedKmh,
|
||||
pointBlankMaxSpeedKmh,
|
||||
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 }),
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
"deadEchoSec": 1.2,
|
||||
"controlTimeoutSec": 1.0,
|
||||
"cornerBrakeAccel": 1.75,
|
||||
// Speed error at which the moving-fire controller applies full throttle or braking.
|
||||
"movingFireSpeedRampMps": 1.0,
|
||||
"pivotAngleDeg": 75.0,
|
||||
"stuckWindowSec": 3.6,
|
||||
"stuckMinMoveM": 2.0,
|
||||
@@ -126,6 +128,8 @@
|
||||
// Per-bot hull state machine timings and thresholds (offline values).
|
||||
"stateMachine": {
|
||||
"preaimAngleDeg": 8.0,
|
||||
// Time a ready gun can be held up by speed or aim before attempting a short halt.
|
||||
"movingShotWaitSec": 1.0,
|
||||
"shortHaltMaxSec": 3.0,
|
||||
"shortHaltCooldownSec": 4.0,
|
||||
"turnLaunchSpeedMps": 2.1,
|
||||
@@ -174,10 +178,14 @@
|
||||
"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,
|
||||
"stopSpeedMaxMps": 0.45,
|
||||
"longRangeWindowSec": 4.0,
|
||||
"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,
|
||||
|
||||
Reference in new issue
Block a user