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

Change framerate to 60fps #100

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

Conversation

gcabbage
Copy link
Contributor

@gcabbage gcabbage commented Oct 27, 2024

Refactors the core animation loop as proposed in Improved Physics Engine to:

  • PaintFrame();
  • UpdateBehaviors();
  • UpdatePhysics();

Where UpdatePhysics includes movement, collision detection, collision resolution etc. and can be called with an arbitrary timestep. As a result the physics update is no longer tied to the behavior update and will run at the full framerate, which addresses [Feature] Smoother time - slow.

Adds a new game setting use60fps (default True) which will run the display and physics at 60 fps, while behavior remains at 30 ticks per second.

@gcabbage
Copy link
Contributor Author

With a8ac2e4 I've updated the PR to split CSystem::Update into UpdateBehaviors and UpdatePhysics.

  • Game ticks are reverted back to 30 ticks per second, so there is no need to alter weapon lifetimes etc.
  • Added a game setting use60fps to control if the frame rate is 30 or 60 fps.
  • UpdatePhysics is called every frame (i.e. will run at 60 fps if requested) with an appropriate scaling of the time step

The slow motion effect used when docked or with menus is now much smoother as the physics update occurs at the full frame rate (for both 30 and 60 fps modes) addressing [Feature] Smoother time - slow

  • Some particle effects (e.g. missile trails) will always run at full speed, so look particularly odd in slow motion

@gcabbage
Copy link
Contributor Author

Particle effects should be mostly working now and pickup the correct time step for movement updates. Remaining issues:

  • Particle collisions are still performed in CParticleArray::Update (i.e. once per behavior tick), but should be done in CParticleArray::Move (once per physics update)
  • Overlays do not have a Move method, and are still moving particles in COverlay::Update

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.

1 participant