I am currently developing a multiplayer game using @babylonjs/core and Colyseus. However, I’ve encountered some compatibility issues that I’m hoping to get some advice on.
Overview of the Problem:
Previously, I integrated the colyseus server with my client and it worked fine. I wanted to implement physics and movement verification on the server to prevent cheating. I’ve attempted to integrate @babylonjs/core and Havok physics with Colyseus for the server-side logic, similar to what I was doing on the client. However, I’m facing difficulties due to what seems to be compatibility issues between Colyseus and the @babylonjs/core package, specifically with the modules types ESNext & CommonJS.
Questions:
Has anyone successfully integrated Colyseus with @babylonjs/core on a NodeJS server, and if so, could you share how you approached it?
Essentially question 1 is my only question, but if these two packages are(n’t) actually compatible, am I just approaching this in the wrong way?
Thanks for the reply. I did come across that code, but the server doesn’t use @babylonjs/core.
@sebavan That post was what made me aware of NullEngine for the server. I was able to include ‘babylonjs’ rather than @babylonjs/core, and the server seems to accept it. but still have issues when it comes to using @babylonjs/loaders/glTF and similar. Is there another version of the glTF loader floating around that works similar to the ‘babylonjs’ package?
All of the @babylon/modules are also published as cjs modules under the name babylon-module. So, babylon-loaders in that case. But note that they are single files, so you wouldnt do a nested import like babylon-loader/gltf or whatever, you just import babylon-loaders and get everything.
Thanks for the reply, I did end up doing something similar to what you have, but with the babylonjs instead of @babylonjs/core. Apart from my server’s y=0 position being 1 unit higher than the clients y=0, it seems to be working now. My server has colyseus, havok, and headless babylonjs running.
Great that you have found the solution
If you don’t need any more assist regarding this topic please mark one reply as the solution (might be even your reply)