-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Objects fall slower in production compared to development mode #1315
Comments
There's nothing in the Matter code that distinguishes between production / local (indeed, I'm not sure how you'd even do this accurately). I would start by doing some simple logging - console.log the gravity value at keys points and compare prod/dev - maybe the build/minification process is messing a config somewhere. Also, check the fps rate (enable dev tools fps monitor) - is it stable and the same between prod and dev? |
Can you share the code? |
You can see the game live here: https://bekk.github.io/javazone-spill/ Btw I noticed the error is in the built version of the project. If I build the project and run it on preview server the soda boxes fall slowly. The codebase is huge, I can't share all that. Is there anything specific you'd like to see, then I can share that. |
Thanks. The build is minified which makes it hard to debug. If the source code is huge, I suggest creating a minimal failing example--remove the unnecessary parts so it's easier to focus on the core problem. Without some source code it's very difficult to help--things like this are usually use case specific and not something someone might happen to know off the top of their head. As photonstorm said, there's no difference between prod and dev as far as MJS is concerned. |
Here is a minimal version of the app we have running. The two most important files are https://github.com/annalytic/matter-js This is how the physics are when running the Built version: You can easily see the boxes fall slower in the built version of the app. |
Have you checked if removing React StrictMode makes your local build behave like the production build? I just had a similar issue with a setup where I have my own runner to run the engine, which I started from a useEffect hook in the app. This starts a loop that calls itself with Could you check if stopping your runner instance in the cleanup helps? |
I'm using matter-js 0.19.0 and use vite to build the game.
I notice that the gravity is much lower / objects fall a lot slower in production compared to when developing locally.
The game is hosted on github pages.
Anyone have any idea why?
The text was updated successfully, but these errors were encountered: