GridData has no identity attribute, so a projection cannot say which map it came from #403

Open
opened 2026-07-27 14:27:11 +00:00 by john · 0 comments
Owner

Found while implementing GridData.observe() / mcrfpy.VisibilityMask for the simulation-harness observation seam (see src/PyGridDataMethods.cpp:PyGridData::py_observe, src/PyVisibilityMask.{h,cpp}).

UIGridView/Grid has a .name property (inherited from UIDrawable), but GridData — the non-drawable data object observe() is a method on, and the type entity.grid returns since the Grid/GridView/GridData 1.0 split — has no name or identity attribute at all (confirmed: no "name" getter anywhere in PyGridData*/GridData.h).

This matters for observe()/VisibilityMask specifically: a VisibilityMask (see src/PyVisibilityMask.h) is meant to be "an immutable, storable record of which cells were visible, from where, at which frame" — suitable for fog-of-war persistence or replaying observation history. But nothing in the mask or the observe() return dict records which grid/map the snapshot was taken from. A caller storing multiple snapshots (e.g. one per level, or one per simulation arm) has no way to recover the source map's identity from the snapshot alone — they must separately track a live view object alongside every stored VisibilityMask/dict, which defeats some of the point of an inert, storable record.

Suggested fix: add a name (or similar identity) property to GridData itself, independent of any UIGridView currently pointing at it, and have observe() include it in the returned dict / consider stamping it on VisibilityMask.

Found while implementing `GridData.observe()` / `mcrfpy.VisibilityMask` for the simulation-harness observation seam (see `src/PyGridDataMethods.cpp:PyGridData::py_observe`, `src/PyVisibilityMask.{h,cpp}`). `UIGridView`/`Grid` has a `.name` property (inherited from `UIDrawable`), but `GridData` — the non-drawable data object `observe()` is a method on, and the type `entity.grid` returns since the Grid/GridView/GridData 1.0 split — has no name or identity attribute at all (confirmed: no `"name"` getter anywhere in `PyGridData*`/`GridData.h`). This matters for `observe()`/`VisibilityMask` specifically: a `VisibilityMask` (see `src/PyVisibilityMask.h`) is meant to be "an immutable, storable record of which cells were visible, from where, at which frame" — suitable for fog-of-war persistence or replaying observation history. But nothing in the mask or the `observe()` return dict records *which grid/map* the snapshot was taken from. A caller storing multiple snapshots (e.g. one per level, or one per simulation arm) has no way to recover the source map's identity from the snapshot alone — they must separately track a live view object alongside every stored `VisibilityMask`/dict, which defeats some of the point of an inert, storable record. Suggested fix: add a `name` (or similar identity) property to `GridData` itself, independent of any `UIGridView` currently pointing at it, and have `observe()` include it in the returned dict / consider stamping it on `VisibilityMask`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#403
No description provided.