tweak(gui): Decouple GUI transition and world animation timing from render update#2056
tweak(gui): Decouple GUI transition and world animation timing from render update#2056bobtista wants to merge 4 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/GameClient/GameWindowTransitions.h | Single field type change: m_currentFrame from Int to Real with updated comment. Clean and correct. |
| Core/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp | Adds FramePacer.h include, initialises m_currentFrame as 0.0f, and scales the per-frame increment by getBaseOverUpdateFpsRatio(). The Real → Int implicit conversion at the tWin->update() call site is intentional (confirmed in prior review thread) – the state machine advances to the next integer threshold at the correct wall-clock rate. |
| Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp | Z-rise delta now multiplied by getBaseOverUpdateFpsRatio(). Since BaseFps == LOGICFRAMES_PER_SECOND == 30, the expression simplifies to zRisePerSecond / updateFps — correct frame-rate–independent delta. FramePacer.h was already included. Braces added around the new block body, consistent with project style rules. |
| GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp | Identical fix to the Generals variant; mirrors the same Z-rise scaling with getBaseOverUpdateFpsRatio(). No issues found. |
Sequence Diagram
sequenceDiagram
participant RenderLoop
participant FramePacer
participant TransitionGroup
participant TransitionWindow
participant InGameUI
RenderLoop->>FramePacer: update() [measures actual frame time]
RenderLoop->>TransitionGroup: update()
TransitionGroup->>FramePacer: getBaseOverUpdateFpsRatio()
FramePacer-->>TransitionGroup: BaseFps / actualFps (e.g. 0.5 at 60fps)
TransitionGroup->>TransitionGroup: m_currentFrame += directionMultiplier * ratio
TransitionGroup->>TransitionWindow: update(Int(m_currentFrame))
Note over TransitionWindow: Discrete state machine selects<br/>visual state at integer thresholds
RenderLoop->>InGameUI: draw() → updateAndDrawWorldAnimations()
InGameUI->>FramePacer: getBaseOverUpdateFpsRatio()
FramePacer-->>InGameUI: BaseFps / actualFps
InGameUI->>InGameUI: wad.z += zRisePerSecond / LOGICFRAMES_PER_SECOND * ratio
Note over InGameUI: Equivalent to zRisePerSecond / actualFps<br/>(frame-rate independent)
Reviews (3): Last reviewed commit: "style: Use explicit float assignments fo..." | Re-trigger Greptile
Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp
Show resolved
Hide resolved
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp
Line: 62:62
Comment:
[P2] This file still uses `NULL` (`TheTransitionHandler = NULL;`). New code in this PR also adds `FramePacer` usage; consider switching to `nullptr` for null pointer literals to match the repo’s C++ style.
```suggestion
GameWindowTransitionsHandler *TheTransitionHandler = nullptr;
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
|
I frequently find myself increasing the render frame rate at the menu because I find the window transitions too slow at 30 fps, and would probably like it better if they played close to ~1.75x the original speed. Is there anything this PR can do in that regard? |
|
I agree with Caball. It would be nice to have a setting to adjust GUI speed (x1.0... x1.25... x1.5x... x1.75... x2.00... and so on). |
|
Feature for scaling animation speed is unrelated to decoupling step and better be follow up change. |
|
Looks good. |
276ed5c to
e6cd525
Compare
|
There are still a couple of to-dos in the PR description. |
Is this something you can reproduce? I don't think I've seen anything like this during my testing. |
|
I ran into this several times when testing. My SSD was slow, but still it was unusual behavior. I can retest if this is not reproducible for others. |
Please do. |



Summary
Changes
TransitionGroup::m_currentFramechanged fromInttoRealto support fractional frame accumulationTransitionGroup::update()scales frame advancement byTheFramePacer->getActualLogicTimeScaleOverFpsRatio()InGameUIworld animation Z-rise calculation now scales by the same time factorTest plan