Read both damage tables in config/rendinst_dmg.blk. riExtra blocks are named after each destructible object and often carry hp without a destructionImpulse, so dry-stone and wooden fences, metal railings, sandbags and car wrecks were baked as solid walls. Stock damage data now decides before model-name guesses, with the impulse and hp limits in the navBake tuning section. Flag chokepoints on the eroded voxel field instead of per polygon. A span is a chokepoint only when no passable span within reach has room for a passage chokepointMaxWidthVehicles wide, so long polygons touching a wall no longer mark open yards. Chokepoints become WTO_FLAG_CHOKEPOINT on all three tiers and keep their surface area. Let roads cover rough slopes, map Poland's concrete streets as road, and add an extractor --report with ground material shares and per-object classification. Previews draw short cover ticks and record 300 DPI. Verified with Rust release and MSVC builds without warnings, TypeScript checks, and rebakes of Berlin, Poland and Hurtgen on 2.61.0.58 with 15/15, 416/416 and 840/840 spawn-to-capture connectivity on every tier.
166 lines
6.7 KiB
C
166 lines
6.7 KiB
C
/*
|
|
* Shared binary format definitions for WTOffline ground AI navigation data:
|
|
* - `.wtogeo`: offline intermediate geometry dump (extractor -> Recast baker)
|
|
* - `.wtonav`: runtime navigation pack (baked Detour meshes + covers + tactical grid)
|
|
*
|
|
* All coordinates are in Dagor world space (left-handed, Y up, metres).
|
|
*/
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define WTO_GEO_MAGIC "WTOGEO\0\1"
|
|
#define WTO_GEO_VERSION 3u
|
|
#define WTO_GEO_FLAG_ROAD_MASK 0x01u
|
|
#define WTO_GEO_FLAG_DOWNHILL_LINKS 0x02u
|
|
|
|
#define WTO_NAV_MAGIC "WTONAV\0\1"
|
|
#define WTO_NAV_VERSION 1u
|
|
|
|
#define WTO_NAV_TIER_COUNT 3u
|
|
#define WTO_NAV_TIER_NARROW 0u /* Tracked width <= 2.9 m (agentRadius 1.65 m) */
|
|
#define WTO_NAV_TIER_STANDARD 1u /* Tracked width <= 3.6 m (agentRadius 2.05 m) */
|
|
#define WTO_NAV_TIER_WIDE 2u /* Wide/heavy tracked > 3.6 m (agentRadius 2.45 m) */
|
|
|
|
/* Detour polygon Area IDs (0 = RC_NULL_AREA / unwalkable). */
|
|
enum WtoPolyArea {
|
|
WTO_AREA_UNWALKABLE = 0,
|
|
WTO_AREA_ROAD = 1,
|
|
WTO_AREA_BRIDGE = 2,
|
|
WTO_AREA_GROUND = 3,
|
|
WTO_AREA_ROUGH = 4,
|
|
WTO_AREA_FOREST = 5,
|
|
WTO_AREA_CRUSHABLE = 6,
|
|
WTO_AREA_SHALLOW_WATER = 7,
|
|
WTO_AREA_CHOKEPOINT = 8, /* Not baked: chokepoints keep their surface area, see WTO_FLAG_CHOKEPOINT */
|
|
WTO_AREA_EXPOSED = 9,
|
|
WTO_AREA_DEEP_WATER = 10,
|
|
WTO_AREA_NO_GO = 11
|
|
};
|
|
|
|
/* Detour polygon flags for runtime dtQueryFilter filtering. */
|
|
enum WtoPolyFlag {
|
|
WTO_FLAG_WALK = 0x01,
|
|
WTO_FLAG_SHALLOW_WATER = 0x02,
|
|
WTO_FLAG_DEEP_WATER = 0x04,
|
|
WTO_FLAG_CHOKEPOINT = 0x08, /* Narrower than navBake.chokepointMaxWidthVehicles for this mesh's tier */
|
|
WTO_FLAG_BLOCKED = 0x10,
|
|
WTO_FLAG_ROAD = 0x20, /* Surface identity, set on road polygons */
|
|
WTO_FLAG_DOWNHILL = 0x40, /* One-way Detour connection */
|
|
WTO_FLAG_PLATFORM = 0x80 /* Walkable top of a validated placed object */
|
|
};
|
|
|
|
/* Obstacle classification written into `.wtogeo` by the extractor. */
|
|
enum WtoObstacleClass {
|
|
WTO_OBS_HARD_SOLID = 0, /* Buildings, rocks, cliffs, bunkers, concrete walls */
|
|
WTO_OBS_BRIDGE_DECK = 1, /* Walkable bridge decks and ramps */
|
|
WTO_OBS_CRUSHABLE = 2, /* Wooden fences, hedges, low-HP destructibles */
|
|
WTO_OBS_TREE_THICK = 3, /* Thick immovable tree trunks (r >= 0.25 m) */
|
|
WTO_OBS_TREE_THIN = 4, /* Thin tree trunks / saplings (high-cost forest) */
|
|
WTO_OBS_HARD_NO_COVER = 5, /* Vehicle collision with no eligible cover surface */
|
|
WTO_OBS_PLATFORM = 6, /* Placed geometry with eligible upward-facing support surfaces */
|
|
WTO_OBS_PLATFORM_NO_COVER = 7 /* Support surfaces from vehicle-only collision */
|
|
};
|
|
|
|
/* Baked tank cover classifications. */
|
|
enum WtoCoverKind {
|
|
WTO_COVER_FULL = 1, /* Blocks hull + turret (reload, repair, corner peek) */
|
|
WTO_COVER_HULLDOWN = 2 /* Blocks hull, turret clear with forward firing arc */
|
|
};
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
/* Intermediate geometry bundle header (`.wtogeo`). */
|
|
typedef struct WtoGeoHeader {
|
|
char magic[8]; /* WTO_GEO_MAGIC */
|
|
uint32_t version; /* WTO_GEO_VERSION */
|
|
uint32_t flags; /* WTO_GEO_FLAG_* */
|
|
uint8_t everSha1[20]; /* Built-in SHA-1 from DBLD eVER block */
|
|
float waterLevel; /* Level water_level in metres (-1e6 if none) */
|
|
float boundsMin[2]; /* World XZ crop min (battle area union + margin) */
|
|
float boundsMax[2]; /* World XZ crop max */
|
|
uint32_t hmWidth; /* Cropped heightmap grid columns (X) */
|
|
uint32_t hmHeight; /* Cropped heightmap grid rows (Z) */
|
|
float hmCellSize; /* Metres per heightmap sample */
|
|
float hmOrigin[2]; /* World XZ of cropped sample (0, 0) */
|
|
uint32_t obsVertCount; /* Number of float3 obstacle vertices */
|
|
uint32_t obsTriCount; /* Number of obstacle triangles (uint32[3] + uint8 class) */
|
|
} WtoGeoHeader;
|
|
|
|
/* Optional trailer after obstacle triangles, followed by size*size uint8 road mask cells. */
|
|
typedef struct WtoGeoRoadMask {
|
|
uint32_t size;
|
|
float origin[2]; /* World XZ of the first LMp2 cell */
|
|
float cellSize;
|
|
} WtoGeoRoadMask;
|
|
|
|
/* Optional downhill links trailer: uint32_t count followed by records. */
|
|
typedef struct WtoGeoDownhillLink {
|
|
float endpoints[6]; /* From XYZ (high) followed by to XYZ (low) */
|
|
float radiusM; /* Detour endpoint attachment radius */
|
|
uint32_t tierMask;
|
|
} WtoGeoDownhillLink;
|
|
|
|
/* Baked tank cover point (68 bytes). */
|
|
typedef struct WtoCoverPoint {
|
|
float pos[3]; /* World XYZ parking position behind cover */
|
|
float coverDir[2]; /* Unit XZ vector pointing FROM pos TOWARD the blocked threat */
|
|
float retreatDir[2]; /* Unit XZ safe reverse/retreat direction away from cover */
|
|
float peekLeft[3]; /* World XYZ left corner peek spot (valid if hasPeekLeft) */
|
|
float peekRight[3]; /* World XYZ right corner peek spot (valid if hasPeekRight) */
|
|
float halfAngleDeg; /* Effective covered half-angle around coverDir */
|
|
float heightM; /* Continuous cover height above the final parking point */
|
|
float widthM; /* Continuous hard-obstacle width */
|
|
uint8_t kind; /* WtoCoverKind */
|
|
uint8_t hasPeekLeft; /* 1 if peekLeft is valid and navigable */
|
|
uint8_t hasPeekRight; /* 1 if peekRight is valid and navigable */
|
|
uint8_t reserved;
|
|
} WtoCoverPoint;
|
|
|
|
/* Low-resolution (8 m) tactical grid cell (4 bytes). */
|
|
typedef struct WtoTacticalCell {
|
|
uint8_t exposure; /* 0..255: static visibility exposure from enemy side */
|
|
uint8_t clearanceHalfM; /* Distance to nearest hard obstacle in 0.5 m units (0..127.5 m) */
|
|
uint8_t corridorTeam1; /* 0..255: Team 1 replay prior (128 = neutral) */
|
|
uint8_t corridorTeam2; /* 0..255: Team 2 replay prior (128 = neutral) */
|
|
} WtoTacticalCell;
|
|
|
|
/* Runtime navigation pack header (`.wtonav`, uncompressed payload header). */
|
|
typedef struct WtoNavHeader {
|
|
char magic[8]; /* WTO_NAV_MAGIC */
|
|
uint32_t version; /* WTO_NAV_VERSION */
|
|
uint32_t flags;
|
|
uint8_t everSha1[20]; /* Source level eVER SHA-1 fingerprint */
|
|
float bmin[3]; /* World AABB min */
|
|
float bmax[3]; /* World AABB max */
|
|
float waterLevel;
|
|
uint32_t tierCount; /* WTO_NAV_TIER_COUNT (3) */
|
|
uint32_t tierOffsets[WTO_NAV_TIER_COUNT];
|
|
uint32_t tierSizes[WTO_NAV_TIER_COUNT];
|
|
uint32_t coverOffset;
|
|
uint32_t coverCount;
|
|
uint32_t tacOffset;
|
|
uint32_t tacCols;
|
|
uint32_t tacRows;
|
|
float tacCellM;
|
|
float tacOrigin[2];
|
|
} WtoNavHeader;
|
|
|
|
/* Per-tier Detour blob layout at tierOffsets[t]:
|
|
* dtNavMeshParams (exact upstream struct)
|
|
* uint32_t tileCount
|
|
* repeated tileCount times:
|
|
* uint32_t tileDataSize
|
|
* uint8_t tileData[tileDataSize]
|
|
*/
|
|
|
|
#pragma pack(pop)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|