Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Debug Tips and Tricks

Author
Message
Walkman1014
9
Years of Service
User Offline
Joined: 12th Mar 2015
Location: United States
Posted: 24th Mar 2015 20:55
Hello Everyone,

I understand that implementing a debugger is the next priority on the developers checklist (which I agree with and look forward to).

In the mean time, I was hoping to get tips and tricks on debugging complex logical bugs. Many users have managed to deploy great games that I am sure had some monstrous bugs crop up during development. Do you have any advice for a new user?

Thanks!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Mar 2015 09:16
I've attached my debug include file. You can use it outright, or take ideas from it. It writes to a debug.txt file in the media folder (writeable media folder in Appdata folder). You need to:

#include "debug.agc"

Then

debugStart()

in your main code to kickstart the module. Wherever you want to output information to the log use:

DebugWrite("MyVariable = " + MyVariable$)

If your program is crashing, use

DebugWriteSave()

This ensures the text is saved to the file, otherwise it may not write it before the crash.

Use:

DebugSave()

to save at regular intervals (slow, so don't use everywhere)

Use:

DebugWriteConsole()

to write to the screen. This is for slow-moving output. If you write to it every cycle, it will just be a blur of unreadable information. If using the console, then before every sync(), call:

DebugOutputConsole()

Quidquid latine dictum sit, altum sonatur

Attachments

Login to view attachments
Walkman1014
9
Years of Service
User Offline
Joined: 12th Mar 2015
Location: United States
Posted: 3rd Apr 2015 09:21
I forgot to thank you BatVink. It has been a week since I logged in.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Apr 2015 13:28
No problem.
Also, check out the debugger that was launched this week in 2.0.12.

Quidquid latine dictum sit, altum sonatur

Login to post a reply

Server time is: 2024-04-24 02:23:30
Your offset time is: 2024-04-24 02:23:30