Gdevelop Game Debugger and Profiler
In this post we will learn how to use Debugger. It helps us remove bugs from our game. A bug is basically a error or fault in our game that makes game work in in intended. A debugger helps remove bugs from our game.
Debugger
Its a tool that is used to inspect the variables and objects of game at runtime. It gives us information about the objects and variables in the game. By using this information we can track the bugs in our game. It Debugger as it helps us remove the bugs from our game.
Using Debugger we can inspect global variables, scene variables and variables of instances of objects in the game. We can then analyse this information to find problems in our logic and game.
How to Launch game with the debugger
To use the debugger, we need to launch the game preview using the Debugger. To do this just go to the toolbar of a scene editor, click on the “Debug” icon and then choose “Preview with debugger and performance profiler” option in menu. This will launch a preview of your game and open a new tab called “Debugger” along with it .Inspecting and Editing
Once you the game is running you can see that an extra tab called Debugger is opened. There you will see the "Inspectors" window on left side of screen. In this click refresh button. This will open
list of Global Variables and the Scenes,
You can find information about the instance of object and Variables. Just Click on the Section to expand it. You can inspect and edit the variables in general tab.
Remember you will need to click refresh to see updated values.
For Example , I have opened platformer example. I will check how the score variable changes using debugger.
I run the game with debugger and click refresh button. Now I can go to the Scene->New Scene-> Scene Variable to check score which is currently 0.
Now I go to game preview and collect a coin to increase it by 100. I go back to Debugger to see if has changed. Again I have to click refresh button to see changes. It shows 100 as expected. I can change this by click on it and changing it to lets say 1000 and then click the tick mark on side to confirm.
If I now go back to game, the score has now changed to 1000.
Profiler
Profiler in gdevelop tell how much time is spent on parts of engine at runtime. This basically tells you what is using more resources and helps you optimize your game. it can help minimize the lag and bottlenecks by measuring the time spent different part of your game.
Profiler will be at the bottom of screen. Click on Start Profiling button to launch the profiler. After few seconds you can stop the profiler. It can show you measurement of 60 frames at the max which will take 10 seconds to measure at 60FPS. Total no of frames are shown at the top of table.
There games parts of game are shown as section in table these are, Objects (pre-events),Events ,
Objects (post-events) ,Objects (visibility),Render.
Where the Objects section shows the time spent running behaviors before(pre-events) and after(post-events) the events and time spent checking which objects will be rendered (visibility).
There are three columns in table these are,
- total time spent in this section during the time of the profiling.
- percent of time spent in this section compared to the parent.
- percent of time spent in this section compared to the total time.
I hope you found it useful. Please subscribe our youtube channel for more such tutorials🙂.
Comments
Post a Comment