-
Notifications
You must be signed in to change notification settings - Fork 119
bugfix(fps): Fix and improve logic time step and render update decoupling 2 #1579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0db45d1 to
4be9470
Compare
|
Fixed the w3dview compile error. Fixed a few variable and function names. Generals will fail to compile until code is replicated for it. |
|
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. |
|
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. |
Mauller
left a comment
There was a problem hiding this comment.
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
4be9470 to
ee1c628
Compare
…nder frame time (#1579)
…more than once a frame (#1579)
…e the legacy non interpolated updates to the ww3d sync (#1579)
…lass::animate, SphereRenderObjClass::animate (#1579)
…jClass::Render, TexProjectClass::Pre_Render_Update (#1579)
…more than once a frame (TheSuperHackers#1579)
…e the legacy non interpolated updates to the ww3d sync (TheSuperHackers#1579)
…lass::animate, SphereRenderObjClass::animate (TheSuperHackers#1579)
…jClass::Render, TexProjectClass::Pre_Render_Update (TheSuperHackers#1579)
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
W3DTruckDrawandW3DTankTruckDraw, theW3DTankDraw::doDrawModuledid not callW3DModelDraw::doDrawModuleon 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_Progresswas 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_Frameis 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
HRawAnimClasshad 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
colorTintfor the drawable inInGameUI::handleBuildPlacementson 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