docs(mods): fix schema errors and expand bilingual mod handbook to full parity

Fix store.jsonc vehiclePacks nesting and gjn field name, matchingApiFunc callback argument order, and DaGui CSS @import/lowercase rules; add stock archive inspection steps, BR-to-mrank table, cloned vehicle walkthrough, tuning field reference, and official-map-selector full-stack trace while bringing en/01..07.md to full 1:1 parity with zh-CN/.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 11:25:54 +08:00
1 parent e79866b96e
commit a2fdcc1f15
15 files changed
+2320 -468

No files matched your search

+83 -19
View File
@@ -1,33 +1,97 @@
# 03 · Adding Custom 3D Vehicle Models & Textures
## 1. How 3D Asset Mounting Works
This chapter explains how to build **brand-new 3D vehicle mods shipping custom geometry (`.grp`) and texture packs (`.dxp.bin`)** in WTOffline so multiple vehicle packs from different authors stack cleanly, mount across drives with zero copying, and roll back cleanly when disabled.
Verified directly against 2.61.0.x `aces.exe` (`dlContent.cpp`) and `config/settings.blk`:
- Any addon path under `/pkg_user/` skips the `res/grp_hdr.vromfs.bin` check and directly scans `<addon>/res/` for all `.grp` (3D geometry/skeleton/collision) and `.dxp.bin` (DDSx texture) archives;
- If a mod ships a compiled CDK `res/grp_hdr.vromfs.bin`, the patcher mounts it under `content/pkg_wto_<modId>` so the native `grp_hdr` loader handles it;
- The patcher automatically registers all enabled mod addon folders in `aces.vromfs.bin` `config/settings.blk` (`addons`, `addons_no_check`, `addonsWithBasePath`).
---
### Cross-Drive Zero-Copy Mounting
## 1. Plain-Language Asset Glossary & Zero-Copy Mounting
Each mod's `client/addon/` is mounted into `<copy>/content/pkg_user/<safeModId>` via a **Windows NTFS Directory Junction**:
- Works across drives (e.g. `mods/` on C: or D:, client on J:);
- Requires no administrator privileges;
- Uses 0 extra bytes and mounts/unmounts in ~1 ms without touching source files in `mods/`.
When working with 3D vehicle mods, you will encounter four core asset and filesystem terms:
| Term / Extension | Plain-Language Meaning |
| --- | --- |
| **`.grp`** | Dagor Engine **3D geometry & skeleton archive** (exported from the official War Thunder CDK `AssetViewer` / exporter), containing multi-LOD meshes, animation skeleton nodes (`animChar`), collision volumes, and internal damage-model (DM) parts. |
| **`.dxp.bin`** | Dagor Engine **compressed texture pack**, bundling multiple diffuse, normal, and metallic/roughness DDSx textures referenced by name inside `.grp` materials. |
| **`.ddsx`** | A **single** Dagor compressed texture file (DDSx), commonly used for UI stat-card vehicle portraits (`ui/images.vromfs.bin/units/<unit_id>.ddsx`) or standalone skin textures. |
| **NTFS Directory Junction** | Think of it as an **OS-level zero-copy folder shortcut** built into Windows NTFS: when the game engine opens `<copy>/content/pkg_user/<modId>`, Windows transparently serves the files straight from your `mods/` folder on any drive—**no administrator rights needed, works across drives, consumes 0 extra disk bytes, and mounts/unmounts in ~1 ms**! |
### How the Engine Discovers `client/addon/` Automatically
Verified directly against 2.61.0.x `aces.exe` (`dlContent.cpp`) and `aces.vromfs.bin/config/settings.blk`:
- The patcher automatically registers every enabled mod's addon mount path into `addons`, `addons_no_check`, and `addonsWithBasePath` inside `config/settings.blk`;
- Any addon path under `/pkg_user/` (mounted by default at `<copy>/content/pkg_user/<safeModId>`) **skips the mandatory `res/grp_hdr.vromfs.bin` header check and directly scans `<addon>/res/` for all `.grp` model and `.dxp.bin` texture archives**, registering them into the global asset manager;
- If your mod ships an official CDK-compiled `res/grp_hdr.vromfs.bin`, the patcher mounts it at `<copy>/content/pkg_wto_<safeModId>` so the native `grp_hdr` loader handles it;
- Disabling a mod removes only the directory junction itself and never deletes or modifies your source files inside `mods/`.
---
## 2. 6-Step Checklist for a Custom 3D Vehicle
1. **`client/addon/res/<unit>.grp` + `<unit>.dxp.bin`**: 3D model and textures exported via War Thunder CDK;
2. **`client/packs/aces.vromfs.bin/gamedata/units/.../<unit>.blk`**: vehicle FM/DM/weapons (plain text BLK compiles automatically);
3. **`client/packs/char.vromfs.bin/config/wpcost.blk.patch.jsonc`**: economy, BR, modifications (use `cloneBlock` from a similar stock vehicle);
4. **`client/packs/char.vromfs.bin/config/shop.blk.patch.jsonc`** & **`unittags.blk.patch.jsonc`**: tech tree slot and unit tags;
5. **`client/packs/lang.vromfs.bin/lang/units.csv.patch.csv`**: localized names (`_shop`, `_0`, `_1`, `_2`);
6. **`client/packs/ui/atlases.vromfs.bin/gameuiskin/<lowercase_unit>_ico.svg`** & optional **`ui/images.vromfs.bin/units/<unit>.ddsx`**: silhouette icon (used in tech tree and local web store) and statcard image.
Suppose your mod ID is `demo.new-mbt` and your new vehicle's internal ID is `us_mbt_demo`:
```text
mods/demo-new-mbt/
├─ mod.jsonc
└─ client/
├─ addon/
│ └─ res/
│ ├─ us_mbt_demo.grp # ① 3D meshes, skeleton & collision (CDK export)
│ └─ us_mbt_demo.dxp.bin # ① Compressed texture pack (DDSx)
└─ packs/
├─ aces.vromfs.bin/
│ └─ gamedata/units/tankmodels/
│ └─ us_mbt_demo.blk # ② Physics, armor, turret & weapons (text BLK compiles automatically)
├─ char.vromfs.bin/
│ └─ config/
│ ├─ wpcost.blk.patch.jsonc # ③ Price, RP, BR & modifications (fastest via cloneBlock)
│ ├─ shop.blk.patch.jsonc # ④ Tech-tree column & position
│ └─ unittags.blk.patch.jsonc # ④ Unit class, hangar slot, test-drive mission & tags
├─ lang.vromfs.bin/
│ └─ lang/
│ └─ units.csv.patch.csv # ⑤ Localized names (_shop, _0, _1, _2)
├─ ui/atlases.vromfs.bin/
│ └─ gameuiskin/
│ └─ us_mbt_demo_ico.svg # ⑥ Tech-tree & local web store silhouette icon (all lowercase!)
└─ ui/images.vromfs.bin/
└─ units/
└─ us_mbt_demo.ddsx # ⑥ Stat-card / crew-slot portrait (optional; falls back to placeholder)
```
### Key Verification Checks
1. **Keep the vehicle's internal ID identical everywhere**: the `tankmodels/us_mbt_demo.blk` filename (or `flightmodels/us_jet_demo.blk` for aircraft) and the block names in `wpcost.blk`, `shop.blk`, and `unittags.blk` must match character for character.
2. **`ui/atlases.vromfs.bin` icon paths must be all lowercase**: stock icon packs store paths in lowercase, so name your icon `gameuiskin/<lowercase_unit_id>_ico.svg` (the local web store also displays this exact SVG on pack cards!).
3. **Match `.blk` asset names to `.grp` exports**: `model:t="..."` inside `gamedata/units/tankmodels/us_mbt_demo.blk` must match the exact asset name exported into your `.grp` archive from the CDK.
---
## 3. Native Skins, Sights & Companion Files Boundary
## 3. Regular Tech-Tree Vehicles vs `gift` Store Packs (& AI Bot Pool Rules)
- Standalone user skins (`UserSkins/`), sights (`UserSights/`), and missions (`UserMissions/`) continue to use the game's native folders and are never managed or deleted by the launcher.
- Large overhaul/vehicle mods may optionally bundle companion skins, sights, or sound banks under `client/files/`. Exclusive subdirectories under `UserSkins/`, `UserSights/`, and `UserMissions/` mount via cross-drive Junctions; any target colliding with a player-owned native file is skipped with a warning and never overwritten.
In `wpcost.blk.patch.jsonc` and `shop.blk.patch.jsonc`, you can wire your custom vehicle either as a **regular Silver Lions researchable vehicle** or as a **local web store pack vehicle**:
### Option A: Regular Silver Lions Tech-Tree Vehicle (Recommended If You Want AI Bots to Drive It)
- Set normal `value` (Silver Lions price) and `reqExp` (Research Points) in `wpcost.blk`, and **omit** `gift`, `premPackAir`, `costGold`, `event`, and `researchType` (squadron tag), as well as `showOnlyWhenBought:b=yes` in `shop.blk`;
- **Automatically joins the AI bot pool**: the local server's matchmaking bot selector (`battle-ranks.ts`) automatically includes tech-tree vehicles (`inTechTree` in `shop.blk`) that have **none** of `gift`, `premPackAir`, `event`, `researchType`, or `showOnlyWhenBought`! Both friendly and enemy AI bots at matching BRs and nations will spawn in your custom vehicle during offline battles.
### Option B: Local Web Store Pack Vehicle (`gift:t="msi_notebook"`)
Modders inspecting stock `wpcost.blk` / `shop.blk` often wonder: **why do dozens of pack vehicles say `gift:t="msi_notebook"`?**
- In stock War Thunder, any non-empty `gift:t="..."` string (Gaijin historically reused promo strings like `"msi_notebook"` across countless store vehicles) marks the vehicle as an external store pack/gift unit whose **Order** button opens the web store instead of spending Silver Lions or Golden Eagles;
- **WTOffline auto-generates a local web store bundle**: during copy building, WTOffline scans every vehicle carrying `gift` in `wpcost.blk` and automatically registers a deterministic local store product ID **`wto_pack_<unitId>`** (e.g. `wto_pack_us_mbt_demo`) and bundle GUID:
- Even with zero server config, the local web store automatically prices the pack using `vehiclePacks.byRank` for the vehicle's `rank` tier so players can buy and unlock it right away in the in-game store!
- To customize its GJN price, Golden Eagles bonus, or Premium days, simply add an entry under `vehiclePacks.byVehicle` in `server/tuning/store.jsonc` (see Chapter 05).
- **AI Bot Pool Note**: vehicles carrying `gift`, `premPackAir`, `event`, `researchType`, or `showOnlyWhenBought` are intentionally **excluded** from the automatic AI bot pool so rare pack prototypes do not flood standard bot lineups.
---
## 4. Companion Skins, Sights, Sounds & the Native Folder Boundary
- **Standalone skins, sights & single-player missions**: players should continue placing standalone files directly into the game's native `UserSkins/`, `UserSights/`, and `UserMissions/` folders—the launcher never touches or deletes player-managed native folders, and they **do not** need to be wrapped as mods;
- **Companion assets bundled inside a large vehicle overhaul mod**: if your custom vehicle mod includes dedicated camouflages, custom FCS gun sights, or custom cannon sound banks, place them under `client/files/` so they mount and unmount together with the mod:
- `client/files/UserSkins/mod_us_mbt_demo_camo/...` (mod-exclusive subfolder → mounts across drives via zero-copy NTFS Junction)
- `client/files/UserSights/us_mbt_demo/...` (mod-exclusive subfolder → mounts across drives via zero-copy NTFS Junction)
- `client/files/sound/mod/my_cannon.bank` (shared flat directory file → tries file symlink → same-drive hardlink → size/mtime incremental cached copy)
- **Native Player File Protection**: if any target path under `client/files/` already exists in the game folder as a player-created native file or folder, the launcher skips that item with a log warning and **never overwrites or deletes player content**.