[Bugfix] Headless mcrfpy.step() bypasses updatePythonScenes() — scene.update() and lifecycle callbacks never fire in headless tests #350
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.
Dependencies
No dependencies set.
Reference
john/McRogueFace#350
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
In headless mode,
mcrfpy.step()drivesGameEngine::step(), which advances animations and timers only. It does not callMcRFPy_API::updatePythonScenes(). That call lives exclusively inGameEngine::doFrame()(the windowed/run()frame path). As a result, in headless--execscripts that drive time withmcrfpy.step():Scene.update(self, dt)overrides are never invokedThis was discovered while benchmarking #343 (which optimizes
PyScene::update's per-frameGetAttrString("update")): the step()-only benchmark couldn't see the fix at all, becausecall_updatenever runs understep(). The #343 win had to be measured on the realdoFrame()loop instead (4,559 → 3 Ir/frame).Why it matters
Scene.update()logic. Any game that puts per-frame logic inupdate()is untestable headless.step()runs animations + timers but silently omits scene update, so a scene behaves differently understep()vs. a real frame.Code references
src/GameEngine.cpp—GameEngine::step()advancesAnimationManager+ timers, noupdatePythonScenes().src/GameEngine.cpp—GameEngine::doFrame()wrapsMcRFPy_API::updatePythonScenes(frameTime)in aScopedTimer(this is the only caller).src/PySceneObject.cpp—McRFPy_API::updatePythonScenes()→PySceneClass::call_update().Proposed fix
Have
GameEngine::step()callMcRFPy_API::updatePythonScenes(actual_dt)on the active scene (guarded by the sameactual_dtsanity check used for animations), so headlessstep()faithfully mirrors adoFrame()tick for Python-visible state. Add a regression test: aScenesubclass whoseupdate()increments a counter, driven by Nstep()calls, asserting the counter advanced.Open question: whether
step()should also firecurrentScene()->update()(the C++ scene) and otherdoFrameside effects, or strictly the Python scene update — needs a decision to keepstep()semantics well-defined.Context
Spun out of the #342–#348 perf sprint. The #343 fast-path guard (skip the per-frame
updatelookup for non-subclassed scenes) is orthogonal and already merged; this issue is about the missing headless invocation, not the optimization.