How to share logic between client and server using Babylon Engine, Colyseus and Babylon Null Engine

Hi! I’m currently developing a multiplayer game using BabylonJS and Colyseus. At the beginning, I was able to run my client on the Babylon Engine and make an authoritative server using Colyseus. Each data were verified via Colyseus and send back to the client. Everything was working fine.

However, some logics can’t be managed via Colyseus alone. In order to fix this issue, I managed to run the server using Babylon Null Engine. Colyseus is no longer the authority but simply the messenger between the client (Babylon) and the server (BabylonNullEngine).

The main issue with that is the code duplication. I can’t find a way to share the client logic to the server without duplicating it while knowing if it is the authority. Do you have any suggestions are code example.

Thanks! :slight_smile:

Answered in a different thread :slight_smile: