Go, Go, Godot!
  • 0

godot-matcha: Free multiplayer without a server

December 23, 2023

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.

gdscriptnetworking
Posted in Godot.
Share
Previous2D Fog Effect Shader Tutorial
NextCreating a UDP peer-to-peer connection

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

  • January 15, 2025

    Inventory System 2 Alpha 1 available

    The first alpha of the inventory system v2 is now available. For v2, a lot of refactoring work has been done with a focus on improving the developer experience. As part of that, the naming convention of the addon classes was streamlined and is more consistent now. The GDScript documentation comments have been improved significantly …

  • October 9, 2023

    The Godot Jungle Demo

    It’s not Far Cry, nor Crysis, but it could be. The Realistic Jungle Demo demonstrates that Godot is capable of impressive visuals. If you want to run it yourself, download it from https://wrobot.itch.io/jungledemo. It was announced in this Reddit post. Update: The source code was released (with the commercial assets removed).

  • July 6, 2023

    Making breakable objects in Godot

    Here’s a tutorial on how to create breakable objects in Blender and Godot. It covers the steps needed to design and implement breakable objects, including scripting and using physics properties to make objects break apart into smaller pieces upon collision or other interactions.

  • January 12, 2023

    Is Godot is the Linux of Game Engines?

    Godot Engine is an open-source game engine. With the 4.0 release on the horizon, it’ll gain quite a bit of attention. And it’s an engine worth keeping an eye on. Internet Gaming. Serious business. Game development is serious business. The global gaming market size was 203 billion USD in 2020 (per fortunebusinessinsights). It is predicted …

    © 2025 GoGoGodot.io. All rights reserved.