Use-cannon and Socket.io ? #74
-
I have a game with one plane and one sphere per player. -Do i have to share the position from subscribed position or the key event to apply forces on each client ? Is it possible to have interpolation (with lerp) with physics impulses? Thank you a lot for your help ! F. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 2 replies
-
I'm honestly not familiar with the best approach to synchronizing the physics engine in a multiplayer environment. I'd need to do some research before I could recommend an appropriate approach. |
Beta Was this translation helpful? Give feedback.
-
That's a very big question - from what I can tell, cannon is non-deterministic in real time. See this exchange with Don McCurdy and schteppe's forum post. This article (and project) might help you. |
Beta Was this translation helpful? Give feedback.
-
Rather than send events (key presses) across the network and calculating the results in each client, you should run Be aware that there is currently ( EDIT: I should have mentioned that the current implementation of |
Beta Was this translation helpful? Give feedback.
-
Thank you @codynova for your work ! |
Beta Was this translation helpful? Give feedback.
-
I have used the little correction to avoid the "performance issue". Sorry for this big question but your response will be a huge help for me ! F. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I should have clarified: the current implementation of |
Beta Was this translation helpful? Give feedback.
-
I tried to make a sphere falling on the ground and with impulse from a key event on server side. https://github.com/Franckapik/NandY/blob/master/routes/socket.js |
Beta Was this translation helpful? Give feedback.
Rather than send events (key presses) across the network and calculating the results in each client, you should run
cannon-es
on the server. Send the events to the server, let it calculate the results, then distribute those results back to the client.Be aware that there is currently (
[email protected]
) a small bug with runningcannon-es
in Node, which I'm going to try to look at today: pmndrs/cannon-es#23 (comment)EDIT: I should have mentioned that the current implementation of
use-cannon
does not support usingcannon-es
in this way.