I'm developing a 2D cloud-based MMO using WebSocket and have struggled a lot to get proper working physics on the server side. I'm using Next.js for the client and currently Node.js for the server.

I don't have much code for the server, so I can easily migrate to another solution or language.

My game requires rotating a car explicitly, without affecting the angular velocity, because it does automatic turning of the car.

The server sends the serialized world to the client at a high frequency. I've first tried the Matter.js engine and, unfortunately, when I do body.rotation = n;, it adds angular velocity out of nowhere, whether high or low, breaking the car movement entirely.

Another engine I've tried is Rapier.js.

For Rust, I'm not sure whether it worked or not because I had to deal with the lack of a properly-working WebSocket server (it did not send the world for example). For JavaScript, it failed to load the dynamic WebAssembly module.

How can I solve this problem?

  • \$\begingroup\$ You've mentioned a lot of different (physics?) frameworks so I think this question isn't possible to answer unless you settle on one and tell us exactly what is wrong with your attempts in that framework. \$\endgroup\$
    – Romen
    Sep 28 at 19:35
  • \$\begingroup\$ @Romen I'll try Godot Engine again, but without rendering anything and I think it'll work because the physics always worked there (but I do not know about the WebSocket case yet). If anything goes wrong, I'll return to this question probably stuck on Matter.js. \$\endgroup\$
    – Hydroper
    Sep 28 at 19:55


You must log in to answer this question.

Browse other questions tagged .