GridData SoA refactor: dense uint8 planes for walkable/transparent #332
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
john/McRogueFace#332
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
From the 2026-07-02 memory-model review. Internal refactor -- Python only sees cells through
grid.at(x,y)proxies, so the API is unchanged. This is the single highest-leverage change for both memory and numpy/AI integration.Current storage
UIGridPointis array-of-structs, 24 bytes/cell for 2 bytes of payload (src/UIGridPoint.h:31-54):bool walkable, transparent(the actual data)int grid_x, grid_y(redundant -- derivable from index)GridData* parent_grid(back-pointer used only for TCOD sync on write)Grids >64 in either dimension switch to chunked storage (
CHUNK_THRESHOLD=64,src/GridData.h:50-59,src/GridChunk.h) -- non-contiguous, so no whole-grid zero-copy view is possible at all today.Proposal
Store logic data as two dense row-major
std::vector<uint8_t>planes (walkable,transparent) on GridData -- the same shapeDiscreteMapalready uses (src/DiscreteMap.h). Drop chunking for logic data entirely: a 1024x1024 grid is 2 MB as two planes; chunking only pays for render caches, whichGridLayersalready handles independently per-layer (src/GridLayers.h:42-45).GridData::at(x,y)returns a proxy (the PythonGridPointwrapper already goes through getattro/setattro,src/UIGridPoint.cpp:167-256) that reads/writes the planes.grid_x/grid_y/parent_griddisappear; the wrapper carries coordinates + grid ref itself.Benefits
Risks / checks
UIGridPoint&across calls (grepUIGridPoint&); FOV/path code reads via TCOD map so mostly unaffected.apply_threshold/apply_rangesloops, fullsyncTCODMap, step-heavy scenes.Related: #152 (sparse layers -- orthogonal; sparse applies to render layers, logic planes stay dense), #124.