Commit Graph
128 Commits
Author SHA1 Message Date
N0VAN0M4LY 0af4183cb1 merge(ground-ai): merge feat/tank-ai phase 1 into main 2026-12-04 02:50:48 +08:00
N0VAN0M4LY 85532cd930 feat(ground-ai)!: disable stock tankBot globally when AI script loads
Replace per-bot mid-battle movement handback to stock AI with a clean
binary startup gate:

- Locate Unit::setBehaviorTree (ground_ai_set_beh_tree: .37 0x4e89b0,
  .58 0x4e8f60) in patches/native/local_mp_ground_ai.jsonc and hook it
  in native/wto-net/src/local_mp_ground_ai.c.
- Announce readiness from [init] in wto_ai_runtime.das via
  wtoGroundAiScriptReady once the ground AI scripts finish compiling
  cleanly with custom movement enabled. When announced, hook_set_beh_tree
  suppresses attaching "tankBot" to LocalMP bot tanks and keeps their
  MoveSystem.inactive pinned to 1 for the life of the vehicle, ending
  all tug-of-war (external_inactive_reset) with stock AI.
- If scripts fail to compile, are missing, or mode is "stock" / "fire",
  ownMovement stays 0 and stock tankBot runs untouched.
- Remove per-bot handback, timeout release, and the now-obsolete
  navigation.returnToStockOnFailure config plumbing; on genuine script
  failure a bot halts in place and logs DRIVE_FAIL instead of silently
  switching to stock. Also initialize newly spawned bot ticks to run on
  frame 0 to eliminate spawn-frame invalid_drive_cmd noise.

Verified MSVC build of wto_ws.dll (0 warnings in project C sources), root
and launcher type checks, native module resolution on both 2.61.0.37 and
2.61.0.58 (0 failures), isolated 2.61.0.58 startup confirming 12/12
LocalMP modules installed, wto_ai_runtime.das loaded in 213 ms (0 compile
errors), and "ground AI script ready (ownMovement=1; stock tankBot
disabled)" in wto_ws.log.

BREAKING CHANGE: removes navigation.returnToStockOnFailure from
tuning/ground-ai.jsonc; stock tankBot is now controlled strictly by
whether the custom ground AI script loaded with custom movement enabled.
2026-12-04 01:06:04 +08:00
N0VAN0M4LY 651b023d2a fix(launcher): preserve skipped files during game updates
Reuse source scan exclusions during stale-file cleanup so updates preserve user content and tool files copied by earlier installers.

Verified with root and launcher typechecks and an update run against temporary folders.
2026-12-04 00:47:29 +08:00
N0VAN0M4LY 1d3e47b082 feat(launcher): allow changing the online update source
Let registered clients set or replace their online installation source
from the maintenance page. Validate the source and persist its path
before refreshing the available update status.

Verified launcher and workspace type checks, a launcher build, and an
incremental update of a registered client using local game snapshots.
2026-12-04 00:11:55 +08:00
N0VAN0M4LY ac35c25851 feat(ground-ai): add ready-rack dual-ammo bot spawn loadouts and shell switching
Select realistic ready-rack dual-shell loadouts for AI tanks on the local
server, inject them natively on bot spawn, and switch between anti-armor
and soft-target shells in battle:

- Add the loadout section to tuning/ground-ai.jsonc (lowReadyRackThreshold,
  topUpAmmoCount, primaryAmmoPct, secondaryMinRounds,
  penetrationCompareDistM), validated in ground-ai-tuning.ts.
- Add the tank-bot-ammo v2 dataset (apps/server/src/game-data/datasets/
  tank-bot-ammo.ts) reading primary cannon weapon name, capacity,
  firstStage/autoLoad shell ready-rack counts (excluding separate charges),
  and selectable shell modifications (using Lanz-Odermatt kinetic fields,
  cumulativeDamage, armorpower, and transitive reqModification chains).
- Add selectBotTankLoadouts (apps/server/src/battle/bot-tank-loadouts.ts):
  carry ready-rack count when >= 15 (top up to 22 when smaller or absent,
  clamped to gun capacity), skip SPAA/belt autocannons, pick highest-tier
  APFSDS/anti-armor primary (~80%) plus HE/HESH/HEAT secondary (~20%, min
  3 rounds) when available, and attach required addModification entries and
  per-tank wtoAmmo_<unit> strings to customBots when mode != stock.
- Hook Unit::changeAircraft (already located dynamically on .37 and .58) in
  native/wto-net/src/local_mp_loadout.c to assign the 24-byte
  ChangeUnitReflection.bullets entries via bullet_vec_assign for LocalMP
  bot spawns (async == 0, non-local bot MPlayer), leaving player spawns
  untouched.
- Track soft-target vs anti-armor shell classes in wto_ai_specs_common.das
  and write gun.nextBulletType in wto_ai_fire_common.das to queue HE/HESH
  against light/narrow targets and APFSDS/AP against MBTs/heavy armor.

Verified MSVC build of wto_ws.dll (0 warnings in project C sources), root
and launcher type checks, 14/14 check-patches on 2.61.0.58, 12/12 LocalMP
module installation, clean daScript load (wto_ai_runtime.das loaded in
211 ms, 0 compile errors), and real 2.61.0.58 loadout selection on
cn_ztz_96a (18 APFSDS + 4 HE), germ_leopard_2a4 (12 DM23 + 3 HEATFS),
ussr_t_80bvm (22 3BM60 + 6 HE), us_m1a2_abrams (14 M829A2 + 4 HEAT-MP),
ussr_t_34_1941 (18 APHEBC + 4 HE), and ussr_zsu_23_4 (stock belt kept).
Live battle acceptance begins in Step 9.
2026-12-03 19:25:04 +08:00
N0VAN0M4LY d5008baeff feat(ground-ai): add navmesh flank lanes, rally staging, recall, and air-aware SPAA
Complete the team commander layer with validated flank routes, coordinated
rally launches, dynamic cap recall, and air-threat-responsive SPAA:

- Add flank, rally, and recall parameters to the commander section of
  tuning/ground-ai.jsonc (flankMaxLengthRatio, flankMinSeparationM,
  rallyProgressFrac, rallyWaitSec, rallyMinFrac, rallyRadiusM,
  recallSafeHoldSec), validated in ground-ai-tuning.ts and compiled into
  WTO_AI_CMD_* constants.
- Add wto_ai_lanes_common.das:
  - Lazily build and cache per-(team, cap) center and left/right flank
    lanes using two-segment navmesh find_path_ex; reject flanks exceeding
    1.6x center path length or closer than 45 m to the center midpoint.
  - Stage offensive groups at the 40% rally point along their lane and
    launch once 2/3 of the group arrives or 25 s elapse, resetting on cap
    ownership flips.
  - Track enemy ground count and contested state on friendly caps,
    holding recall active until safe for 15 s; track enemy aircraft
    presence for team SPAA intel.
- Split mode planners and recall demand overrides into
  wto_ai_commander_plans_common.das; pull (enemies + 1) nearest support
  or reserve bots to defend contested friendly caps while always keeping
  at least one offensive assault bot.
- Update wto_ai_commander_anchors_common.das so SPAA follows behind the
  actual Assault group centroid and checks upward open-sky clearance when
  enemy aircraft are active.
- Wire WtoTaskOrder lane/relay/rally fields into wto_ai_route_common.das
  (replacing unvalidated wing relays and preserving corridor turning
  corners), wto_ai_tactics_common.das (rally staging hold), and
  wto_ai_runtime.das (1 s rally release check).

Verified root and launcher type checks, isolated 2.61.0.58 build (27
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 183 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
2026-12-03 18:46:53 +08:00
N0VAN0M4LY 45ff082a36 feat(ground-ai): add sample-based lead estimation, exit watch, and bounded bias
Replace direct reads of true enemy velocity with an own-sight sample
estimator, add 2-5 s last-seen exit watching, and sample bounded aiming
bias once per shooting opportunity:

- Add the estimation section to tuning/ground-ai.jsonc (watchMinSec,
  watchMaxSec, velSampleMinSpanSec, velStableSpanSec, velJumpResetMps,
  baseAimSigmaM, leadErrorFrac, maxBiasM), validated in
  ground-ai-tuning.ts and compiled into WTO_AI_EST_* constants.
- Add wto_ai_estimate_common.das:
  - Maintain a 6-sample timestamped ring buffer from each bot's own
    visual sightings; compute smoothed observed velocity and convergence
    quality, dropping quality and re-seeding bias on sudden braking/turns
    or target switches.
  - On LOS loss from an active ground engagement, freeze watchPos at the
    last-seen exit point, clear observed velocity, and draw one random
    2-5 s watch duration; stationary overwatch/defend bots hold their
    post while watching, whereas pushing/retreating bots keep moving
    while keeping their turret on the exit.
  - Compute lead from observed velocity and loaded-shell flight time,
    sampling one bounded bias vector per shooting opportunity (target,
    shot count, state, 12 m position cell) that narrows as observation
    quality improves and still passes the single fire-permission gate.

Verified root and launcher type checks, isolated 2.61.0.58 build (25
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 184 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
2026-12-03 18:23:12 +08:00
N0VAN0M4LY 80113bdd2e feat(ground-ai): add cover reload, stalemate reposition, and damage repair
Complete the single-vehicle tactical loop for reload survival, stalemate
breaking, and vehicle damage repair:

- Add cover, reload, hull-angle, stalemate, reposition, and repair-cover
  parameters to tuning/ground-ai.jsonc, validated in ground-ai-tuning.ts
  and compiled into WTO_AI_SM_* constants.
- Add wto_ai_cover_common.das: continuously record the last hard-concealed
  hull position before peeking, and evaluate 9 cover candidates around
  the tank (with enemy-clearance scoring when searching for a repair
  cover).
- Add wto_ai_tactics_actions_common.das and wire wto_ai_tactics_common.das:
  - Damage retreat & repair (plan 6.1): when gun is inoperable while
    mobile, retreat to an enemy-free cover and send
    EventRepairSystemRequestRepair(repair=true) once safe; when engine or
    tracks immobilize the chassis, halt in place, request repair, and keep
    gun self-defense active; stay halted while
    repair_system_remaining_repair_time > 0.
  - 3-way reload action: pull back into remembered/nearby cover (up to 6 s
    budget, uninterrupted by flashes/new orders) -> zigzag advance at
    +/-18 deg when pushing without cover -> angle hull front +/-15 deg
    when side-exposed >30 deg with pivot room.
  - Stalemate reposition: confirm outgoing effective damage via
    EventUnitDamage (uint(hpFixed) < uint(prevHpFixed)) and enemy death;
    trigger lateral reposition after 2 no-effect shots, 2 no-shot halts,
    or 12 s cumulative halt time, unlocking short-halt only after 20 m
    progress or reaching the new position.
- Split periodic telemetry out of wto_ai_runtime.das into
  wto_ai_diag_common.das to keep every module under 300 lines.

Verified root and launcher type checks, isolated 2.61.0.58 build (24
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 228 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
2026-12-03 18:14:43 +08:00
N0VAN0M4LY 314bdfe68e feat(ground-ai): add hull state machine and two-beat turn driving
Replace the legacy tactics posture heuristics with an explicit per-bot
hull state machine driven by WtoTaskOrder and the 100/300/800 m distance
tiers, and fix chassis steering bugs:

- Add the stateMachine section to tuning/ground-ai.jsonc (preaimAngleDeg,
  shortHaltMaxSec, shortHaltCooldownSec, turnLaunchSpeedMps), validated in
  ground-ai-tuning.ts and compiled into WTO_AI_SM_* constants.
- Replace WTO_POSTURE_* with the unified WTO_STATE_* hull state enum in
  wto_ai_types_common.das and decouple wto_perceive_update into
  wto_ai_runtime.das so perception runs independently of hull tactics.
- Rewrite wto_ai_tactics_common.das as a priority-arbitrated state
  machine: safety/SPAA -> ridge withdrawal -> active SHORT_HALT budget
  (3 s limit with cooldown on timeout) -> crowd dispersion -> distance-tier
  combat (RUN_AND_GUN <=100 m and high-urgency 100-300 m slow-move-fire;
  PREAIM keeping the hull moving while gun reloads or turret error >8 deg;
  SHORT_HALT only when ready and permitted by order.maxStopRangeM / 800 m
  4 s window; RELOAD_ADVANCE when reloading away from cover) -> MARCH.
  Log every state transition with reason, distance and speed.
- Fix the inverted neutral-pivot condition in wto_ai_drive_common.das,
  add 2nd-gear straight-launch before full steering when turning with
  open front clearance, and use full throttle when accelerating to target
  speed so the automatic gearbox upshifts cleanly.

Verified root and launcher type checks, isolated 2.61.0.58 build (21
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 195 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
2026-12-03 17:47:10 +08:00
N0VAN0M4LY 9229045042 feat(ground-ai): add exposure perception and single ballistic fire gate
Replace the old foliage-ignoring LOS check and 45 m pre-fire ray with
separate vision/hard-occlusion queries, exposure-integrated spotting, and
a single fire-permission gate for every ground weapon:

- Add perception and fire-gate distance/ballistics/budget parameters to
  tuning/ground-ai.jsonc, validated in ground-ai-tuning.ts and compiled
  into wto_ai_config_common.das.
- Extract wto_ai_combat_types_common.das and add wto_ai_sight_common.das:
  visual checks use smoke occluders, ETF_ALL with aimRay material,
  traceTransparencyRayRIGenNormalized foliage transparency, and vehicle/
  wreck checks; hard-occlusion checks test terrain/structures plus both
  ETF_RI and ETF_RI_PHYS without skipping soft foliage, plus swept
  sphere_cast and wreck/vehicle bounds along the full shot distance.
- Rewrite wto_ai_perceive_common.das with per-target exposure integration
  (fast/normal/far fill times and occlusion decay), 4-point visibility
  sampling with continuous >=2-point LOS tracking for the 800 m 4-second
  window, frozen last-seen coordinates with zeroed velocity on LOS loss,
  and impact-time hit direction (no live offender lookup).
- Record per-shell ballistics profiles (speed, Cx, mass, ballisticCaliber)
  in wto_ai_specs_common.das and sync the currently loaded shell from
  gun.chosenBulletType / bulletSets at runtime.
- Add wto_ai_fire_gate_common.das as the sole ground trigger exit: checks
  visual lock, weapon readiness, distance-tier measured chassis speed
  limits (100/300/800 m), 800 m 4-second window, aim settle, per-frame
  check budget, straight muzzle hard-ray, drag-integrated ballistic arc
  sweep, predicted friendly corridor, and every barrel in the primary
  trigger group. Confirm real shot departure from loaded ammo/readiness,
  remove the pure-launcher stock bypass and add_unit_for_target leak, and
  log exact deny/shot reasons.

Verified root and launcher type checks, isolated 2.61.0.58 build (21
ground AI modules packed), and clean in-engine daScript compilation/load
(wto_ai_runtime.das loaded in 186 ms, 0 compile errors). Live battle
acceptance deferred until the full pipeline is wired.
2026-12-03 17:34:59 +08:00
N0VAN0M4LY 7e5eb99696 feat(ground-ai): add task order, mode-aware commander v1, and world fixes
Replace the per-bot greedy cap scorer (wto_ai_macro_common.das) with a
whole-team commander and explicit task order contract, and fix the world,
spec, and navigation bugs found during the codebase audit:

- Classify ground battle modes (bttl, conq, dom) in multiplayer-missions
  v5 from mislist.blk categories (with suffix fallback for event maps) and
  emit wtoGroundMode in customRules/customBots.
- Add the commander section to tuning/ground-ai.jsonc with range and sum
  validation, compiled into WTO_AI_CMD_* constants.
- Split zone/mode/spawn refresh into wto_ai_world_zones_common.das and fix
  four world snapshot bugs: stop double-recording deaths in wreck scans
  and deduplicate with a ring cursor, refresh units before spawn fallback
  while retrying real respawn points, fall back battleCenter to spawns
  when capCount is 0, and relax cap radius clamping to 10..180 m.
- Fix limited-traverse yaw overwrite in wto_ai_specs_common.das and
  compute pivot turn angle against wishDir in wto_ai_nav_common.das.
- Introduce WtoTaskOrder (wto_ai_order_common.das) and whole-team
  commander v1 (wto_ai_commander_common.das +
  wto_ai_commander_anchors_common.das): mode-aware role quotas (Bttl,
  Conq, Dom), deterministic distance + vehicle-suitability matching,
  20-second role hysteresis, separate total-assigned vs cap-insider
  counters, frontline-relative SPAA anchors, EventZoneCaptured immediate
  rebalance, and per-team WTO_AI|CMD telemetry.

Verified root and launcher type checks, multiplayer-missions v5 dataset
extraction (1140 missions with Bttl/Conq/Dom classification), isolated
2.61.0.58 build (18 ground AI modules packed), and clean in-engine
daScript compilation/load (wto_ai_runtime.das loaded in 155 ms, 0 compile
errors). Live battle tuning and acceptance deferred until the full
pipeline is wired.
2026-12-03 17:20:17 +08:00
N0VAN0M4LY 73bae4785f fix(ground-ai): harden drive ownership, teardown and failure switch
Address two issues found in the first isolated 2.61.0.58 live runs and add
a test switch to disable silent fallback to stock movement:

- Add navigation.returnToStockOnFailure in tuning/ground-ai.jsonc (default
  true), compiled into WTO_AI_NAV_RETURN_TO_STOCK and written to wto_ws.cfg
  as ground_ai_return_to_stock=0 when disabled. When false, failed or
  timed-out bots keep stock movement paused, brake in place and log the
  failure once instead of silently handing control back to stock tankBot.
- Allow holdMs=0 release actions even after local_mp_is_host() flips false
  during mission unload, add eid=0 bulk release on wto_reset_runtime(), and
  match slots by eid rather than live owner lookup so match exit cleans up
  the native control table immediately.
- Stop releasing drive ownership when a vehicle is immobilized by damage or
  repair; brake in place and pause the echo watchdog instead, avoiding the
  1-second release/re-acquire flapping observed during combat. Log exact
  release reasons and back off for 1 second if MoveSystem.inactive is
  cleared externally.

Verified MSVC build of wto_ws.dll (0 warnings in project C sources), root
and launcher type checks, 14/14 check-patches on 2.61.0.58, and a temporary
2.61.0.58 game copy build confirming ground_ai_return_to_stock=0 in
wto_ws.cfg and 15 packed daScript modules. Live battle re-check pending.
2026-12-03 16:47:44 +08:00
N0VAN0M4LY 89242e91f0 feat(ground-ai): default to the full custom ground AI
Stock tankBot only drives each bot to a capture point, so the custom AI is the intended player default. Stock mode stays available for troubleshooting, and per-vehicle control still returns to stock movement on failure. Verified the shipped tuning loads with mode full.
2026-12-03 16:09:36 +08:00
N0VAN0M4LY 5e521295a3 feat(ground-ai)!: replace layer switches with complete modes
Ground AI layers could be enabled in any combination, including ones the
scripts cannot run (fire control without perception disabled stock aiming
and never fired). The configuration now selects one of four complete modes:
stock, fire (stock movement, custom fire permission), drive (custom orders
and driving, stock firing) and full. The build derives the compiled layer
constants from the mode, and an unknown mode is rejected at load time.

The offline tank class weights for the AI bot pool move from code into
tuning/ground-ai.jsonc (lineupWeights). They apply only when a custom mode
is active; stock mode keeps the stock weight of 1 for every vehicle.

Verified root and launcher type checks, mode-to-constant compilation for
all four modes, rejection of an unknown mode, bot pool weights in stock and
custom modes, and temporary 2.61.0.58 game copy builds in full mode (15
script modules packed) and stock mode (no game pack written).

BREAKING CHANGE: ground-ai.jsonc drops "enabled" and "layers". Override
files set "mode" to "stock", "fire", "drive" or "full" instead.
2026-12-03 16:05:03 +08:00
N0VAN0M4LY 885e3bbb5d feat(ground-ai): return bot movement control on failure
Grant custom physics control per LocalMP bot and let the native layer release it when the script stops renewing control. Verified both TypeScript checks, the MSVC build, native resolution and check-patches on .37 and .58, and isolated .58 script loading.
2026-12-03 14:24:32 +08:00
N0VAN0M4LY 4ac3484f56 feat(patcher,server): wire ground AI tuning, bot weights, and pack build
Add ground-ai.jsonc tuning validation, realistic tank class weights for
customBots pools, on-demand game.vromfs.bin / ailist.blk injection in
@wto/patcher, and launcher/CLI build integration while keeping all
ground AI layers disabled by default in shipped configuration.
2026-12-03 12:07:30 +08:00
N0VAN0M4LY e2ac4fa744 fix(launcher): use original-fs for copy and guard nested launcher folders
Electron patches node:fs to treat any .asar file on disk as a virtual
archive directory. When a player's War Thunder source directory contains
an .asar file (for example from a leftover portable launcher folder
previously unpacked inside the game folder), createReadStream fails with
ENOENT and aborts full-copy installation.

Changes:
- Add rawFs() helper using Electron's original-fs (with node:fs fallback)
  and use it across copy-game.ts and change-copy-files.ts for directory
  scans, streaming copies, timestamp preservation, rollback and cleanup.
- Preserve the first non-cancellation worker error in copyPlannedFiles so
  sibling AbortError rejections do not mask the real filesystem or
  hardlink error.
- Skip nested subfolders containing WTOffline Launcher.exe during
  planCopy, and reject copy installation upfront with
  launcher_inside_source when the packaged launcher itself runs from
  inside the selected source game directory (with en and zh-CN messages).

Verification:
- Root and launcher typecheck passed.
- Launcher electron-vite build passed.
- en.json and zh-CN.json key parity check passed (720 keys).
- Verified in Electron that patched node:fs reproduces ENOENT on
  default_app.asar while original-fs copies and cleans it up cleanly.
- Packaged installer end-to-end verification pending.
2026-12-03 10:40:49 +08:00
N0VAN0M4LY 01bafb6db7 fix(launcher): detach portable updater via Start-Process on Windows
Spawning powershell.exe directly with Node detached: true sets DETACHED_PROCESS (no console), causing Windows PowerShell 5.1 ConsoleHost to exit silently with code 0 before running -File. Spawning without detached lets it run, but Electron tears down attached children on app.quit(). Launch the apply script via a short hidden PowerShell Start-Process helper before quitting, properly quoting paths with spaces or non-ASCII characters, and clean up staged files if launching fails.
2026-12-03 07:48:44 +08:00
N0VAN0M4LY 18637cf1ff fix(launcher): skip user skins, sights, CDK, and launcher log folders when copying game
Exclude UserSkins and UserSights from stock client scans as player data folders (matching UserMissions and keeping them protected from symlink redirection during launch), and skip WarThunderCDK plus official launcher/updater log and obsolete folders when copying, sizing, or incrementally updating from a stock installation.

Verified: root typecheck, launcher typecheck, and launcher electron-vite build pass; runtime copy test pending.
2026-12-03 07:24:54 +08:00
N0VAN0M4LY 10427912e2 feat(launcher): display rendered markdown release notes in a modal
Keep the About page launcher update notice compact by showing only the available version, package size, and action buttons, with a compact button to open a scrollable release notes dialog when notes are present. Render GFM Markdown safely into React elements via marked.lexer without injecting raw HTML, and raise the release notes cap from 1,600 chars to 64 KiB so full bilingual notes are preserved.
2026-12-03 07:18:31 +08:00
N0VAN0M4LY 214f9d7f4b fix(launcher): use original-fs in portable updater and drop default_app.asar
Electron patches node:fs to treat .asar archives as virtual directories, so portable update verification failed on staged resources/default_app.asar and recursive cleanup could leave staging folders behind. Switch staging lstat and cleanup rm in portable-update.ts to original-fs (falling back to node:fs outside Electron), strip unused resources/default_app.asar during packaging so already-released 0.1.2/0.1.3 portable builds can update cleanly to future releases, and include portable-update.log in exported diagnostics.
2026-12-03 07:18:14 +08:00
N0VAN0M4LY f6b00bc787 fix(modifications): emit RESEARCHED status and align buy-all pricing
Add ModuleStatus.RESEARCHED (0x40, ES_ITEM_STATUS_RESEARCHED) for modifications that have reached their RP requirement while a reqModification prerequisite is not yet owned, and keep unresearched modifications locked until their prerequisites are researched.

Update buyAllModifications / buyAllEntry to accept both CAN_BUY and RESEARCHED so the server matches client getAllModsCost (canBuyMod || isModStatusResearched) instead of rejecting cln_buy_all_modification with PRICE_CHANGED (shown as Internal character server error).

Verified: root and launcher typecheck, and runtime check against 2.61.0.58 wpcost.blk chained modifications. Pending in-game acceptance.
2026-12-03 06:38:15 +08:00
N0VAN0M4LY 02fe867cf1 refactor(launcher): open mod documentation on wto-project.net
Replace the local offline HTML mod docs viewer in the launcher Mods page with a direct link to https://wto-project.net/mod-docs, remove the unused mods:openDocs IPC path and resource entry, and drop build-mod-docs-html.ts from Windows packaging while keeping bundled mod templates intact. Root typecheck, launcher typecheck, and electron-vite build passed.
2026-12-03 06:26:52 +08:00
N0VAN0M4LY 742094ea1e chore(launcher): bump version to 0.1.3 and add release notes 2026-12-03 06:13:23 +08:00
N0VAN0M4LYandduduyagame 4e99d2c484 fix(training): persist tutorial completions and grant first-time rewards
On returning from a stock training mission, the client reports the outcome in
cln_update under missionAwards while sending an empty pveProgress block. Because
the local server did not record this completion, the hangar repeated tutorial
prompts after restart and never credited first-completion rewards.

Add a cached training-missions dataset (config/mislist.blk,
config/pve_awards.blk, config/unlocks.blk), pure completion rules in
TrainingCatalogue, and missionAwards parsing in clientUpdateAction. Completed
tutorials now persist pveProgress/missions and grant per-mission decals, the
shared first-basic-tutorial Golden Eagles unlock, and per-difficulty first-win
Silver Lions once per account during cln_update before replying.

Credit to duduyagame for identifying the cln_update missionAwards reporting flow
and stock reward definitions (PR #6).

Checks: root `npm run typecheck` passed; verified training-missions dataset
extraction/caching and TrainingCatalogue idempotency against read-only stock
2.61.0.37 files in a temporary data folder. In-game acceptance pending on an
isolated client copy.

Co-authored-by: duduyagame <[email protected]>
2026-12-03 05:23:18 +08:00
N0VAN0M4LYandduduyagame 42b8275151 fix(battle): write root numBotRespawns and numTankBotRespawns for all modes
MissionSettings::load (2.61.0.37 0x126b1f4..0x126b2e6) initializes AI respawn
limits from global config/bots.blk defaults (numBotRespawnsInMultiSlot=1,
numTankBotRespawnsInMultiSlot=3) and then overrides them from the mission root
fields numBotRespawns and numTankBotRespawns rather than customRules/customBots.

Previously only single-slot modes wrote numBotRespawns at the mission root, so
Air Arcade and other multi-slot modes stayed at 1 aircraft respawn and all modes
ignored tuning.battle.tankBotRespawns. Write both root fields unconditionally
using the per-mode values already resolved by BattleMatchmaker.

Credit to duduyagame for identifying the missing root numBotRespawns in Air
Arcade (PR #7).

Checks: root `npm run typecheck` passed. In-game acceptance pending on an
isolated client copy.

Co-authored-by: duduyagame <[email protected]>
2026-12-03 05:22:40 +08:00
N0VAN0M4LY 594ff5ab54 feat(launcher): add project homepage link to About page
Add a Project homepage card and button pointing to https://wto-project.net on the launcher About page with matching zh-CN and en locale entries. Root typecheck, launcher typecheck, electron-vite build, and locale key parity checks passed.
2026-12-03 04:34:22 +08:00
N0VAN0M4LY d94c8fe687 feat(mods): merge additive mod system, official map selector, and mod-dev-docs
# Conflicts:
#	apps/launcher/src/main/workers/build-worker.ts
#	apps/launcher/src/renderer/src/i18n/locales/en.json
#	apps/launcher/src/renderer/src/i18n/locales/zh-CN.json
2026-12-03 03:43:56 +08:00
N0VAN0M4LY 240ee81712 feat(launcher): use dl.wto-project.net as primary release source with GitHub fallback
Replace the single GitHub repository field in release-channels.jsonc with primary_source (https://dl.wto-project.net) and ordered fallback_sources (GitHub), and update withReleaseSources to walk the deduplicated primary, player mirror, and fallback list while keeping preferred-source downloads and Ed25519 signature verification intact. Verified with root and launcher typecheck and launcher production build.
2026-12-03 03:02:14 +08:00
N0VAN0M4LY 6e65cec4c0 feat(mods): add official map selector mod template and move templates into mod-dev-docs 2026-12-03 03:01:18 +08:00
N0VAN0M4LY aa952e7cca docs(mods): add standalone mod-dev-docs handbook and launcher quick-open button 2026-12-03 02:51:54 +08:00
N0VAN0M4LY 5983e3f3e2 feat(mods): add battle.onFilterMissions hook and per-template bundled seeding 2026-12-03 02:40:38 +08:00
N0VAN0M4LY 662e837ab2 fix(patcher): support regional.vromfs.bin decal and skin indexes on cache import
Modern online War Thunder clients (verified on 2.61.0.58) ship their decal and
skin indexes (dldata/downloadable_decals.blk and dldata/downloadable_skins.blk)
inside cache/binary.<ver>/regional.vromfs.bin rather than downloading
downloadable_decals.<hash>.blk into cache/content/. Requiring
downloadable_decals.<hash>.blk rejected every live 2.61 cache/content folder.

- Accept modern online caches containing cached .ddsx textures alongside a
  sibling binary.<ver>/regional.vromfs.bin (as well as selecting the parent
  cache folder or legacy downloadable_decals.<hash>.blk caches).
- Extract both dldata/downloadable_decals.blk and dldata/downloadable_skins.blk
  into a self-contained .wto-index snapshot on launcher import (excluded from
  the copied game cache/content folder) and embed them into char.vromfs.bin
  during copy build so webdlcontent::init mounts cache/content and resolves
  cached real decals and downloadable skins natively without client patches.
- Log the specific rejection reason in launcher decal import and clarify the
  en/zh-CN prompts.

Verified with root and launcher npm run typecheck, launcher electron-vite
build, and an end-to-end temporary import + char.vromfs.bin build against a
read-only 2.61.0.58 online cache (4,080 decals / 1,930 skins embedded).
In-game acceptance pending on an isolated 2.61.0.58 client copy.
2026-12-03 01:58:28 +08:00
N0VAN0M4LY 8636d0b71d fix(mods): serialize initial example seeding and refresh on window focus 2026-12-03 01:55:20 +08:00
N0VAN0M4LY 97707f533d feat(launcher): bundle example mod templates and seed fresh mods folder once 2026-12-03 01:51:43 +08:00
N0VAN0M4LY ada635ecc7 refactor(launcher): move experimental mod notice to hover tooltip chip 2026-12-03 01:48:47 +08:00
N0VAN0M4LY deffcd6dde feat(saves): merge bulk research and purchase into one launcher action
In the launcher's Saves -> Vehicles & Research page, "Research all" only
filled vehicle RP without purchasing them, requiring players to buy each
vehicle manually in-game while a separate "Grant regular vehicles" button
already added them to the hangar.

Merge the two actions into a single "Research and buy all" (`purchase`) action
alongside "Unlock modifications" (`equipment`), and switch bulk modification
unlocking in save-research.ts to ProfileEquipmentIndex so large saves stay
O(N) and write cleanly across chunked modification blocks.

Verified with root and launcher npm run typecheck, launcher electron-vite
build, and en/zh-CN locale key parity (631 keys).
2026-12-03 01:19:20 +08:00
N0VAN0M4LY 4e72bf3746 fix(profile): split modifications across sibling blocks at 65,535 entries
Dagor's binary DataBlock stores child block counts in a uint16 (65,535 max),
and the full 2.61.0.58 vehicle catalogue contains 76,041 modifications. Writing
all owned modifications into a single `modifications` block caused encodeBlk to
throw BlkFormatError once a save crossed 65,535 entries, preventing saving and
login.

Match aces.exe's native multi-block layout (2.61.0.37 0x938fae..0x9397e6,
2.61.0.58 0x93ba70 / 0x93bb53), which splits modifications across up to 3
sibling top-level `modifications` blocks of at most 65,535 entries each:

- Add allModificationBlocks, appendModificationEntry, and
  normalizeModificationBlocks in profile-modifications.ts and span all chunks
  in modificationRecord, ownsModification, and writeModificationRecord.
- Index and append across sibling chunks in ProfileEquipmentIndex and
  grantSupportPlaneModifications.
- Filter all sibling chunks in prepareTransferredProfile and normalize before
  encoding in SaveStore.saveProfile.

Verified with root npm run typecheck and a 2.61.0.58 temporary save check
encoding, decoding, and filtering >65,535 modifications across sibling chunks.
In-game acceptance pending on an isolated 2.61.0.58 client copy.
2026-12-03 01:18:14 +08:00
N0VAN0M4LY dbc21182a2 feat(launcher): add Mods page, per-client presets, custom repo folder, and launch integration 2026-12-03 00:34:07 +08:00
N0VAN0M4LY 5c09c4e47a fix(battle): enable limited fuel in LocalMP versus battles
MissionSettings initializes isLimitedFuel to false by default (2.61.0.37
0x12620af), leaving LocalMP versus battles with infinite fuel, no fuel
burn weight reduction, and no HUD fuel timer. Set isLimitedFuel=true in
battleMissionSettings across all versus modes to match live behavior.

Verified with root npm run typecheck. In-game acceptance pending on an
isolated 2.61.0.58 client copy.
2026-12-03 00:31:35 +08:00
N0VAN0M4LYandAlem Bek e8122d7c6b fix(battle): restore LocalMP Ground Arcade air events
Copy allowedKillStreaks and set useKillStreaks for Ground Arcade in battle-mission-settings.ts, and add a dedicated dynamic native module (local_mp_air_events) that preserves MissionSettings.useKillStreaks across prepare_local_mission, credits local player AI kills toward native killstreak counters, delivers UnitRespawn (0xf030) to the LocalMP host via shared unit_on_event, and recovers invalid surface poses from gameplay.blk spawnPos parameters for the match rank.

Based on PR #3 by Rivfflot, who diagnosed the LocalMP Ground Arcade air-event gaps and verified the fix in-game; refactored here onto patches/native dynamic resolution for cross-version and MSVC build compatibility.

Checked: root and launcher typecheck, MSVC native/wto-net/build.ps1, native resolution across 2.61.0.37 and 2.61.0.58 (12/12 modules), 2.61.0.58 check-patches (14/14), and temporary 2.61.0.58 copy build all passed. Pending in-game acceptance on the refactored module.

Co-authored-by: Alem Bek <[email protected]>
2026-12-03 00:14:32 +08:00
N0VAN0M4LY aa7a6e7d02 feat(server): add experimental JS/TS mod runtime, hooks, tuning list ops, and isolated mod storage 2026-12-03 00:00:36 +08:00
N0VAN0M4LY d0e4797fe7 feat(battle): add Nuclear Escalation tactical and strategic nuclear carriers
Connect stage-unlocked nuclear carriers to Air Realistic sub-mode 103
(Nuclear Escalation) and expose a player toggle for stage-3 megaton
strategic bombers:

- Dataset & profile grants: extract tactical killstreak nuclear carriers
  (5 kt / 30 kt Nuclear Escalation presets) and megaton strategic bombers
  (nt_b_52h / nt_tu_95m) from wpcost.blk in battle-spawn-rules (v4), and
  grant their required weapon/modification records in
  support-plane-modifications.ts.
- Server slot selection & tuning: add nuclearEscalationStrategicBombers
  (default true) in tuning/battle.jsonc, battle-tuning.ts, and
  launcher-tuning.ts; add one nation-matched tactical carrier per session
  rank bracket (with allowedWeapons limited to its Nuclear Escalation
  presets) and, when enabled, one stage-3 strategic bomber to
  extraBattleSlots; include modeTag in battle launch notifications.
- GUI patch & launcher UI: add battle/filter-extra-slot-weapons on
  scripts/weaponry/weaponryinfo.nut to filter extra-slot presets by
  allowedWeapons (hiding Ground RB zero-yield presets at stage 0) and to
  fall back to LocalMP launch metadata for GameModeRestrictions; expose
  the strategic bomber toggle in the launcher Battle tuning section.

Verified with root and launcher typechecks, launcher build, full
check-gui on 2.61.0.37 and 2.61.0.58 (49 patches across 37 .nut files),
and slot selection check across all 10 nations on 2.61.0.58 stock data;
pending in-game verification.
2026-12-02 23:03:15 +08:00
N0VAN0M4LY f1ec034994 feat(battle): wire Nuclear Escalation launch and airfield cooldowns
Connect Air Realistic sub-mode 103 (Nuclear Escalation) mission launch
settings and LocalMP respawn/airfield-cooldown handling:

- Server: support mode-level maxRespawns (UNLIMITED_RESPAWNS = -2) and
  per-mode missionRuleKeys so Nuclear Escalation forwards customHUD,
  stage thresholds, useSpawnDelay, afterRespawnDelaySec, and battle
  display flags from the stock missions; reject queues when no candidate
  mode is eligible for the lineup; disable spares and emit
  wtoUnlimitedRespawns for unlimited-respawn modes.
- Native: keep slots usable when wtoUnlimitedRespawns is set and emit
  wtoLocalMpAirfieldSpawn with the unit name and spawn base ID when the
  local player actually enters pilot control.
- GUI patches: track confirmed LocalMP airfield departures in
  scripts/respawn/respawnbases.nut and feed the computed per-base delays
  into scripts/respawn/respawn.nut slot countdowns and spawn checks.

Stage-unlocked dedicated event aircraft allocation by faction and room
BR is not yet wired and remains pending research. Verified with root and
launcher typechecks, check-patches and check-gui on 2.61.0.37 and
2.61.0.58, and native wto_ws.dll build; pending in-game verification.
2026-12-02 21:35:17 +08:00
N0VAN0M4LY 646be7afb9 fix(battle): load player crew skills on LocalMP host
Unit::loadCrew previously skipped reading the player's equipped crew from
the profile whenever Multiplayer+0x60 (host flag) was non-zero, leaving
human players with default skills and no Expert/Ace bonuses. Calling
UnitCrewSkills::initFromSave after Unit::changeAircraft in the native
loadout hook ran too late to affect live vehicle crew state.

Add exe patch battle/load-local-host-player-crew to check both the host
and LocalMP flags (+0x60 and +0x61) in Unit::loadCrew so only non-LocalMP
hosts skip directly to the default crew while preserving the owner check.
Remove the late initFromSave workaround from local_mp_loadout.c (keeping
its native patch sites for compatibility with 0.1.2 hook DLLs) and add
the E-Crew skills in battle feature labels to the launcher locales.

Verified with check-patches on 2.61.0.37 (0x10025dd) and 2.61.0.58
(0x100700d), native wto_ws.dll build, launcher typecheck and build;
pending in-game verification.
2026-12-02 21:33:46 +08:00
N0VAN0M4LY 7bd17c4f74 fix(battle): enable in-flight reload in air arcade
Air arcade battles previously set isLimitedAmmo=true via VERSUS_SWITCHES.
Both the native in-flight rearm request and its host handler require
unlimited reserve ammunition, which prevented airborne reloading in Air AB.

Move isLimitedAmmo out of VERSUS_SWITCHES and set it to false only when
modeName is air_arcade, keeping limited ammunition for all other modes.

Verified with root npm run typecheck; pending in-game verification.
2026-12-02 21:32:42 +08:00
N0VAN0M4LY be772c0cea fix(launcher): keep copy maintenance progress across tab switches 2026-12-02 20:24:30 +08:00
N0VAN0M4LY fa7f68b942 feat(launcher): use two-column About layout and add Discord link 2026-12-02 20:06:51 +08:00
N0VAN0M4LY 899fb5d91b fix(server): persist selectable battle ratings
Validate the selected rank against owned modifications and return the saved profile.

Use the saved rank delta for mode eligibility and room matchmaking.

Verified with typecheck and a local 2.61.0.58 server run using temporary data. In-game acceptance is pending.
2026-12-02 19:55:41 +08:00
N0VAN0M4LY fb7d07f4f9 feat(launcher): add About log export shortcut and runtime logging toggle
Launcher release / release (push) Canceled after 0s
Add a quick ZIP log export button to the About page (also bundling the latest embedded browser -browser.log while excluding player saves) and add a runtime logging toggle under Settings -> Diagnostics that controls launcher file logs, local server traffic logs, and wto_ws.log via log=0 in wto_ws.cfg. Update the v0.1.2 release note accordingly.
2026-12-02 17:41:49 +08:00