refactor(world): data-driven tiledata behind an IMapFormat seam (#143) #145
No reviewers
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo!145
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/tiledata-data-file"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Moves every tile definition out of code and into one committed data file, read through a swappable format seam — the foundation the map editor (#113) will build on. Full #143.
Before, adding a biome meant editing four code places (
TerrainTypeenum +TerrainInfo+ the map legend +BiomeVisuals), and a static meant aStaticCatalogcode entry. Now:content/tiledata.txtis the single source of truth (our UOtiledata.mul, as diffable text): one row per terrain/static giving its flags + art —terrain <id> <char> <walkable> <blocksSight> <landArt> <tint>andstatic <id> <blocks>. Adding a biome or static kind = one row + its art, zero code.IMapFormatis the one seam that knows the on-disk shape;TextMapFormatis the text implementation (all parsing and serialization live there).TileData/TileMapare now pure domain objects. Swapping to a compiled binary at world scale (#114) = one newIMapFormat+ one registration, no consumer touched. This is the #115IMapSourceseam.TerrainTypeenum is gone — terrain is a string id everywhere;TerrainInfo,StaticCatalog,BiomeVisualsare deleted, absorbed intoTileData. (TerrainTypewas not a wire type, so noProtocolVersionchange.)(x,y)to pick ground-tile variants/flips (GroundTileSelector, deleted) or to scatter marsh plants (VisibleMarshScatter/DrawMarshScatter, deleted). Each cell draws exactly its biome's one authored ground tile (UO-style). Decorations, when wanted, come back as authored passable statics (#141), not generated. No runtime code branches onmarsh/tree/reedsany more — only on flags.Loss of the enum's compile-time completeness is paid back by load-time validation (unique ids/chars, well-formed fields, unknown map char →
FormatException): a bad definition fails loudly at startup, never silently at runtime.The completed design + Invariants Check are recorded on #143; a heads-up was left for @andrea on #135/#137/#138/#140 (this refactors the #142 terrain foundation those build on — they will rebase onto the string-id +
TileDatamodel).Screenshots / recording
Piloted from a fresh database via the debug harness. In-world at (24,26): biomes render as distinct bands (grass with real art; salt-plain/desert as the tiledata placeholder tints until biome art #137), trees render/occlude/collide from the static layer, ground items render — all driven through the new
tiledata+IMapFormatpipeline, and the ground is uniform (no procedural variety/scatter, as intended). Server started with no error, which itself provestiledata.txt+ the map load correctly through the seam.Commands:
login test;goto 24 26;screenshot.How it was tested
TextMapFormatTests(tiledata parse + malformed rejection: dup id/char, unknown row, bad bool/tint, missing fields; tiledata + map read↔write round-trip),TileMapTestsrewritten to the string-id API (incl. unknown-map-char now rejected). Shared test scaffolding centralised inTestTiles/TestWorld.Parse(loads the committed tiledata once).just lint(CSharpier + analyzers, zero warnings) andjust test(407 tests) green; whole solution builds incl. client + tools.Checklist
just lintpasses (CSharpier + analyzers, zero warnings)just testis greenCloses #143.