I’m excited to share that Colyseus is now fully compatible with MonoGame! I’ve removed the direct dependency on Unity and put together an example project with MonoGame for you to check out.
For those unfamiliar - Colyseus is an open-source server and client framework that lets you code your own backends and real-time room logic, while providing an easy-to-use SDK to consume the backend you created.
To see it in action, check out the Realtime Tanks Demo built with Colyseus + MonoGame. Both the server and client are fully open-source.
It should be good for anything! So far Colyseus community has been made of web game developers, as examples we have bloxd.io (realtime), competitive (degen style) and turn-based.
You do need infrastructure for hosting your server(s) - how far each server can handle really depends on the complexity of your game loop server-side and amount of data being sent over the wire. For a simple turn-based game, a $5/mo VPS can hold ~3000 CCU. If it’s realtime that number can be reduced to 50~500 depending on the complexity.
So it’s always a good idea to do some benchmarks to understand how your servers behave before going live and setting up your infrastructure upfront. I’d like to make auto-scaling easier in the future, but so far we don’t have an open-source auto-scaler available.
Being that this is based on websockets infrastructure, it will never be (as I understand it) as performant as TCP (or UDP or whatever else low/bottom-level networking) type stuff because it does a bit of web-like overhead. I’ve implemented WS servers for a game and a web app with nice results (and super simple setup, relatively speaking), but I’m not sure I’d take that route for a real-time game that needs to have as-lean-as-possible data packets/parsing.
There is indeed a small overhead of ~23B per message sent via WebSockets in comparison with TCP. There is one advantage though that TLS/encryption is part of the protocol. (On raw TCP you don’t get encryption unless you do it yourself.)
Colyseus has experimental support for WebTransport - which sits on top of UDP (QUIC+HTTP3), with support for datagrams/unreliable communication. Web browsers are still ironing out their implementations, but this is going to be massive for web games in general pretty soon!