The team here is designing a intensive multiplayer game, with the server Golang based, and the client being web focused with Babylon as the engine.
Considering the current (and strong) recommendation of Babylon documentation is to use Havok for physics, we have good reasons to want it in the server-side also: We will need a lot of physics calculations and checks in the server to offer a single source of truth of players position during the game-play; And potentially to help detect and block cheaters.
So, in short, the questions are:
- Can we use the
@babylon/havok .wasm module at the server-side?
- And can we use it on something other than Node.js, that means, with Golang?
- If so, is there some kind of documentation for doing that?
Adding @carolhmj and @RaananW but I am not sure Havok was working in node
Thanks for the reply @carolhmj, indeed we think it’s possible bind WASM calls inside Go, but we’re a little confused here regarding what exactly to bind to.
Is there any public documentation regarding the methods exposed by the Havok WASM module, that we could try to create a wrapper on top of it, in the same way you guys created the Node module?
I think you should reconsider your choices
I think we should check what would be missing to run fully in node with our wrapper ?
Hey @jeremy-coleman, we are still in an early stage, so reconsidering our choices is possible.
But I’m not sure to what direction to reconsider. Since we’re aiming for web games and high quality rendering with WebGPU, Babylon seems to be the choice. And considering that Babylon 6 has put all the efforts on Havok, and turned it the only recommendation for the new physics engine, I supposed it’s the only way to go.
So, could you please expand on what choice you think we should do differently?
- Stick to the old physics engine on the client (with Ammo), since Bullet is available for Go?
- Forget the physics on the Go server, meaning a single source of truth during multiplayer is basically impossible for now?
- Avoid Go at all, sticking to Node to be able to use the WASM module from there?
- Something else I didn’t got yet?
Maybe you could use GO for the main servers and a single node instance to run the physics server side ?
if you’re implementing it in a different language you can use whatever on the backend since youre giving up code reuse and babylons physics plugin is flipping coordinates… theres not going be a 1:1 mapping to the wasm module. Also, v8 is obviously going to be way faster than go with some frankenstein shitty wasm vm duct taped on top, so i think thats counter productive to your goals to try to use havok wasm from go. If youre using websockets Id say use node/uws with babylon thin engine for code reuse. Or if go/bullet is good, theres no reason that would stop you from using havok on the client.
Well, the idea of adopting a more modular micro-services inspired architecture for our game is being discussed here, and we like it indeed. Having a physics service written in Node, or even in pure C++ directly talking to Bullet, is really an option.
But as we know, a scalable multiplayer game must run physics simulations in the server to generate authoritative updates that are cascaded down to the clients. The client itself only runs smaller physics simulations that don’t have an impact in gameplay.
As such, we have the challenge that server and client must be able to predict each other’s calculations in order to compensate for latency (while the actual calculations are being executed and their results, transmitted). That’s the reason why we had in mind that the server and the client should be using the same physics engine - to avoid a mismatch between how the same calculation is made.
Does our reasoning make sense?
Trying to use the havok wasm module from go just doesnt make sense imo. The other options seem fine.