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 4 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
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.

Project coverage is 19.15%. Comparing base (794cb9f) to head (804bfd2).

Files with missing lines Patch % Lines
...ckages/frontend/src/pages/drop-and-fusion.game.vue 0.00% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #14861       +/-   ##
============================================
- Coverage    39.47%   19.15%   -20.33%     
============================================
  Files         1559      726      -833     
  Lines       196958   103484    -93474     
  Branches      3563      996     -2567     
============================================
- Hits         77751    19823    -57928     
+ Misses      118635    83106    -35529     
+ Partials       572      555       -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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