Step into, Step over, and Step out: These buttons advance our code line by line when the application is paused. This is what the toolbar looks like:įrom left to right, we have these sections:Ĭontinue, Break, and Restart Game: These buttons let us pause (break) the program, continue to the next breakpoint (or continue execution if no other breakpoints are set), and restart the program.Ĭlose the game: This one acts similarly to the one above to stop the execution of the game. Let’s go over each one of these, and we will go into more detail as we go along in the article. Once you are in the Debugger tab, you will see a set of buttons at the top.
If a window isn’t showing up, or you closed it by accident, go to Debugger → Windows and there will be a full list of available windows that can be displayed. You can customize the layout of every one of these windows, but here’s what mine looks like: Once the game launches, you will see a new tab show up at the top of your code editor, and a multitude of other windows opening. However, to launch the game with the debugger attached, you will need to press the Bug icon instead, or you can also use F6. You may be used to launching your game by pressing the Play symbol at the top bar, or by pressing F5. Once you pinpoint the function/section that is running slowly, then you can optimize it. This is where the profiler comes in handy, giving you detailed information about what functions are being called at every stage of the game run-time and compiling the data in a way easy to analyze. Programmers are decent at spotting obvious bottlenecks, but on any application that isn’t trivial, it’s hard to find them. Profiling is often more useful in the second half of the project when you experience slowdowns in your game due to the amount of objects interacting with each other. It can also show you more advanced information, such as the state of your textures and surfaces, current graphics options, values of buffers, etc. GameMaker’s debugger allows you to run your code line by line, checking the values of every variable and their changes along the way. This is fine for quickly debugging a small feature, but when you have many moving parts working together, generating these messages can quickly get out of hand. The first solution that comes to mind is to check the values of variables, or the results of conditional statements, by using debug messages or drawing text to the screen. Then we go back to the code and look at it for 20 minutes thinking it should work. We’ve all been in that situation where we write code, run the game, and nothing works like expected. Reading the official documentation is also a great way to learn more about it after you’ve read this article. It’s a good idea for you to experiment with all these tools yourself and figure out ways to make your debugging experience easier and better. I will try to cover as much as possible on these tools, but I will most likely miss a few points, given it is such an extensive topic. In this post, I will explain my process when debugging my games, and some tips to find bugs quickly and identify bottlenecks in your game.
Luckily, YoYoGames overhauled its debugger and profiler, making it more robust and easier to use.
Having good tools to make these processes easier is important.
As software developers, we spend just as much time, if not more, debugging and profiling our programs.