Multiplayer HTML5 games tools
WebSockets are the most popular technology for developing multiplayer HTML5 games. They allow bidirectional communications between clients and server using a single socket TCP.
We code our multiplayer HTML5 games in Javascript, both the client and the server side. More specifically, we use a game engine called phaser.io for the client and Node.js in the server.
There are several options for working with WebSockets. The most common and simple is Socket.io. We implemented sockets.io on our first projects. However, due to the increasing complexity and demands of our current projects we decided to change to SocketCluster.
Why we love doing HTML5 multiplayer games using SocketCluster
SocketCluster is an open source framework optimized to run with Kubernetes (K8s). It’s the base for our multiplayer development for the following reasons:
- Because it’s faster and more versatile than socket.io. SocketCluster uses µwebsockets (coded in C++) and offers pub/sub.
- Highly reliable.
- Supports custom codecs during transmission to increase data exchange speed.
- It’s easy to scale. Vertically using multiple cores of the CPU of a single host and horizontally with several servers. It doesn’t require Redis to share the state between processes.
For all of you looking for an introduction to SocketCluster we recommend this complete example of an Agar.io game type:
MultiPlayer game example using Phaser on GitHub.
Finally, here a very useful comparison of the main modules implementing WebSockets:
Leave a Reply
Want to join the discussion?Feel free to contribute!