The cloud model
Traditionally, if you wanted to networked your browser game, you would have to use something like WebSockets and a cloud server.
This can get
- Expensive — Servers aren't cheap, and your costs can go up exponentially as your player base grows
- Complex — How do you keep your players synced up properly? How do you fight cheating? How do you avoid replication across your client and server codebases?
- Limiting — What if you wanted to build an MMO? Now you have to think about sharding and load balancing. Your game goes viral, suddenly your servers are overwhelmed and now you have to think about provisioning, when you could instead be working on your game!
With WebRTC starting to see widespread support, and the standards settling, we can finally cut out the middle man and have players communicate directly over a mesh network!
But wait! Isn't that less scalable? Now 5 players need to send duplicate data across a total of 10 connections. 50 players over 1225 connections! No browser can handle that! That's where the magic comes in...
Figuring out how to connect peers in a way that is fault-tolerant, performant, and infinitely scalable, is a monumental task. The algorithms libfabric uses are directly based on the PhD research of Yousef Amar whose solutions can be tuned to any game genre and mitigate cheating.
libfabric will dynamically reconnect peers in topologies optimising for:
- Virtual position
- Network conditions
- Additional custom metrics
libfabric additonally supports 8 different P2P topologies, ranging from superpeer to Delaunay triangulation-based topologies, and allows you to network behaviour to your liking, depending on the genre of game you're developing. If you're interested in the technical details, let's have a chat!