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

Improve Matter.Runner #1254

Merged
merged 15 commits into from
Jun 22, 2024
Merged

Improve Matter.Runner #1254

merged 15 commits into from
Jun 22, 2024

Conversation

liabru
Copy link
Owner

@liabru liabru commented Nov 12, 2023

This PR adds built-in Matter.Runner support for:

  • fixed timestep by default
  • high refresh rate displays with fixed timestep
  • sub-stepping for higher quality simulations
  • performance budgets
  • improved frame pacing

As before Matter.Runner is still optional and a starting point for learning and developing with the engine. These changes should generally not affect those using their own runner or otherwise calling Engine.update directly.

Usage

If you wish to try these beta changes out in your environment before release:

These features are still experimental and helpful feedback on your results is welcome.

There may be some further changes to come on this PR before a general release is possible.

Changes

Matter.Runner

  • changed the built-in runner to default to fixed timestep (see runner.delta)
  • removed non-fixed timestep support (removed redundant runner.isFixed)
  • added built-in support for fixed timestep on higher refresh rate displays
  • added performance budgets runner.maxFrameTime and runner.maxUpdates
  • improved frame pacing with fixed timestep
  • removed bundled window.requestAnimationFrame polyfills
  • changed and updated docs

Matter.Render

  • added updates per frame ("upf") display to render.options.showDebug

Migration

  • Matter.Runner now defaults to a fixed deterministic timestep (support for non-fixed is removed)
  • if needed set your runner.delta and appropriate runner.maxFrameTime and runner.maxUpdates (see docs)
  • note that Matter.Runner can call zero, one, or multiple engine updates and events per display frame
  • see Matter.Runner updated docs throughout
  • if needed set up your polyfill for window.requestAnimationFrame
  • these steps may change or be updated before release

Related

#5, #500, #652, #702, #818, #820, #885, #971, #1152, #1164, #1167

@davidreis97
Copy link

This change would be highly appreciated, is there something I can do to help merge it?

* master: (22 commits)
  improve test comparison report
  update ci
  update ci
  preserve pair.contacts order
  optimised Resolver.solvePosition
  bump package lock
  improve test comparison report
  fixed compare tool layer order in demo testbed
  fixed compare tool layer order in demo testbed
  added multi example testing tool to demo
  added body removal to Example.remove
  changed Composte.removeComposite and Composte.removeBody to reset body.sleepCounter
  optimised Collision.collides
  fix collision events for sleeping pairs, closes #1077
  added local pairs functions in Pairs.update
  removed pair.confirmedActive
  changed Pair.id format to use shorter ids
  optimised Resolver.solveVelocity
  optimised contacts and supports memory and gc use
  optimised pairs and collisions memory and gc use
  ...
@epurban
Copy link

epurban commented May 8, 2024

Agreed with @davidreis97, we really would like to see this merged, and maybe some examples to demonstrate how this will fix issues associated with nondeterminism, and monitor framerates differing

@epurban
Copy link

epurban commented Jun 22, 2024

Hi @liabru , are there any updates on the viability of getting this merged?

@liabru liabru merged commit e0e3164 into master Jun 22, 2024
1 check passed
@liabru liabru mentioned this pull request Jun 23, 2024
@liabru
Copy link
Owner Author

liabru commented Jun 24, 2024

This is now released as of 0.20.0, thanks all!

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

Successfully merging this pull request may close these issues.

3 participants