Godot WebRTC for dummies

2024-06-15



The problem at hand

I have two players. Every x seconds, they send their current scores to the other. After N seconds, the game ends and the player with the greater score wins. The no-brainer way is to implement some peer to peer connection between the devices. However, Godot is a bit peculiar, in my opinion. I am sure there are standards the community has adopted to provide a solution for similar needs, and the Godot documentations are also quite helpful in their own rights. But it seems like you need to jump a few hoops before getting everything in place. I hope this serves as a memo I can later look back at when I forget most of the details.

Multiplayer in Godot

Each node in godot has a multiplayer property. This makes it easy for us to configure anything with the Multiplayer API. Godot supports a lot of protocols such as UDP, TCP, HTTP, SSL - basically the majority of the catalogue - and also