Expand description
Runtime map loading for zero-Rust game projects.
A map lives in <maps_dir>/<MapId>/ and consists of:
map.tmx.json— a Tiled JSON map. Visual layers render in stack order, split at the player’s elevation by their integer custom propertylevel(default 0):level <= player elevationdraws below sprites, above it draws over them. The data layers are never rendered:collisionis the level-0 collision grid,collisionNthe level-N grid (any non-zero GID marks a solid tile at that level), andstairsmarks elevation transitions (GID 1 = ascend on arrival, 2 = descend).tileset.png— a row-major tile atlas sliced bycrate::tileset::PngTilesetusing the TMXtilewidth/tileheight.- an entity sidecar — the dotzuki-editor writes
objects.json({npcs, warps, …}); older fixtures usedmap.json.MapObjects::loadtriesobjects.jsonfirst and falls back tomap.json; neither being present yields an empty sidecar, not an error.
Structs§
- Encounter
Config - Random-encounter configuration in the objects sidecar (same shape as
pokered’s
wild_data: a per-step rate byte in /256 units —rate: 25≈ a 9.8% trigger chance per step — plus grass-like zones). - Encounter
Table Entry - A random-encounter table entry: a species/encounter id and its relative
weight. The
idis resolved at battle start bycrate::battle::BattleSetup::start_with— an encounter record first, then a single enemy record (trainer queues and wild singles both work). - Encounter
Zone - One encounter zone: an inclusive map-tile rectangle plus the weighted table drawn from when a step lands inside it.
- MapObjects
- The per-map entity sidecar: NPCs, warps, signs and random encounters.
- NpcDef
- A placed NPC in the per-map objects sidecar.
- Runtime
Map - A loaded runtime map: visual layers, per-level collision grids, the stairs grid, tileset pixels and the entity sidecar.
- SignDef
- A sign tile in the objects sidecar.
- WarpDef
- A warp tile in the objects sidecar.
Constants§
- LEGACY_
SIDECAR - Legacy sidecar filename, read as a fallback when
objects.jsonis absent. - OBJECTS_
SIDECAR - Filename of the entity sidecar the dotzuki-editor writes today.
Functions§
- map_dir
- Convenience: the directory of one map under a project’s maps dir.