Skip to content

tweak(controlbar): Decouple the general promotion star blink from the render frame rate#2835

Merged
xezon merged 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/tweak/decouple-general-star-blink
Jul 9, 2026
Merged

tweak(controlbar): Decouple the general promotion star blink from the render frame rate#2835
xezon merged 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/tweak/decouple-general-star-blink

Conversation

@bobtista

@bobtista bobtista commented Jun 27, 2026

Copy link
Copy Markdown

Addresses #2834, same idea as #2833 / #2056.

Problem

The general's promote-button stars blink faster as you raise render FPS, because the blink is driven off the logic frame (TheGameLogic->getFrame()) and re-checked every render frame. The blink rate should be constant regardless of render FPS / logic time scale.

Fix

ControlBar::getStarImage() now paces the star highlight off of TheFramePacer->getUpdateTime(), so the blink rate is constant regardless of render FPS / logic time scale. The star keeps blinking while the game is paused.

TODO:

[x] Testing
[x] Replicate to Generals

@bobtista bobtista self-assigned this Jun 27, 2026
@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown

Greptile Summary

Decouples the general-promotion star blink rate from both render FPS and logic time scale by replacing the getFrame() % LOGICFRAMES_PER_SECOND modulo check with a wall-clock accumulator driven by TheFramePacer->getUpdateTime().

  • A new Real m_genStarFlashTimeAccumulator field is added to ControlBar, initialized to 0.0f in the constructor, and advanced each render frame only when the star is actively flashing; the accumulator is wrapped modulo 1 second, and the second half of each cycle shows the highlight image.
  • FramePacer.h is included in ControlBar.cpp and the include is in alphabetical order, consistent with the surrounding block.

Confidence Score: 5/5

Safe to merge — the change is a self-contained UI timing fix with correct initialization, accumulation, and wrap logic.

The accumulator is initialized to zero in the constructor, advanced only when the star is actively flashing, and correctly wrapped modulo 1 second each render frame. TheFramePacer->getUpdateTime() measures real elapsed render time, so the blink rate is truly independent of both render FPS and logic time scale. No shared mutable state, no allocation, and the early-return path when m_genStarFlash is false is unchanged.

No files require special attention.

Important Files Changed

Filename Overview
Core/GameEngine/Include/GameClient/ControlBar.h Adds m_genStarFlashTimeAccumulator (Real) member to ControlBar with an inline doc comment; clean header change.
Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Replaces frame-count modulo blink with a wall-clock accumulator driven by TheFramePacer->getUpdateTime(); initialization, wrap logic, and half-cycle check are all correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["getStarImage() called\n(each render frame)"] --> B{m_genStarFlash?}
    B -- "FALSE" --> C["Set normal button image\nreturn nullptr"]
    B -- "TRUE" --> D["m_genStarFlashTimeAccumulator\n+= TheFramePacer->getUpdateTime()"]
    D --> E{"accumulator\n>= 1.0s?"}
    E -- "YES" --> F["accumulator -= 1.0s\n(wrap modulo 1s)"]
    F --> E
    E -- "NO" --> G{"accumulator\n>= 0.5s?"}
    G -- "YES (second half)" --> H["Set highlight image\nreturn nullptr"]
    G -- "NO (first half)" --> I["Set normal image\nreturn nullptr"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["getStarImage() called\n(each render frame)"] --> B{m_genStarFlash?}
    B -- "FALSE" --> C["Set normal button image\nreturn nullptr"]
    B -- "TRUE" --> D["m_genStarFlashTimeAccumulator\n+= TheFramePacer->getUpdateTime()"]
    D --> E{"accumulator\n>= 1.0s?"}
    E -- "YES" --> F["accumulator -= 1.0s\n(wrap modulo 1s)"]
    F --> E
    E -- "NO" --> G{"accumulator\n>= 0.5s?"}
    G -- "YES (second half)" --> H["Set highlight image\nreturn nullptr"]
    G -- "NO (first half)" --> I["Set normal image\nreturn nullptr"]
Loading

Reviews (5): Last reviewed commit: "refactor(controlbar): rename star blink ..." | Re-trigger Greptile

Comment thread Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Outdated
Comment thread Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Outdated
xezon
xezon previously approved these changes Jul 4, 2026
Comment thread Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Outdated
@xezon xezon dismissed their stale review July 4, 2026 16:42

pausing

Comment thread Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Outdated
@bobtista bobtista force-pushed the bobtista/tweak/decouple-general-star-blink branch from 570cd13 to a4f3370 Compare July 6, 2026 21:30
Comment thread Core/GameEngine/Include/GameClient/ControlBar.h Outdated
@xezon xezon added Enhancement Is new feature or request GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Jul 8, 2026
@xezon xezon added this to the Decouple logic and rendering milestone Jul 8, 2026
@xezon xezon changed the title tweak: decouple the general promotion star blink from the render frame rate tweak(controlbar): Decouple the general promotion star blink from the render frame rate Jul 9, 2026
@xezon xezon merged commit ab5ce4f into TheSuperHackers:main Jul 9, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Is new feature or request Gen Relates to Generals GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants