Files
WT-Offline/mod-dev-docs/en/07-troubleshooting-and-faq.md

8.1 KiB
Raw Permalink Blame History

07 · Troubleshooting, Logs, Reload Loop & Packaging

1. Where to Check Logs When Something Goes Wrong

All mod build and runtime logs flow into the launcher's standard log directory—open Settings › Diagnostics › Open logs folder or About › Export diagnostics:

  1. Launcher Main Log (launcher.log):
    • Filter [build]: see which mods ran in the current build, .vromfs.bin overlay counts, and exact reasons why any gui-patches or exe-patches item was skipped;
    • Filter [mods]: see cross-drive Junction mounts, skipped native player-file collision warnings, and restored on-demand stock packs;
    • Filter [server] or [mod:<yourModId>]: see server tuning validation errors, script load stack traces, and everything printed via ctx.logger.info/warn/error.
  2. Game Client Runtime Logs (<copyFolder>/.game_logs/*.clog):
    • If a client UI script throws at runtime or hangs on "Loading", check the newest .clog (and run sq.exe full bytecode verification from Chapter 04);
    • If a custom 3D model fails to appear, search .clog for [PACK], pkg_user, or your asset name to confirm engine mounting.

2. Common Issues & Solutions Lookup Table

Symptom / Log Message Common Cause Solution
Discovery error on Launcher Mods page mod.jsonc syntax error, unknown field name, uppercase/invalid id, or missing server.entry file Validate mod.jsonc against the schema table in Chapter 01 Section 5
"Blocking mod errors" when clicking Launch Missing or disabled requires dependency, or two enabled mods declaring conflicts Enable the missing dependency or disable one of the conflicting mods highlighted in red
server/tuning/*.jsonc changes appear ignored Test client has a manual override saved in the Launcher Tuning tab (<dataFolder>/tuning/*.jsonc has highest priority), or store.jsonc placed vehiclePacks subkeys at root Reset overridden fields in the Launcher Tuning tab and check vehiclePacks nesting + "gjn" key names in Chapter 05
Server .ts fails with syntax or module-not-found error Raw .ts used enum/namespace, or value-imported import { ... } from '@wto/mods' Replace enum with as const + union type; use import type { ... } from './server-api.ts' for types
gui-patches fails with the data pack has no script ... variant.file in patch.jsonc used camelCase / uppercase letters (e.g. scripts/gameModes/...) Change variant.file to all lowercase (e.g. scripts/gamemodes/gamemodeselect.nut)
Standalone .css stylesheet has no effect Added .css to client/packs/gui.vromfs.bin/ without registering it in gui/css.css Add a client/gui-patches/ patch on gui/css.css appending @import "folder\style.css" (Chapter 04 Section 2.2)
Client matchingApiFunc callback does not fire or params arrive empty Swapped the 2nd and 3rd arguments of matchingApiFunc Use matchingApiFunc(methodName, callback, params) (callback is 2nd, params is 3rd)
Game hangs indefinitely on "Loading" before hangar Resulting complete .nut file has a lexical scope collision, undeclared identifier, base keyword misuse, or backtick string `...` Run sq.exe compilestring on the complete .nut file and use $"..." for string interpolation
Log reports overlaps protected core patch Mod client/exe-patches/ overlaps locked core offline/isolation patch bytes Core isolation bytes are protected; pick a non-overlapping site or use a server-side hook
Log reports target already exists as a native/player file A path under client/files/ collides with a player-owned file in UserSkins/ or UserSights/ Prefix bundled companion subfolders with your mod namespace (e.g. mod_<yourId>_...)

3. Development Reload Loop (Fastest Edit-Test Cycle)

Knowing when client builds versus server scripts reload keeps iteration fast while developing:

  1. Client-side edits (client/packs/, client/gui-patches/, client/exe-patches/, client/addon/, client/files/, config-blk.patch.blk / .jsonc):
    • Close the running game client first;
    • Save your edited mod files and click Launch in the launcher: the launcher hashes source file sizes and mtime timestamps into a deterministic build fingerprint, automatically rebuilding any affected .vromfs.bin packs from wtoffline/stock/ before starting the game!
    • Tip: textures inside already-mounted NTFS Junction directories (client/addon/res/ or client/files/UserSkins/<subfolder>/) point directly to your mods/ folder with zero copying, so restarting the client (or refreshing skins in-game) reads updated assets immediately.
  2. Server-side edits (server/index.ts & server/tuning/*.jsonc):
    • Every time you exit the game and click Launch to start a new session, the local server restarts cleanly, re-merges all server/tuning/*.jsonc overlays, and reloads server/index.ts with a cache-busting ESM query (?wto_mod=<timestamp>)—no need to restart the launcher itself.

4. Packaging & Sharing Your Mod (.zip Layout Rules)

When packaging your mod for players to download, follow a consistent archive structure so unzipping into mods/ works every time:

  1. Wrap your mod in a single top-level <mod-folder>/ directory inside the .zip: For a mod folder named my-awesome-mod, structure my-awesome-mod.zip as:
my-awesome-mod.zip
└─ my-awesome-mod/          <-- Single top-level folder (extracting straight into mods/ yields mods/my-awesome-mod/mod.jsonc)
   ├─ mod.jsonc
   ├─ client/
   └─ server/
  • Do NOT place mod.jsonc loose at the root of the .zip (extracting into mods/ scatters loose files across mods/ where discovery ignores them);
  • Do NOT double-nest folders (my-awesome-mod/my-awesome-mod/mod.jsonc), as the launcher scans direct child directories of mods/ only!
  1. Exclude development & temporary clutter: Omit .git/, node_modules/ (bundle third-party JS dependencies into a single server/index.mjs if needed), .DS_Store, Thumbs.db, editor backup files (*.bak, *.swp), and any unpacked stock game reference files.

5. Cross-Drive & Non-NTFS Disk Behavior

  • NTFS Volumes (standard on Windows): client/addon/ (3D models & textures) and mod-exclusive subfolders (e.g. UserSkins/<subfolder>) mount via NTFS Directory Junctions—works across drives, requires no admin rights, uses 0 extra disk space, and completes in ~1 ms;
  • Shared Flat-Folder Files (e.g. sound/mod/*.bank): tries file symlink (zero-copy across drives when Windows Developer Mode is on) → same-drive NTFS hardlink → incremental size/mtime cached copy (unchanged files are skipped on subsequent launches);
  • exFAT External Drives: since exFAT does not support Junctions or hardlinks, the deployer automatically falls back to incremental size/mtime cached copies with full functional parity.

6. Practical Recommendations for Mod Authors

  1. Namespace Everything: format your mod ID as <author>.<mod-name> and prefix custom vehicle IDs, weapons, skin subfolders, custom matching RPCs (wto_mod.<mod_name>.*), and custom Char actions to avoid collisions between mods;
  2. Prefer Incremental Patches Over Replacing Shared Tables: use .patch.blk (or .patch.jsonc) / .patch.csv for shop.blk, wpcost.blk, unittags.blk, units.csv, and menu.csv, and use $listOps on shared tuning arrays like multiVehiclePacks and supplyTrophies;
  3. Read Stock Profiles, Persist in Isolated Storage: write all custom mod state to ctx.storage.forPlayer(userId) so player saves remain 100% clean if your mod is disabled or uninstalled;
  4. Keep UI Logic in Standalone Files: put custom modals under client/packs/gui.vromfs.bin/ and keep client/gui-patches/ down to a few lines wiring the entry button and gui/css.css @import so game updates rarely break your mod;
  5. Run One Full "Enable → Play → Disable → Relaunch" Cycle Before Release: verify your mod works when enabled, restores stock behavior cleanly when disabled, and coexists peacefully alongside other enabled mods.