feat(battle): wire Simulator EC/SP, Assault PvE, unlimited respawns, and RB/SB bombing zones

- Switch air_simulation_timeDelay_battles to the 15 stock air_i2m Enduring Confrontation missions with unlimited respawns and optionalTakeOff/allowEmptyTeams passthrough.
- Extract warpoints.blk respawn_points/TankSimulation (battle-spawn-rules v5) and enable Spawn Points in Ground Simulator using tuning/battle.jsonc simGroundInitialSpawnScore.
- Fix unlimited respawns for Nuclear Escalation, Air SB EC, and Assault PvE: send -1 for BotSystem numBotRespawns/numTankBotRespawns (verified at 2.61.0.37 0x11b27b1) and explicitly disable multiRespawn so maxRespawns < -1 does not activate Silver Lions respawn-cost gates (0x1268ab0).
- Enable bombing-zone score and reward pricing in Air Realistic (including sub-modes) and Air Simulator in addition to Air Arcade.
- Enable air_assault_pve and tank_assault_pve in BattleMatchmaker: extract PvE import rankRange windows (multiplayer-missions v6), filter by player mrank to prevent low-BR Fulda mismatches, lock local player to Team A, disable autoBalance, emit customBots/wtoPveMode=1, and read Assault team size and wave AI reward multiplier from tuning/.

Verified: root and launcher typecheck, stock .37 dataset/matchmaker/economy checks, and temporary game-copy build; in-game acceptance pending.
This commit is contained in:
N0VAN0M4LY committed 2026-12-06 17:43:25 +08:00
1 parent d73221092d
commit aaae2e4187
15 files changed
+261 -79

No files matched your search

@@ -60,6 +60,26 @@ export function selectBattleCoalitions(input: CoalitionPairingInput): CoalitionP
};
}
/** Single-sided Assault PvE coalition: the player and all friendly AI defenders are always Team A. */
export function selectPveAssaultCoalition(
input: CoalitionPairingInput,
missionEnemyCountry?: string,
): CoalitionPairing {
const playerCountry = stripCountryPrefix(input.playerCountry);
const eligible = eligibleCountriesForBracket(input, playerCountry);
const countriesAllies = placeFirst(shuffle(eligible), playerCountry);
const rawEnemy = missionEnemyCountry ? stripCountryPrefix(missionEnemyCountry) : '';
const enemyCountry = rawEnemy || eligible.find((c) => c !== playerCountry) || playerCountry;
return {
playerTeam: 1,
countryAllies: playerCountry,
countryAxis: enemyCountry,
countriesAllies,
countriesAxis: [enemyCountry],
symmetricTeams: false,
};
}
interface TeamSides {
readonly playerSide: readonly string[];
readonly enemySide: readonly string[];
@@ -17,6 +17,7 @@ export interface BattleEconomyTuning {
readonly captureZoneScore: Readonly<Record<VictimGroup, number>>;
readonly navalDamageScorePerPoint: number;
readonly bombingZone: { readonly damageScore: number; readonly destructionScore: number };
readonly pveAiKillMul: number;
readonly referenceScore: Readonly<Record<VictimGroup, number>>;
readonly friendlyKillPenaltyMul: number;
}
@@ -48,6 +49,7 @@ export function readBattleEconomyTuning(reader: TuningReader): BattleEconomyTuni
damageScore: bombingZone.int('damageScore', { min: 0, max: 100000 }),
destructionScore: bombingZone.int('destructionScore', { min: 0, max: 100000 }),
},
pveAiKillMul: reader.number('pveAiKillMul', { min: 0, max: 10 }),
referenceScore: perGroup('referenceScore', 1),
friendlyKillPenaltyMul: reader.number('friendlyKillPenaltyMul', { min: 0, max: 100 }),
};
+24 -6
View File
@@ -37,6 +37,19 @@ export type DebriefingRow =
/** LocalMP reports mini-base health as basis points (local_mp_zones.c). */
const ZONE_HEALTH_SCALE = 10_000;
/** Modes that award bombing-zone damage and destruction (Air AB, Air RB / sub-modes, Air SB EC). */
const BOMBING_ZONE_MODES: ReadonlySet<string> = new Set([
'air_arcade',
'air_realistic',
'air_simulation_timeDelay_battles',
]);
/** Assault PvE modes where wave enemies are non-MPlayer mission AI units. */
const PVE_ASSAULT_MODES: ReadonlySet<string> = new Set([
'air_assault_pve',
'tank_assault_pve',
]);
function isBombingZoneEvent(code: number): boolean {
return code === ExpEvent.DAMAGE_ZONE || code === ExpEvent.DESTROY_ZONE;
}
@@ -145,7 +158,7 @@ export class BattleEconomy {
const isCapture = fact.code === ExpEvent.CAPTURE_ZONE;
const isBombingZone = isBombingZoneEvent(fact.code);
const isZoneDamage = fact.code === ExpEvent.DAMAGE_ZONE;
if (isBombingZone && (modeName !== 'air_arcade' || fact.friendly)) return undefined;
if (isBombingZone && (!BOMBING_ZONE_MODES.has(modeName) || fact.friendly)) return undefined;
if (isZoneDamage && (!Number.isInteger(fact.damage) || fact.damage < 1 || fact.damage > ZONE_HEALTH_SCALE)) return undefined;
const isObjective = isCapture || isBombingZone;
const group = isBombingZone ? 'ground' : this.victimGroup(isCapture ? economy.unitClass : fact.expClass);
@@ -154,7 +167,7 @@ export class BattleEconomy {
if (!row || !base) return undefined;
const count = fact.code === ExpEvent.UNIT_DAMAGE ? Math.max(0, Math.trunc(fact.damage)) : 1;
const quantity = isZoneDamage ? fact.damage / ZONE_HEALTH_SCALE : count;
const ai = isObjective || fact.victimIsPlayer ? 1 : this.data.aiKillK;
const ai = isObjective || fact.victimIsPlayer ? 1 : this.#aiKillMul(modeName);
const slClass = isObjective ? 1 : this.data.silverLionsClassFactors[fact.expClass] ?? 1;
const rpClass = isObjective ? 1 : this.data.researchClassFactors[fact.expClass] ?? 1;
if (fact.friendly) {
@@ -170,13 +183,14 @@ export class BattleEconomy {
bannerParams(vehicles: Iterable<string>, difficulty: EconomyDifficulty, modeName: string): BannerParams {
const table: Record<string, Record<string, [number, number]>> = {};
const allowBombingZone = BOMBING_ZONE_MODES.has(modeName);
for (const name of vehicles) {
const economy = this.vehicle(name);
if (!economy || table[name]) continue;
const entries: Record<string, [number, number]> = {};
for (const code of Object.values(ExpEvent)) {
const isBombingZone = isBombingZoneEvent(code);
if (isBombingZone && modeName !== 'air_arcade') continue;
if (isBombingZone && !allowBombingZone) continue;
const groups: readonly (VictimGroup | 'own')[] = code === ExpEvent.CAPTURE_ZONE ? ['own']
: isBombingZone ? ['ground'] : VICTIM_GROUPS;
for (const group of groups) {
@@ -192,7 +206,7 @@ export class BattleEconomy {
groups: Object.fromEntries(this.#tuning.victimGroups),
slClass: this.data.silverLionsClassFactors,
rpClass: this.data.researchClassFactors,
aiKillK: this.data.aiKillK,
aiKillK: this.#aiKillMul(modeName),
friendlyKillPenaltyMul: this.#tuning.friendlyKillPenaltyMul,
zoneHealthScale: ZONE_HEALTH_SCALE,
};
@@ -211,14 +225,18 @@ export class BattleEconomy {
scores[`wtoScore_capture_${group}`] = this.#tuning.captureZoneScore[group];
}
scores.wtoScore_damagePerPoint = this.#tuning.navalDamageScorePerPoint;
scores.wtoScore_aiMul = this.data.aiKillK;
if (modeName === 'air_arcade') {
scores.wtoScore_aiMul = this.#aiKillMul(modeName);
if (BOMBING_ZONE_MODES.has(modeName)) {
scores.wtoScore_zoneDamage = this.#tuning.bombingZone.damageScore;
scores.wtoScore_zoneDestruction = this.#tuning.bombingZone.destructionScore;
}
return scores;
}
#aiKillMul(modeName: string): number {
return PVE_ASSAULT_MODES.has(modeName) ? this.#tuning.pveAiKillMul : this.data.aiKillK;
}
#score(code: number, group: VictimGroup): number | undefined {
const scored = (event: ScoredEvent): number => this.#tuning.eventScores[group][event];
switch (code) {
+56 -50
View File
@@ -12,8 +12,15 @@ import type { CatalogueVehicle } from '../game-data/datasets/vehicle-catalogue.t
import type { GameModes, OfferedGameMode } from '../game-modes/game-modes.ts';
import { MISSION_DIFFICULTY, SINGLE_SPAWN, UNLIMITED_RESPAWNS, modeMaxRespawns } from '../game-modes/mode-definition.ts';
import { serverTimeNow, serverTimeToUnixSeconds } from '../profile/server-time.ts';
import { selectBattleCoalitions, type CoalitionPairing } from './battle-coalitions.ts';
import { selectBattleCoalitions, selectPveAssaultCoalition, type CoalitionPairing } from './battle-coalitions.ts';
import { selectExtraBattleSlots, type ExtraBattleSlot } from './battle-extra-slots.ts';
import {
eligibleMissionsOf,
isSupportedPveMode,
maxSlotsForMission,
pickMission,
resolveMissionLocName,
} from './battle-mission-pick.ts';
import {
activeVehiclesForMode,
isModeEligibleForLineup,
@@ -28,6 +35,9 @@ import type { BotAircraftLoadout } from './bot-aircraft-loadouts.ts';
import type { BotTankLoadout } from './bot-tank-loadouts.ts';
import type { BattleTuning } from './battle-tuning.ts';
/** BotSystem (`aces.exe 2.61.0.37 0x11b27b1`) treats -1 as unlimited bot respawns. */
const BOT_UNLIMITED_RESPAWNS = -1;
export interface BattleCrewSlot {
readonly idInCountry: number;
readonly unitName: string;
@@ -68,6 +78,7 @@ export interface BattleLaunchPlan {
readonly countriesAllies: readonly string[];
readonly countriesAxis: readonly string[];
readonly symmetricTeams: boolean;
readonly isPve: boolean;
readonly minMrank: number;
readonly maxMrank: number;
readonly maxPlayers: number;
@@ -139,14 +150,17 @@ export class BattleMatchmaker {
if (!knownCountries.includes(input.country)) return { ok: false, error: 'BAD_PARAMS' };
const candidates = input.modes && input.modes.length > 0 ? input.modes : [input.mode];
const pvpModes = candidates.filter(
(mode) => mode.declaration.displayType !== 'pve_battle' && twoSidedMissionsOf(mode).length > 0,
const supportedModes = candidates.filter((mode) =>
isSupportedPveMode(mode)
? eligibleMissionsOf(mode).length > 0
: mode.declaration.displayType !== 'pve_battle' && eligibleMissionsOf(mode).length > 0,
);
if (pvpModes.length === 0) return { ok: false, error: 'PVE_NOT_SUPPORTED' };
const chosenMode = this.#pickQueuedMode(pvpModes, input);
if (supportedModes.length === 0) return { ok: false, error: 'PVE_NOT_SUPPORTED' };
const chosenMode = this.#pickQueuedMode(supportedModes, input);
if (!chosenMode) return { ok: false, error: 'BAD_PARAMS' };
const { declaration } = chosenMode;
const isPve = isSupportedPveMode(chosenMode);
const activeVehicles = activeVehiclesForMode(declaration, input.slotVehicles, input.selectedSlot?.unitName, this.#vehiclesByName);
const playerMrank = lineupMrank(
activeVehicles, this.#vehiclesByName, declaration.difficulty, declaration.requiredClass, declaration.allowedClasses,
@@ -155,7 +169,7 @@ export class BattleMatchmaker {
const minMrank = Math.max(declaration.minQueueMrank ?? 0, playerMrank - this.#tuning.brSpreadMrank);
const roomCeiling = chosenMode.missionRanks?.maxMrank ?? Infinity;
const maxMrank = Math.max(minMrank, playerMrank, Math.min(roomCeiling, playerMrank + this.#tuning.brSpreadMrank));
const rawMissions = twoSidedMissionsOf(chosenMode, maxMrank);
const rawMissions = eligibleMissionsOf(chosenMode, isPve ? playerMrank : maxMrank);
if (rawMissions.length === 0) return { ok: false, error: 'NO_MISSION_FOR_BR' };
const filteredMissions = this.#filterMissions
? this.#filterMissions({
@@ -170,7 +184,7 @@ export class BattleMatchmaker {
: rawMissions;
const missions = filteredMissions.length > 0 ? filteredMissions : rawMissions;
const mission = pickMission(missions, input.bannedMissions, input.dislikedMissions);
const coalitions = selectBattleCoalitions({
const coalitionInput = {
vehicles: this.#vehicles,
knownCountries,
playerCountry: input.country,
@@ -180,12 +194,15 @@ export class BattleMatchmaker {
minMrank,
maxMrank,
tuning: this.#tuning,
});
};
const coalitions = isPve
? selectPveAssaultCoalition(coalitionInput, mission.countryAxis)
: selectBattleCoalitions(coalitionInput);
const customBots = selectCustomBots(this.#vehicles, {
difficulty: declaration.difficulty,
requiredClass: declaration.requiredClass,
allowedClasses: declaration.allowedClasses,
countries: [...coalitions.countriesAllies, ...coalitions.countriesAxis],
countries: isPve ? coalitions.countriesAllies : [...coalitions.countriesAllies, ...coalitions.countriesAxis],
centerMrank: playerMrank,
minMrank,
maxMrank,
@@ -193,7 +210,7 @@ export class BattleMatchmaker {
}, declaration.allowBotAircraftLoadouts === false ? undefined : this.#aircraftLoadouts, this.#tankWeights, this.#tankLoadouts);
return {
ok: true,
launch: this.#buildLaunchPlan(input, chosenMode, mission, coalitions, playerMrank, minMrank, maxMrank, customBots),
launch: this.#buildLaunchPlan(input, chosenMode, mission, coalitions, playerMrank, minMrank, maxMrank, customBots, isPve),
};
}
@@ -221,12 +238,18 @@ export class BattleMatchmaker {
minMrank: number,
maxMrank: number,
customBots: CustomBotsPool,
isPve: boolean,
): BattleLaunchPlan {
const { declaration } = chosenMode;
const desiredPlayers = declaration.isSmallTeams ? this.#tuning.smallTeamsMaxPlayers : this.#tuning.maxPlayers;
const maxPlayers = Math.min(desiredPlayers, maxSlotsForMission(mission, desiredPlayers));
const maxBots = Math.min(this.#tuning.maxBots, Math.max(1, maxPlayers - 1));
const desiredPlayers = isPve
? this.#tuning.pveAssaultMaxPlayers
: declaration.isSmallTeams ? this.#tuning.smallTeamsMaxPlayers : this.#tuning.maxPlayers;
const maxPlayers = Math.min(desiredPlayers, maxSlotsForMission(mission, desiredPlayers, isPve));
const maxBots = isPve
? Math.min(this.#tuning.pveAssaultMaxBots, Math.max(0, maxPlayers - 1))
: Math.min(this.#tuning.maxBots, Math.max(1, maxPlayers - 1));
const maxRespawns = modeMaxRespawns(declaration);
const unlimitedRespawns = maxRespawns === UNLIMITED_RESPAWNS;
const missionLocName = resolveMissionLocName(mission);
const environment = declaration.environmentOverride ?? mission.environment;
const session = this.#sessions.create({
@@ -255,7 +278,10 @@ export class BattleMatchmaker {
rules: this.#spawnRules,
tuning: this.#tuning,
});
const useSpawnScore = declaration.requiredClass === 'tank' && declaration.difficulty === 'realistic';
const spawnScoreDifficulty = declaration.requiredClass === 'tank'
&& (declaration.difficulty === 'realistic' || declaration.difficulty === 'simulator')
? declaration.difficulty : undefined;
const useSpawnScore = spawnScoreDifficulty !== undefined;
return {
sessionId: session.sessionId,
modeId: declaration.gameModeId,
@@ -278,19 +304,30 @@ export class BattleMatchmaker {
countriesAllies: coalitions.countriesAllies,
countriesAxis: coalitions.countriesAxis,
symmetricTeams: coalitions.symmetricTeams,
isPve,
minMrank,
maxMrank,
maxPlayers,
maxBots,
allowSpares: declaration.multiSlot !== false && maxRespawns !== SINGLE_SPAWN && maxRespawns !== UNLIMITED_RESPAWNS,
allowSpares: declaration.multiSlot !== false && maxRespawns !== SINGLE_SPAWN && !unlimitedRespawns,
...(maxRespawns === undefined ? {} : { maxRespawns }),
tankBotRespawns: this.#tuning.tankBotRespawns,
airBotRespawns: declaration.multiSlot === false ? SINGLE_SPAWN : this.#tuning.airBotRespawns,
tankBotRespawns: unlimitedRespawns ? BOT_UNLIMITED_RESPAWNS : this.#tuning.tankBotRespawns,
airBotRespawns: unlimitedRespawns
? BOT_UNLIMITED_RESPAWNS
: declaration.multiSlot === false ? SINGLE_SPAWN : this.#tuning.airBotRespawns,
useTankBots: allowedSet.has('tank'),
useShipBots: allowedSet.has('ship'),
useSpawnScore,
...(useSpawnScore ? {
spawnScore: battleSpawnScore(input.slotVehicles, extraBattleSlots, maxMrank, this.#vehiclesByName, this.#spawnRules.spawnScore),
...(spawnScoreDifficulty ? {
spawnScore: battleSpawnScore(
input.slotVehicles,
extraBattleSlots,
maxMrank,
this.#vehiclesByName,
this.#spawnRules.spawnScore,
spawnScoreDifficulty,
spawnScoreDifficulty === 'simulator' ? this.#tuning.simGroundInitialSpawnScore : undefined,
),
} : {}),
customBots,
...(declaration.multiSlot === false && input.selectedSlot ? { selectedSlot: input.selectedSlot } : {}),
@@ -298,34 +335,3 @@ export class BattleMatchmaker {
};
}
}
function twoSidedMissionsOf(mode: OfferedGameMode, roomMrank?: number): MissionHeader[] {
return mode.missions.filter((mission) => {
if (mission.playerSlots.teamA === 0 || mission.playerSlots.teamB === 0) return false;
if (!mode.missionRanks || roomMrank === undefined) return true;
return mode.missionRanks.byMission.get(mission.name)?.some(({ minMRank, maxMRank }) =>
roomMrank >= minMRank && roomMrank <= maxMRank);
});
}
function pickMission(missions: readonly MissionHeader[], banned: ReadonlySet<string>, disliked: ReadonlySet<string>): MissionHeader {
const unbanned = missions.filter((mission) => !banned.has(mission.name));
const poolAfterBan = unbanned.length > 0 ? unbanned : missions;
const preferred = poolAfterBan.filter((mission) => !disliked.has(mission.name));
const pool = preferred.length > 0 ? preferred : poolAfterBan;
return pool[randomInt(pool.length)]!;
}
function maxSlotsForMission(mission: MissionHeader, desiredMaxPlayers: number): number {
const { teamA, teamB } = mission.playerSlots;
return Math.max(2, Math.min(desiredMaxPlayers, Math.min(teamA, teamB) * 2));
}
function resolveMissionLocName(mission: MissionHeader): string | undefined {
if (mission.locName && mission.locName.length > 0) return mission.locName;
if (mission.postfix && mission.postfix.length > 0 && mission.name.endsWith(mission.postfix)) {
const baseName = mission.name.slice(0, -mission.postfix.length);
if (baseName.length > 0) return `missions/${mission.postfix};missions/${baseName}`;
}
return undefined;
}
@@ -0,0 +1,59 @@
/**
* Mission eligibility, random mission picking (honoring bans/dislikes), slot-capacity limits,
* and mission localization name fallback for BattleMatchmaker.
*/
import { randomInt } from 'node:crypto';
import type { MissionHeader } from '../game-data/datasets/multiplayer-missions.ts';
import type { OfferedGameMode } from '../game-modes/game-modes.ts';
/** PvE modes wired for single-sided LocalMP Assault survival. */
const SUPPORTED_PVE_MODES: ReadonlySet<string> = new Set([
'air_assault_pve',
'tank_assault_pve',
]);
export function isSupportedPveMode(mode: OfferedGameMode): boolean {
return mode.declaration.displayType === 'pve_battle' && SUPPORTED_PVE_MODES.has(mode.declaration.name);
}
export function eligibleMissionsOf(mode: OfferedGameMode, roomMrank?: number): MissionHeader[] {
const isPve = isSupportedPveMode(mode);
return mode.missions.filter((mission) => {
if (isPve) {
if (mission.playerSlots.teamA === 0) return false;
if (roomMrank === undefined || !mission.pveRankRanges?.length) return true;
return mission.pveRankRanges.some(({ minMRank, maxMRank }) => roomMrank >= minMRank && roomMrank <= maxMRank);
}
if (mission.playerSlots.teamA === 0 || mission.playerSlots.teamB === 0) return false;
if (!mode.missionRanks || roomMrank === undefined) return true;
return mode.missionRanks.byMission.get(mission.name)?.some(({ minMRank, maxMRank }) =>
roomMrank >= minMRank && roomMrank <= maxMRank);
});
}
export function pickMission(
missions: readonly MissionHeader[],
banned: ReadonlySet<string>,
disliked: ReadonlySet<string>,
): MissionHeader {
const unbanned = missions.filter((mission) => !banned.has(mission.name));
const poolAfterBan = unbanned.length > 0 ? unbanned : missions;
const preferred = poolAfterBan.filter((mission) => !disliked.has(mission.name));
const pool = preferred.length > 0 ? preferred : poolAfterBan;
return pool[randomInt(pool.length)]!;
}
export function maxSlotsForMission(mission: MissionHeader, desiredMaxPlayers: number, isPve: boolean): number {
const { teamA, teamB } = mission.playerSlots;
if (isPve) return Math.max(1, Math.min(desiredMaxPlayers, teamA));
return Math.max(2, Math.min(desiredMaxPlayers, Math.min(teamA, teamB) * 2));
}
export function resolveMissionLocName(mission: MissionHeader): string | undefined {
if (mission.locName && mission.locName.length > 0) return mission.locName;
if (mission.postfix && mission.postfix.length > 0 && mission.name.endsWith(mission.postfix)) {
const baseName = mission.name.slice(0, -mission.postfix.length);
if (baseName.length > 0) return `missions/${mission.postfix};missions/${baseName}`;
}
return undefined;
}
@@ -23,13 +23,13 @@ const RULE_KEYS: readonly string[] = [
'scoreLimit', 'timeLimit', 'killLimit', 'deathPenaltyMul',
'ctaCaptureZoneEqualPenaltyMul', 'ctaCaptureZonePenaltyMul', 'captureZonePenaltyMul', 'scorePerSec',
'ctaInstantDecreaseTicketsWhenNoRespawn', 'randomSpawnTeams', 'remapAiTankModels', 'useAlternativeMapCoord',
'allowedKillStreaks',
'allowedKillStreaks', 'allowEmptyTeams', 'gt_reload_explosives', 'optionalTakeOff', 'nameKillStreaks',
];
/** Game type switches of a versus battle with tickets, capture zones and session rewards. */
const VERSUS_SWITCHES: readonly string[] = [
'gt_versus', 'gt_mp_tickets', 'gt_mp_capture', 'gt_use_wp', 'gt_use_xp', 'gt_use_stats', 'gt_use_unlocks',
'allowUseArtillerySupport', 'isBotsAllowed', 'autoBalance',
'allowUseArtillerySupport', 'isBotsAllowed',
];
/**
@@ -68,10 +68,15 @@ export function battleMissionSettings(plan: BattleLaunchPlan, scores: Readonly<R
setParam(settings, 'symmetricTeams', flag(plan.symmetricTeams));
setParam(settings, 'gt_mp_solo', flag(false));
for (const name of VERSUS_SWITCHES) setParam(settings, name, flag(true));
setParam(settings, 'autoBalance', flag(!plan.isPve));
if (plan.isPve) setParam(settings, 'allowEmptyTeams', flag(true));
// The native in-flight rearm request and its receiver both require unlimited reserve ammunition.
setParam(settings, 'isLimitedAmmo', flag(plan.modeName !== 'air_arcade'));
setParam(settings, 'isLimitedAmmo', flag(plan.modeName !== 'air_arcade' && plan.modeName !== 'air_assault_pve'));
// MissionSettings defaults isLimitedFuel to false, which disables fuel consumption and HUD timers.
setParam(settings, 'isLimitedFuel', flag(true));
// MissionSettings::load (0x1268ab0) defaults multiRespawn to true whenever maxRespawns < -1,
// which turns on Silver Lions respawn-cost checks; keep offline unlimited respawns free.
setParam(settings, 'multiRespawn', flag(false));
setParam(settings, 'allowSpare', flag(plan.allowSpares));
if (plan.maxRespawns !== undefined) setParam(settings, 'maxRespawns', integer(plan.maxRespawns));
if (plan.selectedSlot) {
@@ -133,6 +138,7 @@ function customBotsBlock(plan: BattleLaunchPlan): BlkBlock {
if (plan.mission.groundMode !== undefined) setParam(bots, 'wtoGroundMode', text(plan.mission.groundMode));
// The battle's level file: the ground AI loads its navigation pack by this name (native local_mp_nav.c).
if (plan.level !== undefined) setParam(bots, 'wtoLevel', text(plan.level));
if (plan.isPve) setParam(bots, 'wtoPveMode', text('1'));
if (plan.maxRespawns === UNLIMITED_RESPAWNS) setParam(bots, 'wtoUnlimitedRespawns', text('1'));
setParam(bots, 'numBotRespawnsInMultiSlot', integer(plan.airBotRespawns));
setParam(bots, 'numTankBotRespawnsInMultiSlot', integer(plan.tankBotRespawns));
+10 -5
View File
@@ -7,6 +7,7 @@
*/
import type { SpawnScoreRules } from '../game-data/datasets/battle-spawn-rules.ts';
import type { CatalogueVehicle } from '../game-data/datasets/vehicle-catalogue.ts';
import type { ModeDifficulty } from '../game-modes/catalogue/game-mode-declaration.ts';
import { vehicleTypeOfClass, type VehicleType } from '../research/vehicle-types.ts';
import type { ExtraBattleSlot } from './battle-extra-slots.ts';
import { vehicleMrank } from './battle-ranks.ts';
@@ -33,17 +34,21 @@ export function battleSpawnScore(
sessionMaxMrank: number,
vehicles: ReadonlyMap<string, CatalogueVehicle>,
rules: SpawnScoreRules,
difficulty: Extract<ModeDifficulty, 'realistic' | 'simulator'> = 'realistic',
initialScoreOverride?: number,
): BattleSpawnScore {
const override = rules.overrides.find(({ minMrank, maxMrank }) => sessionMaxMrank >= minMrank && sessionMaxMrank <= maxMrank);
const modeRules = difficulty === 'simulator' ? rules.tankSimulation : rules.tankHistorical;
const modeOverrides = difficulty === 'simulator' ? rules.tankSimulationOverrides : rules.overrides;
const override = modeOverrides.find(({ minMrank, maxMrank }) => sessionMaxMrank >= minMrank && sessionMaxMrank <= maxMrank);
const params = {
...rules.common,
...rules.tankHistorical.classCosts,
...rules.tankHistorical.parameters,
...modeRules.classCosts,
...modeRules.parameters,
...override?.classCosts,
...override?.parameters,
};
const base = params.base_respawn_points_coef ?? 450;
const maxScore = Math.max(0, Math.round(base * (params.maxRespawnPointsMul ?? 1)));
const maxScore = initialScoreOverride ?? Math.max(0, Math.round(base * (params.maxRespawnPointsMul ?? 1)));
const maxBrDiff = params.max_br_diff ?? 1;
const sessionBr = battleRating(sessionMaxMrank);
const unitCosts: Record<string, number> = {};
@@ -58,7 +63,7 @@ export function battleSpawnScore(
}
const type = vehicleTypeOfClass(unitClass);
const spawnType = unitClass === 'exp_ai_sam_tracking_radar' ? 'Tank' : type ? SPAWN_TYPES[type] : 'Invalid';
const rank = vehicle ? vehicleMrank(vehicle, 'realistic', 'tank') : sessionMaxMrank;
const rank = vehicle ? vehicleMrank(vehicle, difficulty, 'tank') : sessionMaxMrank;
const brDiff = Math.min(Math.max(0, sessionBr - battleRating(rank)), maxBrDiff);
const discount = maxBrDiff > 0 ? (params[`br_diff_mul_${spawnType}`] ?? 0) * brDiff / maxBrDiff : 0;
unitCosts[unit] = Math.max(1, Math.round(base * multiplier * (1 - discount) / 10) * 10);
+8
View File
@@ -21,6 +21,9 @@ export interface BattleTuning {
readonly rbAirMixedChance: number;
readonly rbNavalMixedChance: number;
readonly simColdWarMinMrank: number;
readonly simGroundInitialSpawnScore: number;
readonly pveAssaultMaxPlayers: number;
readonly pveAssaultMaxBots: number;
readonly strikeUcavModes: readonly string[];
readonly strikeUcavSessionMrankAllowance: number;
readonly strikeUcavSpawnScore: number;
@@ -46,6 +49,8 @@ export function readBattleTuning(reader: TuningReader): BattleTuning {
`tuning file battle.jsonc: rbCoalitionMaxCountries (${rbCoalitionMaxCountries}) must be at least rbCoalitionMinCountries (${rbCoalitionMinCountries})`,
);
}
const pveAssaultMaxPlayers = reader.int('pveAssaultMaxPlayers', { min: 1, max: 32 });
const pveAssaultMaxBots = Math.min(reader.int('pveAssaultMaxBots', { min: 0, max: 31 }), Math.max(0, pveAssaultMaxPlayers - 1));
return {
rewardMultiplierSilverLions: reader.number('rewardMultiplierSilverLions', { min: 0, max: 100 }),
rewardMultiplierResearchPoints: reader.number('rewardMultiplierResearchPoints', { min: 0, max: 100 }),
@@ -62,6 +67,9 @@ export function readBattleTuning(reader: TuningReader): BattleTuning {
rbAirMixedChance: reader.number('rbAirMixedChance', { min: 0, max: 1 }),
rbNavalMixedChance: reader.number('rbNavalMixedChance', { min: 0, max: 1 }),
simColdWarMinMrank: reader.int('simColdWarMinMrank', { min: 0, max: 40 }),
simGroundInitialSpawnScore: reader.int('simGroundInitialSpawnScore', { min: 100, max: 5000 }),
pveAssaultMaxPlayers,
pveAssaultMaxBots,
strikeUcavModes: reader.stringList('strikeUcavModes'),
strikeUcavSessionMrankAllowance: reader.int('strikeUcavSessionMrankAllowance', { min: 0, max: 12 }),
strikeUcavSpawnScore: reader.int('strikeUcavSpawnScore', { min: 1, max: 10000 }),
@@ -77,13 +77,17 @@ interface SpawnScoreParameterSet {
readonly classCosts: Readonly<Record<string, number>>;
}
export interface SpawnScoreRankOverride extends SpawnScoreParameterSet {
readonly minMrank: number;
readonly maxMrank: number;
}
export interface SpawnScoreRules {
readonly common: Readonly<Record<string, number>>;
readonly tankHistorical: SpawnScoreParameterSet;
readonly overrides: ReadonlyArray<SpawnScoreParameterSet & {
readonly minMrank: number;
readonly maxMrank: number;
}>;
readonly overrides: readonly SpawnScoreRankOverride[];
readonly tankSimulation: SpawnScoreParameterSet;
readonly tankSimulationOverrides: readonly SpawnScoreRankOverride[];
}
export interface BattleSpawnRulesData {
@@ -106,7 +110,7 @@ const STRATEGIC_YIELD_MIN_KT = 1000;
export const battleSpawnRules: Dataset<BattleSpawnRulesData> = {
id: 'battle-spawn-rules',
version: 4,
version: 5,
extract: (source) => {
const gameplay = source.readBlk('aces.vromfs.bin', 'config/gameplay.blk');
const wpcost = source.readBlk('char.vromfs.bin', 'config/wpcost.blk');
@@ -123,17 +127,24 @@ export const battleSpawnRules: Dataset<BattleSpawnRulesData> = {
function extractSpawnScore(root: BlkBlock | undefined): SpawnScoreRules {
const tankHistorical = blockAt(root, 'TankHistorical');
const tankSimulation = blockAt(root, 'TankSimulation');
return {
common: numericParams(root),
tankHistorical: spawnScoreParams(tankHistorical),
overrides: (blockAt(tankHistorical, 'override_params_by_session_rank')?.blocks ?? []).map((block) => ({
...spawnScoreParams(block),
minMrank: numberField(block, 'minMRank') ?? -1,
maxMrank: numberField(block, 'maxMRank') ?? -1,
})),
overrides: extractRankOverrides(tankHistorical),
tankSimulation: spawnScoreParams(tankSimulation),
tankSimulationOverrides: extractRankOverrides(tankSimulation),
};
}
function extractRankOverrides(block: BlkBlock | undefined): SpawnScoreRankOverride[] {
return (blockAt(block, 'override_params_by_session_rank')?.blocks ?? []).map((entry) => ({
...spawnScoreParams(entry),
minMrank: numberField(entry, 'minMRank') ?? -1,
maxMrank: numberField(entry, 'maxMRank') ?? -1,
}));
}
function spawnScoreParams(block: BlkBlock | undefined): SpawnScoreParameterSet {
return {
parameters: numericParams(block),
@@ -21,6 +21,7 @@ const MISSION_LIST = 'config/mislist.blk';
const MULTIPLAYER_SECTION = 'skirmish';
const MISSION_FOLDER = 'gamedata/missions/';
export const AIR_HISTORICAL_MISSION_FOLDER = 'gamedata/missions/cta/planes/historical/';
const PVE_MISSION_FOLDER = 'gamedata/missions/pve_missions/';
const AIRFIELD_LAYOUT = /\/template_airfields_(low|mid|high|top)_ranks\.blk$/;
export interface MissionCategory {
@@ -43,9 +44,16 @@ interface AirfieldLayoutData {
export type GroundBattleMode = 'bttl' | 'conq' | 'dom';
export interface MissionRankBand {
readonly minMRank: number;
readonly maxMRank: number;
}
export interface MissionHeader extends AirfieldLayoutData {
readonly name: string;
readonly path: string;
/** Ranked preset import windows declared by PvE survival missions (`imports.import_record.rankRange`). */
readonly pveRankRanges?: readonly MissionRankBand[];
/** Ground mission tactical layout derived from mislist category (or suffix fallback for events). */
readonly groundMode?: GroundBattleMode;
readonly level?: string;
@@ -76,7 +84,7 @@ export interface MultiplayerMissions {
export const multiplayerMissions: Dataset<MultiplayerMissions> = {
id: 'multiplayer-missions',
version: 5,
version: 6,
extract(source: DatasetSource): MultiplayerMissions {
const section = blockAt(source.readBlk('char.vromfs.bin', MISSION_LIST), MULTIPLAYER_SECTION);
if (!section) throw new Error(`${MISSION_LIST} has no "${MULTIPLAYER_SECTION}" block`);
@@ -157,9 +165,11 @@ function readHeader(
countryAllies: stringField(mission, 'country_allies'),
timeLimit: numberField(mission, 'timeLimit'),
};
const pveRankRanges = path.startsWith(PVE_MISSION_FOLDER) ? readImportRankRanges(document) : [];
return {
name,
path,
...(pveRankRanges.length > 0 ? { pveRankRanges } : {}),
...airfields,
...Object.fromEntries(Object.entries(optional).filter(([, value]) => value !== undefined)),
allowedUnitTypes: boolFields(blockAt(mission, 'allowedUnitTypes')),
@@ -214,6 +224,17 @@ function readAirfieldPart(source: DatasetSource, path: string, knownPaths: Reado
return { airfieldLayouts };
}
function readImportRankRanges(mission: BlkBlock): MissionRankBand[] {
const ranges: MissionRankBand[] = [];
for (const entry of blockAt(mission, 'imports')?.blocks ?? []) {
const range = findParam(entry, 'rankRange')?.value;
if (range?.type === 'ipoint2' && range.value[0] >= 0 && range.value[1] >= range.value[0]) {
ranges.push({ minMRank: range.value[0], maxMRank: range.value[1] });
}
}
return ranges;
}
const SCALAR_TYPES = new Set(['string', 'int', 'real', 'bool']);
/** The parameters whose values survive the dataset cache's JSON unchanged. */
@@ -23,6 +23,12 @@ export const AIR_REALISTIC_MISSIONS: MissionSelection = {
rankByAirfieldLayout: true,
};
export const AIR_EC_MISSIONS: MissionSelection = {
categories: ['air_i2m'],
requireAllowed: ['aircraft'],
exclude: NEWBIE_MISSIONS,
};
export const GROUND_BATTLE_MISSIONS: MissionSelection = {
categories: ['air_ground_Dom', 'air_ground_Conq', 'air_ground_Bttl'],
requireAllowed: ['tank'],
@@ -9,6 +9,7 @@
* (they do not state their vehicle types, so none is required of them);
* - helicopters: the "air_h2m" category (helicopter PvE missions).
*/
import { UNLIMITED_RESPAWNS } from '../mode-definition.ts';
import type { GameModeDeclaration } from './game-mode-declaration.ts';
const PVE = { difficulty: 'arcade', displayType: 'pve_battle' } as const;
@@ -16,11 +17,13 @@ const PVE = { difficulty: 'arcade', displayType: 'pve_battle' } as const;
export const PVE_BATTLES: readonly GameModeDeclaration[] = [
{
gameModeId: 21, name: 'air_assault_pve', economicName: 'air_assault_pve', locName: 'chapters/assault', ...PVE,
maxRespawns: UNLIMITED_RESPAWNS,
requiredClass: 'aircraft', allowedClasses: ['aircraft'],
missions: { categories: ['pve'], requireAllowed: ['aircraft'], include: /_survive_arcade_pve$/i },
},
{
gameModeId: 22, name: 'tank_assault_pve', economicName: 'tank_assault_pve', locName: 'chapters/air_ground_PvE', ...PVE,
maxRespawns: UNLIMITED_RESPAWNS,
requiredClass: 'tank', allowedClasses: ['tank'],
missions: { categories: ['pve'], requireAllowed: [], include: /battle_for_survival_8_players_pve$/i },
},
@@ -9,8 +9,9 @@
* display text "missions/ship_event_simulator". The ground economic name is the rank.blk
* ExpSkillBonus{} key (see random-battles.ts).
*/
import { UNLIMITED_RESPAWNS } from '../mode-definition.ts';
import type { GameModeDeclaration } from './game-mode-declaration.ts';
import { AIR_BATTLE_MISSIONS, GROUND_BATTLE_MISSIONS, NAVAL_BATTLE_MISSIONS } from './mission-pools.ts';
import { AIR_EC_MISSIONS, GROUND_BATTLE_MISSIONS, NAVAL_BATTLE_MISSIONS } from './mission-pools.ts';
const SIMULATOR = { difficulty: 'simulator', displayType: 'regular', chapter: 'simulation_battles' } as const;
@@ -18,7 +19,8 @@ export const SIMULATOR_BATTLES: readonly GameModeDeclaration[] = [
{
gameModeId: 11, name: 'air_simulation_timeDelay_battles', economicName: 'air_simulation_timeDelay_battles',
locName: 'missions/air_simulation_timeDelay_battles', ...SIMULATOR,
requiredClass: 'aircraft', allowedClasses: ['aircraft'], missions: AIR_BATTLE_MISSIONS,
maxRespawns: UNLIMITED_RESPAWNS,
requiredClass: 'aircraft', allowedClasses: ['aircraft'], missions: AIR_EC_MISSIONS,
},
{
gameModeId: 12, name: 'tank_random_battles_simulation', economicName: 'tank_event_in_random_battles_simulation',
+7 -2
View File
@@ -49,10 +49,15 @@
// Naval mission score per point of damage dealt: official ("0.15 -> 0.18", same update).
"navalDamageScorePerPoint": 0.18,
// Offline Air Arcade balance. Damage pays proportionally to health removed from an enemy
// mini-base. The final hit also earns the destruction score.
// Offline bombing-zone balance (Air Arcade, Air Realistic, and Air Simulator). Damage pays
// proportionally to health removed from an enemy mini-base. The final hit also earns the
// destruction score.
"bombingZone": { "damageScore": 150, "destructionScore": 30 },
// Assault PvE reward/score multiplier for mission wave AI units (offline: overrides stock
// PvP warpoints.blk aiKillK=0.3 so Assault wave kills pay full baseline value).
"pveAiKillMul": 1.0,
// The score at which an event pays exactly one reference kill (warpoints.blk aKill), by victim
// group. ground 180 and air 450 are the official base kill scores; naval 216 is the official
// example of a boat destruction ("now awarded with 216 points instead of 180").
+10
View File
@@ -36,6 +36,16 @@
// Simulator Battles Cold War / modern bloc cutoff mrank (18 = BR 7.0).
"simColdWarMinMrank": 18,
// Ground Simulator starting Spawn Points (offline: warpoints.blk TankSimulation defines
// per-class cost multipliers against base_respawn_points_coef, while the live event server
// sets the starting 1000 SP pool so aircraft/helicopters and multiple tanks are spawnable).
"simGroundInitialSpawnScore": 1000,
// Assault PvE (air_assault_pve / tank_assault_pve) team capacity (1 local player + friendly AI
// teammates in Team A; stock Assault rooms hold 8 defenders).
"pveAssaultMaxPlayers": 8,
"pveAssaultMaxBots": 7,
// Strike UCAV extra slot (char.vromfs.bin config/wpcost.blk ucav_*_killstreak, one per country).
// The game files have no rule for when it is offered or what it costs (online the battle server
// decides). Offer rule, offline design: in these game modes, when the session's top rank is at