Skip to content

bugfix(fps): Fix and improve logic time step and render update decoupling 2#1579

Merged
xezon merged 14 commits into
TheSuperHackers:mainfrom
xezon:xezon/fix-render-update
Sep 27, 2025
Merged

bugfix(fps): Fix and improve logic time step and render update decoupling 2#1579
xezon merged 14 commits into
TheSuperHackers:mainfrom
xezon:xezon/fix-render-update

Conversation

@xezon

@xezon xezon commented Sep 14, 2025

Copy link
Copy Markdown

Merge with Rebase

This change is a follow up for #1528 and applies more fixes to properly decouple the render update from the logic step. This change has a lot of tiny commits to make it easy to review and find any issues that may arise from it.

The following issues were identified and fixed:

W3DTankDraw update

Unlike W3DTruckDraw and W3DTankTruckDraw, the W3DTankDraw::doDrawModule did not call W3DModelDraw::doDrawModule on every render frame. This caused missing object transform on every non-logic frame. Simple fix.

Snow update

Snow movement was updated once every logic frame. It is now smoothly updated every render frame.

Segline update

Segmented line update (used by Lotus Hack, Patriot Assist beam) was updated once every logic frame. It is now smoothly updated every render frame.

W3D Object Animation update

Decoupling the object animations for logic step was a bit more tricky because there was a bug that would not cause issues in the original implementation, but was a problem for the decoupling.

Animatable3DObjClass::Single_Anim_Progress was called twice every update, so trying to advance an animation with the render frame time would advance it twice as fast. This is now fixed.

Animatable3DObjClass::Compute_Current_Frame is now smoothly updated every render frame.

WW Sync not in sync with Logic Step

The WW Sync was not perfectly in frame sync with the logic step. It was interleaved. This was introduced by previous changes. The result of this was that objects would move in one render frame, but object animations and physic movements would apply 1 render frame or so later. They would still have the same tick, but not on the exact frame. This is bad, because it gives the illusion of jittery movement.

The WW Sync and Logic Step are not back in sync.

W3D Object Animation interpolation

All AnimClass animation have interpolation support for transforms and rotations. But HRawAnimClass had it intentionally disabled. This affects many (or all?) animations. Interpolations are now enabled, which makes all animations perfectly smooth. This is desirable on almost all animations, except for those that want to teleport meshes, such as blinking lights.

Cloud update

The terrain cloud was updated once every logic frame. It is now smoothly updated every render frame. To do that, the cloud movement had to be moved out of its prior function into a new one that is only called once, instead of many times over.

Drawable Tint Envelope update

The build placement preview object started flickering when it was colliding with objects. The reason for this was a bit more complicated to figure out:

The calls to colorTint for the drawable in InGameUI::handleBuildPlacements on drawable collision are not called every logic frame, but every second logic frame. Furthermore, the tint envelope was not actually tinting with a stable color as was intended, but did attempt to fade the tint on the next frame. This caused the flickering on the alternating logic frames. This issue was fixed by correcting the tint logic mistakes.

RingRenderObjClass::animate, SphereRenderObjClass::animate, DazzleRenderObjClass::Render, TexProjectClass::Pre_Render_Update

Courtesy. I adjusted these 4 to logically update correctly every render frame, but they appear to be unused and I have not found a way to test them.

TODO

  • Replicate in Generals
  • Add pull id to commits

@xezon xezon added this to the Major bug fixes milestone Sep 14, 2025
@xezon xezon added Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour ThisProject The issue was introduced by this project, or this task is specific to this project Rendering Is Rendering related labels Sep 14, 2025
Comment thread GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h Outdated
@xezon xezon force-pushed the xezon/fix-render-update branch 2 times, most recently from 0db45d1 to 4be9470 Compare September 15, 2025 09:47
@xezon

xezon commented Sep 15, 2025

Copy link
Copy Markdown
Author

Fixed the w3dview compile error. Fixed a few variable and function names.

Generals will fail to compile until code is replicated for it.

@WWB2-account

Copy link
Copy Markdown

Am I correct to understand that snow and clouds now move at speeds dependent on render fps, e.g. twice as fast when having render 60, logic 30?

@xezon

xezon commented Sep 16, 2025

Copy link
Copy Markdown
Author

Am I correct to understand that snow and clouds now move at speeds dependent on render fps, e.g. twice as fast when having render 60, logic 30?

No. Their speed will be determined by the logic time scale, but every render frame advances their movement.

@WWB2-account

Copy link
Copy Markdown

Am I correct to understand that snow and clouds now move at speeds dependent on render fps, e.g. twice as fast when having render 60, logic 30?

No. Their speed will be determined by the logic time scale, but every render frame advances their movement.

Excellent. Understood.

@ElTioRata

ElTioRata commented Sep 17, 2025

Copy link
Copy Markdown

Just tested it a bit. Noticed that camera zoom speed is reduced at higher frame rates. Are you going to address this on another PR?

@xezon

xezon commented Sep 17, 2025

Copy link
Copy Markdown
Author

Just tested it a bit. Noticed that camera zoom speed is reduced at higher frame rates. Are you going to address this on another PR?

I noticed that too. I will check.

Edit: fixed in #1587.

Comment thread GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp Outdated

@Mauller Mauller left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall to me

@xezon xezon force-pushed the xezon/fix-render-update branch from 4be9470 to ee1c628 Compare September 26, 2025 15:06
@xezon xezon added this to the Decouple logic and rendering milestone Sep 29, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
…e the legacy non interpolated updates to the ww3d sync (TheSuperHackers#1579)
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
…e the legacy non interpolated updates to the ww3d sync (TheSuperHackers#1579)
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker Rendering Is Rendering related ThisProject The issue was introduced by this project, or this task is specific to this project ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Motorized units weired movement

4 participants