We are currently having only "turn based" multiplayer games in our party game lobby system. Now we considered to add realtime multiplayer games as well, for example golf in 3D. Our current technologies include:

  • Server: C# Server, Custom Web Socket Server logic
  • Client: Browser with web sockets, Three.js for 3D rendering

By having a game like golf, it would also involve physics based gameplay. And we want to keep the server as authority if possible. We know that for a smooth experience we need Client prediction, reconciliation and interpolation. This is where it gets tricky for us right now.

For a good prediction or any prediction at all really, we would need a physics engine that runs kinda similiar on the JavaScript client as well as on the C# Server backend. After searching for a bit we have not found any that are ported to both C# and JS.

We also considered to sacrifice the server authority for that kind of game and make one of the clients the authority; therefore the server would just act as a proxy for them. Would that be a valid way to go? This would also save server resources but clients that are authorities could cheat.

How can we implement these physics features in this mismatched client-server environment?

  • 2
    \$\begingroup\$ You mention having trouble finding a physics engine with both C# and JS versions, but literally the first one I checked, Bullet (the one used in Rocket League) has ports Bulletsharp and Bullet.js/Ammo.js — did you evaluate these options for suitability? \$\endgroup\$
    – DMGregory
    Jun 27, 2022 at 1:23
  • 1
    \$\begingroup\$ Did you consider to implement your own physics? A physics engine for a golf simulation is relatively easy to do because you are only dealing with one moving object (the ball). And using your own physics would give you more control to fine-tune them. Which is crucial in a game like golf which is all about the physics. \$\endgroup\$
    – Philipp
    Jun 27, 2022 at 7:30
  • \$\begingroup\$ @DMGregory Yes this might seem as the best option because it looks like ammo js and bullet run deterministic on a fixed lock step \$\endgroup\$
    – HodorKing
    Jun 28, 2022 at 7:44


You must log in to answer this question.

Browse other questions tagged .