Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
The Essential Guide to Creating Multiplayer Games with Godot 4.0

You're reading from  The Essential Guide to Creating Multiplayer Games with Godot 4.0

Product type Book
Published in Dec 2023
Publisher Packt
ISBN-13 9781803232614
Pages 326 pages
Edition 1st Edition
Languages
Author (1):
Henrique Campos Henrique Campos
Profile icon Henrique Campos

Table of Contents (19) Chapters

Preface 1. Part 1:Handshaking and Networking
2. Chapter 1: Setting up a Server 3. Chapter 2: Sending and Receiving Data 4. Chapter 3: Making a Lobby to Gather Players Together 5. Chapter 4: Creating an Online Chat 6. Part 2:Creating Online Multiplayer Mechanics
7. Chapter 5: Making an Online Quiz Game 8. Chapter 6: Building an Online Checkers Game 9. Chapter 7: Developing an Online Pong Game 10. Chapter 8: Creating an Online Co-Op Platformer Prototype 11. Chapter 9: Creating an Online Adventure Prototype 12. Part 3:Optimizing the Online Experience
13. Chapter 10: Debugging and Profiling the Network 14. Chapter 11: Optimizing Data Requests 15. Chapter 12: Implementing Lag Compensation 16. Chapter 13: Caching Data to Decrease Bandwidth 17. Index 18. Other Books You May Enjoy

Debugging and Profiling the Network

With Chapter 9, Creating an Online Adventure Prototype, we concluded Part 2, Creating Online Multiplayer Mechanics, of our journey, where we learned how we can use Godot Engine’s High-Level Network API to turn local gameplay mechanics into online multiplayer mechanics. Now, it’s time to go beyond implementation and start the optimization of our mechanics. This chapter inaugurates Part 3, Optimizing the Online Experience, of our journey through creating online multiplayer games with Godot Engine.

It’s important that you have read, understood, and implemented the content provided in Chapter 9, Creating an Online Adventure Prototype, because we are going to use the final project as our main subject through the following chapters in Part 3.

In this specific chapter, we are going to understand how we can use Godot Engine’s built-in Debugger dock to assess and profile our game performance. For that, we are going to understand...

Technical requirements

As mentioned previously, it’s crucial that you’ve read and followed the instructions provided in Chapter 9, Creating an Online Adventure Prototype. Here, in this chapter, we are going to use the final product you should have by the end of the previous chapter. You can access the resources for this chapter in the repository provided in the following link:

https://github.com/PacktPublishing/The-Essential-Guide-to-Creating-Multiplayer-Games-with-Godot-4.0

With the result of Chapter 9, Creating an Online Adventure Prototype, ready, we can move on to understanding how we can improve it.

Introducing Godot’s Debugger

The Debugger is a developer’s best friend. Most of the work we do doesn’t have anything to do with creating and implementing features; instead, it has everything to do with assessing potential problems these implementations cause and fixing them. The Debugger dock is where Godot Engine talks to us, showing errors, warnings, resource consumption, object count, and more. So, we should listen carefully and properly address the issues and data it shows us. We can even ask it to track custom data, as we are going to see in the Using the Monitors tab section.

If you have been developing games with Godot Engine for enough time to run into errors, you have probably stumbled on the Debugger dock more than you’d like to, right? In this section, we will go in-depth to understand how to turn it into our best friend and actually wish it pops up. Let’s start by understanding each of its tabs, how to read them, and what to expect...

Understanding the Network Profiler

It’s time to meet your best ally, the one that will help you address issues related to your craft as the network engineer of our fake studio and come up with potential solutions for the problems that appear along your journey. The Network Profiler, as the name suggests, is a profiler specialized in network-related profiling. It displays information about RPCs’ size and count, both sent and received, the node making and receiving the RPCs, MultiplayerSynchronizer nodes’ network consumption and syncing count, and even a bandwidth meter, which are all we need to assess the impact of our network code.

Note that the Network Profiler, by default, only tracks the High-Level Network API bandwidth. So, if you are using low-level approaches, such as PacketPeerUDP, UDPServer, StreamPeerTCP, and TCPServer, their consumption may not be taken into account by the Network Profiler by default. We are going to see how we can address that in...

Identifying the project’s bottlenecks

With all the tools we’ve seen so far in this chapter at our disposal, it’s time to use them to assess our project’s health and look for areas of improvement. Since your focus here is on networking, we are going to concentrate on features related to this area. In this section, we will use the final version of the Chapter 9, Creating an Online Adventure Prototype, project to look for areas of improvement using Network Profiler and the Monitors debugging tools. You will learn how to do the following:

  • Analyze the incoming and outgoing RPC count and size to identify potential bottlenecks in the network code
  • Use the bandwidth meter to track the total bandwidth consumption and come up with possible solutions
  • Assess the synchronization count and size of MultiplayerSynchronizer nodes to optimize replication data
  • Create custom monitors to analyze relevant data specific to your project and track potential issues...

Summary

With that, we conclude our chapter! Throughout this chapter, we introduced the Debugger dock, which is a powerful tool for assessing and debugging potential problems in our game, as well as for optimizing its performance.

We explored the Stack Trace tab, which gives us an overview of our game’s flow and provides us with multiple ways to gather information about the changes that happen throughout this flow, allowing us to understand the whole chain of cause and effect that led to a given change. We also talked about the Errors tab, which is where we work together with thousands of other developers who worked on the development of Godot Engine’s core and identified thousands of errors and documented them so that when they happen, we have some light on the issue and can fix it.

On top of that, we explored two powerful performance-based debugging tabs: the Profiler tab and the Visual Profiler tab. The Profiler tab is one of your best allies in this task, as...

lock icon The rest of the chapter is locked
You have been reading a chapter from
The Essential Guide to Creating Multiplayer Games with Godot 4.0
Published in: Dec 2023 Publisher: Packt ISBN-13: 9781803232614
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}