Avoid errors
Monkey Forums/Monkey Programming/Avoid errors
| ||
Hi all. How do you finding bugs? I use Jungle Ide, but it is so difficult to understand where is the problem. Thank you. |
| ||
Are we talking actual errors that cause the game to crash, or bugs that cause the game to behave in a way you're not expecting? If the former, compile as debug and it will tell you the source file and line number which caused the error. |
| ||
You can also use the debugger when working with GLFW |
| ||
Are you doing a debug build? If so, it should show you which line number in your monkey file caused the crash in the output window. |
| ||
Most logical bugs that I encounter I either "guess" what it is, or when that does not work I use DrawText( "Player Health: "+player.Health,20,20) to print the values I'm interested in i realtime. I actually have found myself that I very rarley use the debugger, only by mistake if there is a null error, I'd love to hear about how you do to use it more proactivly. In C# I extensivly use the debugger, but that is because I can pause at a breakpoint, edit code and then resume without restarting the Game. |
| ||
thanks to all |
| ||
I find I don't use the debugger so much as in C++ but that is probably because of the absence of a handy ASSERT macro. It was nice to be able to break when a function gets unexpected parameters etc. Generally that's closer to the bug than the eventual crash, or it spots bugs that don't usually cause problems. I suspect Mark wouldn't be crazy about adding macros to Monkey, but there are times they would be handy. |