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

Merged
merged 5 commits into from
Dec 26, 2024

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 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

ohlidalp commented Aug 18, 2024

@Miner34dev Thanks for the research, I've done a lot of water changes in #3142 so I'll fix these after it's merged. UPDATE: That PR ended up closed without merging, so I'll fix what I can here.

AnotherFoxGuy and others added 5 commits December 26, 2024 02:02
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
Copy link
Member Author

I didn't think I can pull it off until OGRE upgrade, but I fixed HydraX caustics anim to run on simulation time instead of wall time.

The only thing remaining is waves on classic water (simple/reflect/refract) - that's actually a physics (buoyance) logic, not just gfx, so it's not as easy to do, so I'll leave it out from this PR.

@ohlidalp ohlidalp merged commit f5aa749 into RigsOfRods:master Dec 26, 2024
2 checks passed
@ohlidalp ohlidalp deleted the gfx_simspeed_pause branch December 26, 2024 23:14
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.

4 participants