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

fix(frontend): Ensure physics run consistently across different device framerates #14861

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

Conversation

CenTdemeern1
Copy link

What

Fixes #14860.

Why

This makes physics run the same for everyone everywhere, and it means you can't get a gameplay advantage in Misskey's Bubble Game on different framerates.

Additional info (optional)

d489576 bumps matter-js to version 0.20.0, where Matter.Runner (used in physics.ts) is now completely framerate independent.
e7d35a0 changes Misskey's Bubble Game to use setInterval instead of requestAnimationFrame, which has a few minor side effects, but it ensures it runs the same across devices.

I'm not sure how I'd reasonably add tests for this, as I'm not aware of a Web API to change the device framerate.

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

This version uses fixed rates across platforms in Matter.Runner. This fixes inconsistent rates in `physics.ts`.
This makes sure Misskey's Bubble Game always runs at a consistent rate, even when the monitor isn't 60hz
@github-actions github-actions bot added the packages/frontend Client side specific issue/PR label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/frontend Client side specific issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Physics in physics.ts and Misskey's Bubble Game are framerate-dependant
1 participant