Sparse Grid Layers #152

Open
opened 2025-11-29 15:00:49 +00:00 by john · 0 comments
Owner

layers should have a default value: mcrfpy.Color for ColorLayer, int for TileLayer. (for regular / "dense" layers, this is just an initial fill)

The sub-grid system for a sparse layer should store a "default" texture that all non-dirty, unmodified subgrid chunks can render. The first time a sub-grid is marked dirty, the sparse layer should instantiate the sub-grid sized region and begin tracking contents there.

Use cases:

  • default fog: With no data, we just apply the same color with alpha layer to the entire map, and selectively (or never!) modify sections of it.
  • Color effects on unanimated sprites: let's say there's a puddle of lava I want to animate: I can use a bright red or grey sprite for the lava itself, and apply noise-generated colors to a layer above the sprite. I could even animate the color cells: the sparse effect layer only has a small amount of tile data, and the sprite layer below it is never modified.
  • Enormous rectangular size for awkward shaped maps: a 10,000 x 10,000 map would have 100M cell positions. But if our world really only had a rough 'X' shape that's 2000 tiles wide, we could pathfind from (0, 0) to (10000, 10000) across the full TCOD map while leaving ~80% of the map sparsely empty of tile data.
layers should have a default value: `mcrfpy.Color` for `ColorLayer`, `int` for `TileLayer`. (for regular / "dense" layers, this is just an initial fill) The sub-grid system for a sparse layer should store a "default" texture that all non-dirty, unmodified subgrid chunks can render. The first time a sub-grid is marked dirty, the sparse layer should instantiate the sub-grid sized region and begin tracking contents there. Use cases: * default fog: With no data, we just apply the same color with alpha layer to the entire map, and selectively (or never!) modify sections of it. * Color effects on unanimated sprites: let's say there's a puddle of lava I want to animate: I can use a bright red or grey sprite for the lava itself, and apply noise-generated colors to a layer above the sprite. I could even animate the color cells: the sparse effect layer only has a small amount of tile data, and the sprite layer below it is never modified. * Enormous rectangular size for awkward shaped maps: a 10,000 x 10,000 map would have 100M cell positions. But if our world really only had a rough 'X' shape that's 2000 tiles wide, we could pathfind from (0, 0) to (10000, 10000) across the full TCOD map while leaving ~80% of the map sparsely empty of tile data.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: john/McRogueFace#152
No description provided.