Switch focused render mode to reactive (render on demand) to save battery #78
Reference in New Issue
Block a user
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?
Background
The VSync fix (
PresentMode::AutoVsyncon Android) capped the GPU at the display refresh rate and eliminated the ~1000 fps runaway. The next step is to stop rendering entirely when the game is idle — no animations playing, no drag in progress, no input received.Current state
UpdateMode::Continuousrenders on every vsync even when the board is static — wasting CPU, GPU, and battery between player actions.Goal
Switch to render-on-demand while focused:
Bevy will then only re-render when:
window.request_redraw()(needed for animations)Work required
focused_modetoUpdateMode::reactive_low_power(...)on Android (and optionally desktop).card_animation_plugin,feedback_anim,auto_complete_plugin) — they must callwindow.request_redraw()each frame they are actively animating, otherwise animations will stall.tick_elapsed_timeingame_plugin) — it fires every frame; under reactive mode it should only tick while the game is unpaused and the HUD timer is visible.Expected outcome
Labels
Fixed in
38e4c03.Changed
focused_modefromUpdateMode::ContinuoustoUpdateMode::reactive_low_power(Duration::from_millis(100))on Android. The 100 ms ceiling ensures the game timer updates ~10×/s even with no input; animations self-sustain at full frame rate via theRequestRedrawchain added in #79. The GPU is now completely idle between frames when the board is static, which should meaningfully extend battery life.