Added support for fixed updates. - #66
Merged
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
🟡 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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added support for FixedUpdate behaviors in Abilities and statescripts.