I am trying to create a simple online virtual world where people can login and do stuff. I am using Babylon + Colyseus for the server. I am also using the Babylonjs-character-controller.
It’s in a very primitive stage and I’ve hosted it here viworld
But I have to say, it sucks, big time. There’s no client interpolation or server reconciliation. And the movements are extremely choppy. I am simply just sending the coordinates and orientation.
I wanted to know if there’s any out of the box solution for this or some boilerplate that I can use to get this basic function. Mainly because, my aim is to build a lot on top of this. So, I don’t want to spend most of my time reinventing the wheel trying to get these client-server networking done. I just want a simple third-person virtual world where people can join and move around.
Edit: I did try nengi.js and it’s babylon boilerplate. But I’m finding it extremely difficult to integrate it with the character controller. So, i decided to go with colyseus.
Congrats on working on a virtual world, keep it up! I’m afraid there is no out of the box solution that works for prediction and reconciliation. Most of the time, networking varies on the game, there is no silver bullet.
I can support you along the way though. Just send me a DM, happy to help.
Thank you for the help!
Now that there is no out-of-the box solution, I’ll start implementing prediction and reconciliation algorithm for the client.
I checked out the nengi-babylon repo. And I’m not too fond of the way he has implemented the prediction and lag correction. It essentially has a rawEntity and smoothEntity. The data is first passed to the rawEntity and then smooth enitity takes it and smoothens the motion. And this smooth entity is what the other clients see.
Is there any better way to approach this problem? Do you have any article or post where I can find more implementation details about these algorithm?
I haven’t checked the Nengi implementation, I think what its developer has done is to make it a general-purpose solution. He has also used it in multiple projects internally and it has worked quite well. Generally speaking, if you would use a high-level networking framework I would highly suggest it.
Otherwise, this should get you started : Client-Server Game Architecture - Gabriel Gambetta.
So, I did some more research and I found few more stuff. So the thing is, I am not too keen on developing like a fully authoritative server. I just want the client to have a seamless experience.
I found two libraries, one is lance.gg and it is supposed to support client interpolation and lag handling.
I also found an awesome library gecko.io by @yannick which uses webrtc and has snapshot interpolation and prediction stuff.
Ohh, and one last thing, I also came across this amazing virtual space implemented by mozilla called hubs which also implements using webrtc.
I am thinking of using one of these. What’s your opinion? Do you have any suggestion for me?
I haven’t used any of those before, I have always written my own networking code. However, I would suggest to try them out and see what works best for you.