Attention: This tutorial was written for Godot 3. Not only the information here contains several flaws, networking has changed significantly in Godot 4.
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:
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't 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.
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.
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: