fix(ground-ai): finish single-vehicle combat decisions
Check the live barrel trajectory against the exposed target and shorten fire delays. Resolve automatic and secondary guns using stock weapon data. Keep short halts and withdrawals coherent, follow the order while engaged, and reverse on the route with direction-aware obstacle recovery. Verified daScript loading and native AI script readiness in the guarded 2.61.0.64 lab client. Battle behavior requires manual acceptance.
This commit is contained in:
1 parent
ee360a5042
commit
ee7bb12092
34 files changed
+1030
-549
No files matched your search
@@ -377,7 +377,15 @@ function readTurretSection(turret: TuningReader): GroundAiTuning['turret'] {
|
||||
function readBehaviorSection(bhv: TuningReader): GroundAiTuning['behavior'] {
|
||||
return {
|
||||
scoreIntervalSec: bhv.number('scoreIntervalSec', { min: 0.1, max: 3 }),
|
||||
minHoldSec: bhv.number('minHoldSec', { min: 0, max: 10 }),
|
||||
advanceHoldSec: bhv.number('advanceHoldSec', { min: 0, max: 10 }),
|
||||
engageHoldSec: bhv.number('engageHoldSec', { min: 0, max: 10 }),
|
||||
haltHoldSec: bhv.number('haltHoldSec', { min: 0, max: 10 }),
|
||||
coverHoldSec: bhv.number('coverHoldSec', { min: 0, max: 10 }),
|
||||
repositionHoldSec: bhv.number('repositionHoldSec', { min: 0, max: 10 }),
|
||||
postHoldSec: bhv.number('postHoldSec', { min: 0, max: 10 }),
|
||||
disperseHoldSec: bhv.number('disperseHoldSec', { min: 0, max: 10 }),
|
||||
targetValueWeight: bhv.number('targetValueWeight', { min: 0, max: 1 }),
|
||||
nearThreatHaltBonus: bhv.number('nearThreatHaltBonus', { min: 0, max: 1 }),
|
||||
switchMargin: bhv.number('switchMargin', { min: 0, max: 1 }),
|
||||
advanceScore: bhv.number('advanceScore', { min: 0, max: 1 }),
|
||||
engageScore: bhv.number('engageScore', { min: 0, max: 1 }),
|
||||
@@ -395,9 +403,8 @@ function readBehaviorSection(bhv: TuningReader): GroundAiTuning['behavior'] {
|
||||
hullAngleDeg: bhv.number('hullAngleDeg', { min: 0, max: 45 }),
|
||||
faceToleranceDeg: bhv.number('faceToleranceDeg', { min: 3, max: 60 }),
|
||||
faceMinDanger: bhv.number('faceMinDanger', { min: 0, max: 2 }),
|
||||
faceHaltLimitDeg: bhv.number('faceHaltLimitDeg', { min: 10, max: 180 }),
|
||||
reverseTravelAngleDeg: bhv.number('reverseTravelAngleDeg', { min: 60, max: 180 }),
|
||||
reverseMaxGoalDistM: bhv.number('reverseMaxGoalDistM', { min: 0, max: 2000 }),
|
||||
reverseMaxTurnDistM: bhv.number('reverseMaxTurnDistM', { min: 0, max: 200 }),
|
||||
reverseMinSpeedMps: bhv.number('reverseMinSpeedMps', { min: 0.5, max: 10 }),
|
||||
reverseHoldSec: bhv.number('reverseHoldSec', { min: 0, max: 20 }),
|
||||
};
|
||||
@@ -462,13 +469,18 @@ function readFireControlSection(fc: TuningReader): GroundAiTuning['fireControl']
|
||||
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 }),
|
||||
fleetingLookAheadSec: fc.number('fleetingLookAheadSec', { min: 0.1, max: 2 }),
|
||||
reloadThresholdPenalty: fc.number('reloadThresholdPenalty', { min: 0, max: 0.5 }),
|
||||
longReloadSec: fc.number('longReloadSec', { min: 1, max: 60 }),
|
||||
lowAmmoRounds: fc.int('lowAmmoRounds', { min: 1, max: 60 }),
|
||||
lowAmmoThresholdPenalty: fc.number('lowAmmoThresholdPenalty', { min: 0, max: 0.5 }),
|
||||
aimSkill: fc.number('aimSkill', { min: 0, max: 1 }),
|
||||
autocannonMinShotsPerSec: fc.number('autocannonMinShotsPerSec', { min: 0.5, max: 30 }),
|
||||
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 }),
|
||||
|
||||
@@ -346,24 +346,22 @@
|
||||
"scanPeriodSec": 6.0
|
||||
},
|
||||
|
||||
// Hull channel (decision layer design, section 7). Every scoreIntervalSec (at once when a target
|
||||
// appears or is lost, a reload starts or ends, or the bot is hit) each behavior gets a score and
|
||||
// the best runs; a running one is kept for minHoldSec, then until another scores switchMargin
|
||||
// more. Scores: advance (no target in sight), engage (target in sight; +urgencyWeight when the
|
||||
// order is urgent), halt (the trigger asks to stand for its shot; +urgencyWeight when not urgent,
|
||||
// -crossfirePenalty per extra enemy aiming at the bot), cover (reloading with a known threat;
|
||||
// +coverDangerWeight x danger, -coverOffensivePenalty on an urgent attack, not again for
|
||||
// coverRetrySec after no cover was found), reposition (engagement stuck), hold (at the post,
|
||||
// watching the last exit, waiting at the rally point) and disperse (crowded). Engaging on the
|
||||
// move slows to the speed the trigger asks for; an urgent order keeps urgentSpeedKeep of the
|
||||
// march speed. Medium and heavy tanks and tank destroyers face the most dangerous threat (danger
|
||||
// at least faceMinDanger) angled by hullAngleDeg: holding within faceToleranceDeg, on a short halt
|
||||
// only when more than faceHaltLimitDeg off. With that threat more than reverseTravelAngleDeg off
|
||||
// the direction of travel and the goal within reverseMaxGoalDistM, a vehicle reversing at least
|
||||
// reverseMinSpeedMps drives its route backwards; it switches at most every reverseHoldSec.
|
||||
// Hull channel: choose a behavior by score, holding each for its configured commitment time
|
||||
// unless an emergency or a large score difference interrupts it. A cover withdrawal runs
|
||||
// through its arrival or timeout. A short halt lasts through the weapon's shooting window.
|
||||
// Tracked tanks and tank destroyers face the main threat at the post or during a halt.
|
||||
// They can reverse along a short route segment to keep their front toward that threat.
|
||||
"behavior": {
|
||||
"scoreIntervalSec": 0.5,
|
||||
"minHoldSec": 1.5,
|
||||
"advanceHoldSec": 1.5,
|
||||
"engageHoldSec": 1.5,
|
||||
"haltHoldSec": 3.0,
|
||||
"coverHoldSec": 2.0,
|
||||
"repositionHoldSec": 2.0,
|
||||
"postHoldSec": 1.5,
|
||||
"disperseHoldSec": 1.5,
|
||||
"targetValueWeight": 0.1,
|
||||
"nearThreatHaltBonus": 0.28,
|
||||
"switchMargin": 0.15,
|
||||
"advanceScore": 0.5,
|
||||
"engageScore": 0.55,
|
||||
@@ -381,9 +379,8 @@
|
||||
"hullAngleDeg": 20.0,
|
||||
"faceToleranceDeg": 15.0,
|
||||
"faceMinDanger": 0.15,
|
||||
"faceHaltLimitDeg": 60.0,
|
||||
"reverseTravelAngleDeg": 110.0,
|
||||
"reverseMaxGoalDistM": 200.0,
|
||||
"reverseMaxTurnDistM": 45.0,
|
||||
"reverseMinSpeedMps": 2.5,
|
||||
"reverseHoldSec": 3.0
|
||||
},
|
||||
@@ -396,10 +393,9 @@
|
||||
// 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.
|
||||
// enemyReloadSec after the target fired, and by fleetingThresholdBonus if its estimated motion
|
||||
// will take it out of sight. Longer reloads, scarce ammunition and falling back raise the threshold.
|
||||
// The pre-fire budget limits ballistic checks per frame. Every firing request gets fresh checks.
|
||||
"fireControl": {
|
||||
"maxEngageRangeM": 1250.0,
|
||||
"closeRangeM": 100.0,
|
||||
@@ -407,19 +403,19 @@
|
||||
"longRangeM": 800.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,
|
||||
"longRangeWindowSec": 1.0,
|
||||
// Fixed (casemate) guns: how far off the gun may be before the hull is asked to turn.
|
||||
"baseAlignDeg": 0.42,
|
||||
// Outside close range, the rate at which barrel alignment drifts relative to the aim direction.
|
||||
"barrelSettleDegSec": 1.8,
|
||||
"closeSettleHoldSec": 0.08,
|
||||
"settleHoldSec": 0.20,
|
||||
"aimErrorDeg": 0.12,
|
||||
"closeSettleHoldSec": 0.06,
|
||||
"settleHoldSec": 0.12,
|
||||
"aimErrorDeg": 0.07,
|
||||
"moveErrDegPerMps": 0.35,
|
||||
"turnErrDegPerDegSec": 0.03,
|
||||
"stabErrFactor": 0.2,
|
||||
"targetHalfHeightM": 1.0,
|
||||
"fireThreshold": 0.35,
|
||||
"fireThreshold": 0.45,
|
||||
"minFireThreshold": 0.1,
|
||||
"aimingThresholdBonus": 0.1,
|
||||
"closeThresholdBonus": 0.15,
|
||||
@@ -427,20 +423,23 @@
|
||||
"enemyReloadSec": 3.0,
|
||||
"fleetingThresholdBonus": 0.1,
|
||||
"fleetingLateralMps": 3.0,
|
||||
"bigGunThresholdPenalty": 0.08,
|
||||
"fleetingLookAheadSec": 0.65,
|
||||
"reloadThresholdPenalty": 0.08,
|
||||
"longReloadSec": 15.0,
|
||||
"lowAmmoRounds": 5,
|
||||
"lowAmmoThresholdPenalty": 0.08,
|
||||
"aimSkill": 0.5,
|
||||
"autocannonMinShotsPerSec": 1.5,
|
||||
"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.
|
||||
// Automatic cannons are identified from stock belt and firing-rate data. They fire in bursts
|
||||
// while within the aim slack. A longer wait between rounds 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).
|
||||
// Secondary and coaxial guns have their own aim and ballistic checks. The armor toggle allows
|
||||
// coaxial fire at vehicles outside the light-vehicle filter.
|
||||
"auxWeapons": true,
|
||||
"auxMaxRangeM": 300.0,
|
||||
"auxFireAtArmor": false,
|
||||
|
||||
Reference in new issue
Block a user