DiscreteMap serialization via bytes #293
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
#294 Entity.gridstate as DiscreteMap reference
john/McRogueFace
Reference
john/McRogueFace#293
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?
Summary
Enhance
DiscreteMapwithbytes-based serialization and state count awareness, making it the universal primitive for grid-shaped data with a small number of discrete states.Motivation
DiscreteMap already represents 2D arrays of discrete values tied to grid dimensions. Multiple systems need to persist and transfer this kind of data:
All of these are arrays with far fewer than 255 states whose dimensions match a grid's width × height. A unified serialization format avoids per-system bespoke solutions.
Proposed API
Design notes
num_statesenables validation on set operations and could enable future bit-packing optimization (e.g., 2-state maps → 1 bit per cell)to_bytes()/from_bytes()use Pythonbytesobjects — trivially writable to files, sendable over network, storable in save game dictsRelation to other issues