Multiplayer application with Babylon - best practices and tools

Hi.

I am trying to figure out how to implement multiplayer feature in my app. During this process I figured out that I don’t know much about the topic and the tools available that could help me out.

I’ve found Colyseus and tried with the implementation and I didn’t have much success, as the end result was huge latancy for currently unknown reasons. I didn’t spend much time for investigation though, as I had to move to other things, but possibilities are:

1 → I had poor implementation (most likely :D)
2 → hosting the colyseus server myself on azurewebsites, where geography comes into play.

Now I am back to research and I am expanding my knowledge on the whole networking stuff and techniques and tools out there. I’ve found couple of tools to help me out, but I didn’t test all of them.

  1. colyseus - currently the one I mostly researched and it is on hold for now until I see which route to go.
    GitHub - colyseus/colyseus: ⚔ Multiplayer Framework for Node.js
  2. lance-gg - not tested. seems interesting, but I seen some mentions of it not being compatible with Babylon.js. Might be wrong, I saw some contradicting statements about it, so not sure what’s the deal. Will write more once I test it out.
    GitHub - lance-gg/lance: Multiplayer game server based on Node.JS
  3. nengi - not tested, seems like it should be good solution, with the limitation that you cannot use newer versions of node, on which my project is built on. Once again, I will write more once I test it out.
    GitHub - timetocode/nengi: a node.js + html5 network engine for real-time multiplayer games
  4. Azure PlayFab - this is probably most obvious solution as a lot of features in the app are using some other Azure services. I need more research on this as well to be able to say more. I didn’t find much about web implementation, it’s mostly unity as I can see. They have web sdk though.
    playfab-web-sdk - npm
    JavaScript SDK - PlayFab | Microsoft Learn

From what I gather some of these tools have some built-in features to make the implementation and networking easier, like optimizations and sync strategies for lag handling, and some are more barebone.

Do you guys have any tips and tricks that could navigate me into right direction. My app is using React and TypeScript. It’s hosted on azurewebsites. Using Node.js server side.

App will not have huge number of players at the time (2-3 players). It’s fairly simple multiplayer interaction so I just need to be able to have couple of players inside, without huge lag, moving around and greeting each other :smiley:

Would also like to hear some thoughts on pricing, for example on PlayFab, and is it worth using it on the project like this where there is not much players.

Other tools I’ve mentioned seems to be open-source, but for nengi I saw some older videos where it seems to have some pricings in certain conditions, but I am not sure if that’s the case anymore.

I will also appreciate any resources you can throw at me regarding multiplayer topic, client prediction, entity interpolation, and all of that neat stuff people figured out to create an illusion of the multiplayer game being “real-time” :smiley:

Thanks

It really depends on the use-case.
I would always suggest nodeJs with socket.io.
And try to find and read some resources/online examples/blog posts/books on multiplayer networking

2 Likes

Hi @nogalo , Despite the obvious things, like having a amazing server, ideal geographic location and minimizing data transfer, in my opinion smooth multiplayer is usually all about faking it on the client until server confirms it. This article explains it very well and the demo at the end gives a good practical example: Client-Server Game Architecture - Gabriel Gambetta

2 Likes

Hey! Has your suggestion changed since Oct 2023? :slight_smile:

Hi!

It really depends on your case of course, or rather on you.
For a developer primarily coming from Javascript/web dev.

Nodejs is so easy and simple to get started with, it’s also hugely popular, so (almost) whatever you need, there’s gonna be a NPM package for it, or it’s built in.
ssl support of all kinds, data encryption, database drivers, websockets (socket.io) etc

There are other options that are better (stronger/faster/safer) or better suited for you if you’re more seasoned in other languages or have other specific requirements.
C++, is always an option, if you love control, performance and memory optimization more than you love yourself.
Deno, if you want more security than Nodejs, or just prefer to use typescript, Deno can run it directly.

The list goes on!
Here’s 5 alternatives to NodeJs with more detailed information :smiley:
https://anywhere.epam.com/en/blog/top-nodejs-alternatives