Babylon null engine

Hello everyone, I found babylonjs very interesting so I am very interested in it and how to create and set up a project with babylon engine for front end of the game and null engine for server side and there is little documentation about it. Can anyone share me more documentation or give me a simple example with babylon engine for front end and null engine for back end? Thanks a lot.

this should help Running Babylon.js On A Server | Babylon.js Documentation

2 Likes

Hey, @neil3369.
It really depends on what you want to achieve.
The documentation that @sebavan posted should be enough to get you started.
At some point in my hobby repo I had babylonJS running on the client and nullengine running on the server and both communicating via web sockets.
You can check it out here

If you need some more help let us know :wink:

2 Likes

thanks.

thanks a lot but i have a question when we use null engine for server side we need to reuse some same logic with the client right? is that the way to pass logic from the server to client and opposite?

Hey,
I think it really depends on the use case.
Can you tell some more what do you plan to do?

If you want to do some physics on the server then you can do so and then send only position of the object to the client.
Some abstraction and/or shared code base can be shared between client and the server but I guess it can’t be babylon-instance specific :smiley:

1 Like

for example when one event on game occur the client immediately respond that action and then the server will match or fix that state, or can the babylon engine handle the physic without coding the physic can you give me some examples? Thanks.

It really depends on your needs.

If you want the server to be the one source of the truth but you want the client not to wait for the server’s response then yes, you will have some code duplication.
But the general idea is:

  1. the event occurs on the client
  2. the client responds and sends information to the server
  3. the server receives the information, it computes the response
  4. server sends back the response
    So you need to handle the asynchronous and fixing the state. It’s definitely possible. You can start coding and if you will have some problems just share the code.

Yes, the BabylonJS can handle some simple physics.
BabylonJS also can work together with the physics engines like Cannon or Ammo.
Check this out
https://doc.babylonjs.com/divingDeeper/physics/usingPhysicsEngine

I tried to use BabylonJS with Ammo but then I switched to cannon-es.

2 Likes

Yes, thanks a lot!