Skip to content

Added support for fixed updates. - #66

Merged
lextatic merged 6 commits into
mainfrom
feature/fixed-update
Sep 6, 2026
Merged

lextatic merged 6 commits into
mainfrom
feature/fixed-update

Conversation

@lextatic

@lextatic lextatic commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Added support for FixedUpdate behaviors in Abilities and statescripts.

Graphs only had the frame, so a node moving a body pushed harder at
120fps than at 60. OnFixedUpdate is the second rail; UpdateStamp counts
passes over both so a resolver can tell them apart.
Adds a Two update rails section to the state node guide, the fixed hooks
to the ability integration and overview pages, and a caching section to
the resolver guide that says what UpdateStamp is for and why it is not a
network tick.
@lextatic lextatic added the added New features label Sep 6, 2026
@lextatic
lextatic requested a balanced review from Copilot September 6, 2026 03:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Fixed-update callbacks can invalidate live collection enumerators, and the documented update-stamp caching lifecycle is unsafe and inconsistent.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds fixed-step updates to abilities and Statescript graphs, with update-pass tracking and supporting documentation/tests.

Changes:

  • Adds fixed-update hooks across abilities, graphs, and state nodes.
  • Introduces GraphContext.UpdateStamp.
  • Adds fixed-update tests and documentation.
File summaries
File Description
Forge/Statescript/Nodes/StateNode.cs Adds active-node fixed updates.
Forge/Statescript/Node.cs Adds the base fixed-update hook.
Forge/Statescript/GraphProcessor.cs Drives fixed passes and stamps updates.
Forge/Statescript/GraphContext.cs Exposes the update stamp.
Forge/Statescript/GraphAbilityBehavior.cs Forwards ability fixed updates.
Forge/Core/EntityAbilities.cs Adds entity-level fixed updating.
Forge/Abilities/IAbilityBehavior.cs Adds the behavior fixed hook.
Forge/Abilities/Ability.cs Dispatches fixed updates to behaviors.
Forge.Tests/Statescript/UpdateStampTests.cs Tests stamp progression.
Forge.Tests/Statescript/FixedUpdateTests.cs Tests fixed-update behavior.
Forge.Tests/Helpers/StatescriptTestHelpers.cs Adds fixed-update test helpers.
docs/statescript/README.md Documents graph fixed updates.
docs/statescript/nodes/state/README.md Documents state-node update rails.
docs/statescript/custom-resolvers.md Documents stamp-based caching.
docs/statescript/ability-integration.md Documents ability integration.
docs/abilities.md Updates the abilities overview.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 5
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Forge/Abilities/Ability.cs
Comment thread Forge/Core/EntityAbilities.cs Outdated
Comment thread Forge/Statescript/GraphContext.cs Outdated
Comment thread docs/statescript/custom-resolvers.md Outdated
Comment thread docs/statescript/custom-resolvers.md Outdated
Review of #66: a behavior granting an ability from its fixed update threw, because adding invalidates the open enumerator. Both fixed loops now walk a reused buffer and re-check membership, so a callback may grant, clear or end from inside one. Also corrects the update stamp docs, which claimed a reset that does not happen.
Pre-existing, and the same bug the fixed rail just had: a behavior granting an ability from OnUpdate threw on the open enumerator. Verified against the unfixed loop before fixing.
Self review: the new buffer helper landed under TryBeginActivationByTag's comment, orphaning it, and the buffer comments claimed a non-re-entrancy the code only constrains callers to.
…walk

All three walks share one reused buffer, so a nested pass cleared and
refilled the list the outer one was indexing - advancing some entries
twice, skipping others, silently. Nesting is never useful here, so it is
refused: Validation.Fail reports it in development, and the pass is
dropped either way.
@lextatic
lextatic merged commit ac715f6 into main Sep 6, 2026
2 checks passed
@lextatic
lextatic deleted the feature/fixed-update branch September 6, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants