Skip to content
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

Fixed GFX running on wall time instead of sim. time #3170

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ohlidalp
Copy link
Member

@ohlidalp ohlidalp commented Jul 30, 2024

While fixing #3169 I noticed beacons run when game is paused and also ignore simulation speed, always running at wall time. I remembered there are multiple other issues like this (props/water waves moving when paused) and I figured a way to tackle everything at once - I changed the time input for the entire scene update code (which is already consolidated into GfxScene::UpdateScene()) - instead of inputting wall time, I now input the adjusted simulation time, and I input zero if the game is paused or physics are globally paused.

The particles had a custom code to correctly calc. sim. time and skip the update entirely when paused. I reverted all that, expecting the adjusted time input to fix particles, but that didn't work - they don't use that input. I already researched this at #3138 and figured to use Ogre::ParticleSystem::setSpeedFactor() - that did the trick.

UPDATE: I synced all particles to simulation time: exhausts, cparticles, turboprops, turbojets, terrain object particles.

Known issue: Particle time to live still runs on real time - this appears to be a bug in OGRE.

ohlidalp added 3 commits July 31, 2024 00:31
I noticed beacons run when game is paused and also ignore simulation speed, always running at wall time. I remembered there are multiple other issues like this (props/water waves moving when paused) and I figured a way to tackle everything at once - I changed the time input for the entire scene update code (which is already consolidated into `GfxScene::UpdateScene()`) - instead of inputting wall time, I now input the adjusted simulation time, and I input zero if the game is paused or physics are globally paused.

The particles had a custom code to correctly calc. sim. time and skip the update entirely when paused. I reverted all that, expecting the adjusted time input to fix particles, but that didn't work. I already researched this at RigsOfRods#3138 and figured to use `Ogre::ParticleSystem::setSpeedFactor()` - that did the trick.
Particles fixed: exhausts, cparticles, turboprops, turbojets, terrain object particles.

Known issue: Particle time to live still runs on real time - this appears to be a bug in OGRE.

Overview of changes:
* Created helper `GfxScene::AdjustParticleSystemTimeFactor()`, applied to all particle systems in game.
* Exhausts and CParticles moved from Actor (actor.h + simdata.h) to GfxActor (gfxactor.h + gfxdata.h).
* Terrain object particle systems are now stored in vector<> in order to update their pace.
@ohlidalp ohlidalp requested a review from CuriousMike56 August 2, 2024 09:13
@ohlidalp ohlidalp mentioned this pull request Aug 4, 2024
4 tasks
@Miner34dev
Copy link

A few things are still running on wall time: Reflection+refraction water (didn't test reflection only and basic), HydraX caustics and wobbliness. Other than that (and, like in my attempt the sparks behaving weirdly) it's fine.

@ohlidalp
Copy link
Member Author

@Miner34dev Thanks for the research, I've done a lot of water changes in #3142 so I'll fix these after it's merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants