grid.step() — turn manager for entity behaviors #301
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
#303 FOV optimization for behavior TARGET triggers
john/McRogueFace
#300 Behavior data struct and primitive implementations
john/McRogueFace
Reference
john/McRogueFace#301
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
Add a
step()method to Grid that processes one round of turn-based entity actions. This is the orchestrator that evaluates behaviors, checks triggers, and callsstep()callbacks.Python API
Entity turn properties
Turn processing algorithm
Turn order as entity sets
Developers can use
turn_ordervalues as logical entity groups:Movement animation
When a behavior produces a move, the turn system:
entity.cell_posinstantly (logical move)entity.animate("x", float(new_cell_x), entity.move_speed)(and y)The turn system does NOT wait for animations. All logical moves happen instantly; animations are cosmetic. Developers who don't want animations can set
entity.move_speed = 0or simply not use the animation system.Thread safety
grid.step()should hold the grid's FOV mutex for the entire step to prevent concurrent modification. No other thread should modify entity positions or grid state during a step.Headless mode
grid.step()works independently ofmcrfpy.step(). In headless mode,grid.step()processes turns without requiring the game loop. Animations are queued but not rendered.Dependencies
cell_pos)mcrfpy.Behaviorenum)mcrfpy.Triggerenum)step()callback)Files likely affected
src/UIGrid.h/cpp— addstep()method and Python bindingsrc/EntityBehavior.h/cpp— behavior execution logic (called by grid.step)src/UIEntity.h/cpp—turn_order,move_speed,target_label,sight_radiuspropertiesRoadmap context
Part of the Grid & Entity Overhaul Roadmap (
docs/GRID_ENTITY_OVERHAUL_ROADMAP.md), Phase 3c (after behavior struct #300 and pathfinding collision #302).This is the orchestrator — it ties together behaviors, triggers, collision, and FOV into the
grid.step()method. Theturn_orderparameter allows devs to use turn groups as entity sets ("teams", speed categories) with real-time delays between groups.