Behavior data struct and primitive implementations #300
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
Depends on
#301
grid.step() — turn manager for entity behaviors
john/McRogueFace
#297
mcrfpy.Behavior enum — behavior type identifiers
john/McRogueFace
#298
mcrfpy.Trigger enum — behavior trigger type identifiers
john/McRogueFace
#299 Entity
step() callback — Python-side turn handler
john/McRogueFace
Reference
john/McRogueFace#300
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
Implement the behavior system as a tagged union/variant data struct on entities. Each behavior type determines what action an entity takes on its turn.
Data structure
Python API
Behavior details
step()whenIDLECUSTOMstep(DONE, None)every turnNOISE4NOISE8PATHDONE: arrived.BLOCKED: next cell has collide-label entityWAYPOINTDONE: last point reachedPATROLDONE: full patrol cycle (back to start)LOOPSLEEPDONE: counter reaches 0 (auto-set to idle before calling step)SEEKdijkstra.step_from(cell_pos)toward sourceDONE: at distance 0.BLOCKED: collide-entityFLEEDONE: no moves increase distance (cornered/out of range).BLOCKED: collide-entityPath computation
BLOCKEDfires andstep()reassigns the same behaviorSeek/Flee with DiscreteMap
Seek/flee hold a
std::shared_ptr<DiscreteMap>— this could represent a multi-polar Dijkstra map (e.g., "all exits", "player + allies"). The DiscreteMap is an external reference; the behavior does not own or recompute it.step_from()to move toward the nearest source (distance 0)DONEfires (cornered or out of calculated bounds)Dependencies
cell_pos— behaviors move entities by updatingcell_pos)collideparameter)mcrfpy.Behaviorenum)mcrfpy.Triggerenum)step()callback)Files to create/modify
src/EntityBehavior.h— new file, behavior data structsrc/EntityBehavior.cpp— new file, per-behavior turn logicsrc/UIEntity.h/cpp— addEntityBehavior behaviormember,set_behavior()methodsrc/UIEntityPyMethods.h— Python bindings forset_behavior()grid.step()— turn manager for entity behaviors #301cell_pos— integer logical position decoupled from render positionmcrfpy.Behaviorenum — behavior type identifiersmcrfpy.Triggerenum — behavior trigger type identifiersstep()callback — Python-side turn handlergrid.step()— turn manager for entity behaviorsRoadmap context
Part of the Grid & Entity Overhaul Roadmap (
docs/GRID_ENTITY_OVERHAUL_ROADMAP.md), Phase 3a (first in behavior system implementation).Convergence point for all Phase 2 dependencies. Recommended implementation order within this issue: idle/custom first, then noise4/noise8, then path, then waypoint/patrol/loop, then sleep, then seek/flee last (seek/flee depend on DijkstraMap/DiscreteMap).
Seek/flee will initially use current
DijkstraMaptype, migrating toDiscreteMapafter #294 lands.grid.step()— turn manager for entity behaviors #301