Skip to content

How to debug your game net code

Andrea Catania edited this page Dec 5, 2022 · 11 revisions

To debug your game net code you can use the builtin debugger, that will allow you to fetch node data per each frame.

!TODO add an image here!

Use it in three steps.

1. Enable the debugger

As first thing you want to enable the SceneSynchronizerDebugger as by default it's disabled; you can enable it by set the godot project settings property NetworkSynchronizer/debugger/dump_enabled to true.

2. Enable the debugger

By default, the debugger fetches a bunch of useful information from all the networked nodes; however, if you want to also fetch information from some other nodes you can add the class name to the project settings NetworkSynchronizer/debugger/dump_classes: the debugger will fetch information from any node that inherits the classes you add to that list.

3. Just reproduce the behaviour to debug

Now that the debugger is enabled all you have to do is to open the Client/Server instances and reproduce the behaviour you want to analyze. Once you have reproduced the issue, you can simply close the instances.

Now navigate to your godot/bin directory to find a newly created directory: net-sync-debugs/dump. Navigate into it.

There you will find the debugger.py (a python UI to help you navigate the debugged frames).

Launch it using the command python debugger.py

Note, to use the UI you must install:

  • Install python
  • Install pip
  • Install PySimpleGUI: pip install pysymplegui
  • Install Tkinter:
    1. Install Tkinter app:
      • Fedora: sudo dnf install python3-tkinter
      • Ubuntu: sudo apt-get install python3-tk
    2. Install python library: pip install tk

The UI

The UI is composed by 5 sections type.

Screenshot from 2022-12-05 14-59-06

  1. Frame list: Show all the frames + a small resume about the frame.
  2. Node list: Shows all the nodes captured in that frame.
  3. Error detection area: The debugger has the ability to detects some malfunctioning; In that case, an error about it will appear there.
  4. Node dump: This area shows the node variable dumping.
  5. Log output: Here you will find the log output generated by the selected node on the given frame. (Here you can find a bunch of messages, warnings, errors, but also the data buffer write and read).
Clone this wiki locally