Godot-matcha is an addon that lets you use WebRTC for multiplayer games by handling matchmaking using WebTorrent trackers. Conceptually it’s quite an interesting, novel approach.
WebTorrent uses a modified BitTorrent protocol that allows it to work with WebSockets. A WebTorrent tracker is essentially a directory service that keeps track of torrents offered by users. A torrent is uniquely identified by its info_hash, so if you have the torrent information, you can look up who is offering a file for download.
Rather than tracking a specific torrent file, godot-matcha generates a random identifier, which it uses as a room (or lobby). If another player has the same identifier they exchange the WebRTC’s SDP details to establish a connection.
Connecting players this way is essentially free. This is a suitable approach for mobile games, for example, where you start a game, and share an identifier with someone else to join in. Mobile party games, for example, use such an approach: One player starts a game, and others join by using some random id such as “FJRLE”.
While godot-matcha is a great proof of concept, I’ve done some testing that showed that the various clients disagree on their unique IDs. This results in challenges when setting the multiplayer authority, a key part of making the high-level multiplayer abstraction work well. The reason for the mismatch is how godot-matcha creates offers, which sets a random id as peer ID before the peers are even connected.
One of the benefits of working with Godot Engine is that GDScript allows one to operate high level. GDScript is dynamically typed, so not even variable types have to be specified, but I would strongly recommend using static typing wherever possible. It can help with performance but primarily adds clarity when trying to follow the …
Development snapshot #4 of Godot Engine 4.1 is here. Among many other changes, it fixes a lighting issue related to using Light-only mode in CanvasItemMaterial (#44559). Unfortunately, it also introduced a UX issue with gradient color pickers (#77745), which makes it quite difficult to work with gradients at all. If you use gradients, I recommend …
Per feedback, we’ve exposed more inventory user interface component signals to make it easier to react to slot/item interactions with custom logic. New features: In addition, these bug fixes are included:
godot-matcha: Free multiplayer without a server
Godot-matcha is an addon that lets you use WebRTC for multiplayer games by handling matchmaking using WebTorrent trackers. Conceptually it’s quite an interesting, novel approach.
WebTorrent uses a modified BitTorrent protocol that allows it to work with WebSockets. A WebTorrent tracker is essentially a directory service that keeps track of torrents offered by users. A torrent is uniquely identified by its info_hash, so if you have the torrent information, you can look up who is offering a file for download.
Rather than tracking a specific torrent file, godot-matcha generates a random identifier, which it uses as a room (or lobby). If another player has the same identifier they exchange the WebRTC’s SDP details to establish a connection.
Connecting players this way is essentially free. This is a suitable approach for mobile games, for example, where you start a game, and share an identifier with someone else to join in. Mobile party games, for example, use such an approach: One player starts a game, and others join by using some random id such as “FJRLE”.
While godot-matcha is a great proof of concept, I’ve done some testing that showed that the various clients disagree on their unique IDs. This results in challenges when setting the multiplayer authority, a key part of making the high-level multiplayer abstraction work well. The reason for the mismatch is how godot-matcha creates offers, which sets a random id as peer ID before the peers are even connected.
In contrast, the godot-demo-projects repository has a webrtc_signaling demo, which uses the lobby/signaling server to tell the clients their ID, so that all clients (including the one acting as the server) add the same peer ID.
Related Posts
When not all strings are Strings. Detect bugs in your GDscript more easily with static typing
One of the benefits of working with Godot Engine is that GDScript allows one to operate high level. GDScript is dynamically typed, so not even variable types have to be specified, but I would strongly recommend using static typing wherever possible. It can help with performance but primarily adds clarity when trying to follow the …
Godot Engine 4.1.dev4 is available
Development snapshot #4 of Godot Engine 4.1 is here. Among many other changes, it fixes a lighting issue related to using Light-only mode in CanvasItemMaterial (#44559). Unfortunately, it also introduced a UX issue with gradient color pickers (#77745), which makes it quite difficult to work with gradients at all. If you use gradients, I recommend …
Inventory System v1.6 available
Per feedback, we’ve exposed more inventory user interface component signals to make it easier to react to slot/item interactions with custom logic. New features: In addition, these bug fixes are included:
Fire, Rain, and Black Hole particle effects
This video is from December last year and uses Godot 4.0-beta7, but I thought it was interesting, because… particle effects!