Files
WT-Offline/packages/patcher/src/index.ts
T
N0VAN0M4LY ba947fe5b6 feat(ground-ai): follow baked navmesh paths with sliced searches
Native engine (native/wto-nav):
- Path searches are queued per slot and advanced with Detour's sliced
  search inside a per-frame time budget (navEngine.pathBudgetMsPerFrame),
  so a 4 km search no longer stalls a frame. The synchronous find_path
  op is gone.
- The battle's pack is read on a background thread when the mission
  finishes loading (prefetch); load_map only takes the result.
- New mesh queries: probe (surface, flags, room to the mesh edge),
  raycast, nearest walkable point, and dynamic cost circles for wrecks,
  jams and fresh obstacles that later searches route around.

Ground AI scripts:
- route picks the mesh tier by vehicle width and the cost filter by
  tracked or wheeled, plans on goal change, drift off the corridor, a
  timer or reported obstacles, and falls back to the stock road mesh
  only when the battle decided on the fallback.
- follow steers at a speed-scaled lookahead point and brakes ahead of
  sharp corners, narrow passages and the destination.
- avoid casts rays from both front hull corners that drive through
  objects the bake marks crushable, follows slower traffic, steps aside
  or yields by size priority in narrow passages.
- unstick escalates deterministically: back up along the corridor, mark
  a jam and replan, then log the spot and hand the order back.
- Flank lanes are built through the queued searches; rallies are not
  released while their lanes are still being built.
- Removed the 9-arc forward probing, 7-arc reverse probing, 145 m
  straight shortcuts, 165 m snapping and random sideways detours.

Tuning: new pathFollow section, navEngine.goalSnapRadiusM and
pathBudgetMsPerFrame, navBake.crushableMaxRiExtraHp passed to the
scripts; retired navigation.cornerBrakeAccel, stuckWindowSec,
stuckMinMoveM and unstickReverseSec. Launcher fields and en/zh-CN labels
updated.

Checked: root and launcher typecheck, MSVC build with no warnings in
project code, check-patches for 2.61.0.58 and 2.61.0.60, offline engine
run on avg_poland (prefetch, sliced searches within budget, slot
replacement, dynamic costs), isolated game copy build. daScript
compilation and in-battle behaviour still need the in-game run.
2026-12-05 17:38:41 +08:00

142 lines
4.8 KiB
TypeScript

/**
* The patcher: builds the game copy by pointing the client at the local server
* and patching the executable. Used by the development script scripts/build-game-copy.ts and by
* the launcher. The patch definitions, the network hook library and the store pack ids are given
* by the caller.
*/
export {
buildGameCopy,
readStockGameFiles,
type GameCopyBuild,
type GameCopyFile,
type GameCopyInputs,
type ModBuildReport,
type StockGameFiles,
} from './build-game-copy.ts';
export { NETWORK_CONFIG_PATH, rebuildCharPack, type CharPackResult } from './char-pack.ts';
export {
copyPlayerDecalCache,
playerDecalCacheProblem,
readPlayerDecalIndexFiles,
resolvePlayerDecalCacheFolder,
writeDecalCacheIndexSnapshot,
} from './decals/player-decal-cache.ts';
export { blockingFailures, ESSENTIAL_FEATURES } from './essential-features.ts';
export {
patchExecutable,
patchExecutableWithMods,
type ExecutableResult,
type ModExecutableResult,
type ModExePatchFailure,
} from './executable.ts';
export {
addonMountFolderForMod,
collectModAddonMounts,
registerModAddonsInSettings,
type ModAddonMount,
} from './mods/addon-register.ts';
export {
computeModsBuildFingerprint,
CORE_BUILD_PACKS,
MODS_STATE_FILE,
prepareOptionalStockPacks,
readModsDeployState,
syncExternalModFiles,
writeModsDeployState,
type DeployedModEntry,
type DeployEntryKind,
type ModDeployWarning,
type ModExternalDeployResult,
type ModsDeployState,
} from './mods/deploy-external.ts';
export { applyModGuiPatches, type ModGuiPatchResult } from './mods/gui-overlay.ts';
export { applyModPackOverlays, type PackOverlayReport } from './mods/pack-overlay.ts';
export { assertWritableCopy, GAME_FILES, isInSteamLibrary, type WritableCopyOptions } from './game-copy.ts';
export { executableVersion } from './game-version.ts';
export {
hardlinkResourceRules,
isHardlinkableResource,
type HardlinkResourceRules,
} from './hardlink-resources.ts';
export {
GAME_AI_ARCHIVE_FOLDER,
GAME_AI_CONFIG_FILE,
GAME_PACK_FILE,
rebuildGamePack,
type GamePackResult,
type GroundAiBuildInputs,
} from './ground-ai/game-pack.ts';
export {
compileGroundAiConfigDas,
GROUND_AI_DRIVE_MODES,
GROUND_AI_MODES,
GROUND_AI_NAV_COST_KEYS,
isGroundAiActive,
type GroundAiConfig,
type GroundAiDriveMode,
type GroundAiLoadoutConfig,
type GroundAiMode,
type GroundAiNavCosts,
type GroundAiPathFollow,
} from './ground-ai/ground-ai-config.ts';
export { rebuildGuiPack, type AppliedGuiPatch, type GuiPackResult } from './gui-pack.ts';
export { loadGuiPatches, type GuiScriptEdit, type GuiScriptPatch, type GuiScriptVariant } from './gui-patch-definition.ts';
export {
AI_LIST_PATH,
ENGINE_SETTINGS_PATH,
EXTRA_STORE_BUNDLE_GUID_MAP,
EXTRA_STORE_BUNDLE_GUIDS,
rebuildMainPack,
type MainPackResult,
} from './main-pack.ts';
export { redirectAddresses, type AddressChange } from './network/address-rewrite.ts';
export { hostPort, localEndpoint, localUrl, type LocalEndpoint } from './network/local-endpoint.ts';
export { NETWORK_HOOK_LIBRARY, networkHookSettings } from './network/network-hook.ts';
export { redirectNetworkConfig, type NetworkRedirectReport } from './network/redirect-network-config.ts';
export { loadNativeModules, type NativeModule, type NativeSite, type NativeSiteVariant } from './native/native-definition.ts';
export { resolveNativeModules, type NativeResolution } from './native/native-resolve.ts';
export { patchFeatures, type PatchFeature } from './patch-features.ts';
export { checkPatchSet, type PatchSetSummary } from './patch-pack/check-patch-set.ts';
export {
compareAppVersions,
comparePackVersions,
formatManifest,
isPackVersion,
manifestIncompatibility,
MANIFEST_FILE,
packFileNames,
packVersionOfTag,
parseManifest,
PATCH_PACK_FORMAT,
PATCH_PACK_TAG_PREFIX,
type ManifestIncompatibility,
type PatchPackFileNames,
type PatchPackManifest,
} from './patch-pack/manifest.ts';
export { packGameVersions, readPatchPack, writePatchPack, type PatchPackContents, type PatchPackFile } from './patch-pack/pack-archive.ts';
export { PatchPackError, type PatchPackProblem } from './patch-pack/patch-pack-error.ts';
export { patchPackTuning, type PatchPackTuning } from './patch-pack/patch-pack-tuning.ts';
export {
generateSigningKeys,
packSigningPublicKey,
signEd25519,
signPatchPack,
SIGNING_PUBLIC_KEY_FILE,
verifyEd25519,
verifyPatchPack,
type SigningKeyPair,
} from './patch-pack/signature.ts';
export { patchSetFolders, type PatchSetFolders } from './patch-set.ts';
export { offlinePackBundleGuids } from './store/offline-bundles.ts';
export {
checkGameBuild,
compareVersions,
formatVersionRecord,
loadVersionRecords,
recordedGameVersions,
recordFileName,
type RecordInputs,
type VersionRecord,
} from './version-record.ts';
export { writeGameCopy } from './write-game-copy.ts';