More Networking in Godot - Introduction

Several days ago I posted on this web site a tutorial showing how to setup a basic multiplayer game in Godot, which can be found here. This is a followup to that tutorial.

First we will fix a few problems that I have identified and either completely forgot to mention or noticed rather late, when working on this tutorial. The oversights are:

  • How the client handles disconnections from the server.
  • Usage of deprecated features.
  • Small functionality in the “main menu”.

Then we see an alternative way to handle the player synchronization between the peers. The thing is, the way shown trusts completely on the connected players, which history has shown that unfortunately we can do that. I will show a tiny “evolution” of the synchronization which gives some more control to the server. Read, a very basic, bare-bones, authoritative server.

Then we work on means to measure and simulate latency, working around the fact that Godot does not provide that out of the box.

After that, we expand on the authoritative server by implementing snapshot interpolation in order to get into an smoother animation. While working on this, we see some ways to encode the data before sending through the network, since Godot’s variant incorporates some overhead to each variable.

Finally, we then see a system to kick players from the server as well as a basic chat system, including whispering.

Is This For You?

This is a followup tutorial and will use the previous material as the starting point. If you already have a basic knowledge, don’t want to follow the previous tutorial and still want to see how some of the things mentioned here are done, you can grab the previous material from my Github repository and directly use that as the starting point.

To that end, my Github repository now contains two branches, the master one with the result of the first tutorial and one named MoreNetworking which contains the result of this tutorial. Near the end of this introduction you will find links to the respository.


As with the previous tutorial, no extra asset will be used, so only the Godot 3.1 editor will be necessary.

Tutorial Structure

  • Part 1 - After fixing some issues from the previous tutorial, we work on an alternative way to synchronize the game between the connected players, which should give some control to the server over the game state.
  • Part 2 - Based on the fact that Godot does not provide, out of the box, means to measure network latency or simulate it, we implement our own code to do both, purely from GDScript.
  • Part 3 - Improvements to the authoritative server system, more specifically snapshot interpolation.
  • Part 4 - We work on a chat system and incorporate means for the server to kick players.

As usual, there is a reference material provided in my GitHub repository. Notice one thing, however. Although this is a new tutorial, it’s also a followup. Rather than creating a new repository, I decided to create a new branch named MoreNetworking. So, the master branch contains the material as finished in the previous tutorial and this new branch contains everything shown in this tutorial. Bellow are the links to go directly into both branches: