-
Notifications
You must be signed in to change notification settings - Fork 23
How to debug your game net code
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!
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
.
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.
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:
- Install Tkinter app:
- Fedora:
sudo dnf install python3-tkinter
- Ubuntu:
sudo apt-get install python3-tk
- Install python library:
pip install tk
The UI is composed by 5 sections type.
- Frame list: Show all the frames + a small summary.
- Node list: Shows all the nodes captured in that frame.
- Error detection area: The debugger has the ability to detects some malfunctioning; In that case, an error about it will appear there.
- Node dump: This area shows the node variable dumping.
- 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).
You can use the first panel to navigate the frames (You can use the arrows too). The next thing you want to do is to select the nodes to debug (using the 2nd panel); essentially here you are filtering the nodes.
The 4th panel shows the nodes status: essentially the debugger dumps the node variables before starting the frame and after.
By comparing the variables between the client and server, you can gather useful information: For example you can figure out why a registered variable de-sync.
....
Community & Support
- Open an issue
- Start a new discussion