Debugging your creations - A short discourse on the subject

Unless your creation skills are flawless, chances are anything you create will have a bug or few. And it can get very frustrating finding and squashing these bugs. I'd like to point out a few methods to aid in the tracking down of bugs, and if others have methods they use I'd like to see them post those as well. Realize that a good methodology of debugging your programs will save you a lot of time(since you won't have to constantly run to others asking what the problem "could" be, and then spending time answering questions about your program), and frustrations(since you can find and fix your problem yourself).

Just consider these 'tools' in your arsenol. To make a good game you need more than to be able to write code, you need to be able to debug it as well.


Debugging 101 :


Remove and redo slowly option
If your program previously worked but then you added/changed numerous things and then it stopped working, this method will quickly identify what the exact problem is. Remove the changes you have made(not physically... if you added an event simply don't call the event. If you added a picture then unlink the picture) to get you back to the point where your game works. Then one by one add in the changes that you had made back into your game, stopping each time you add something back in and compiling/running your game. When the game ceases to work then you've found the item that is causing the problem(the last thing you added). You can now concentrate your efforts to find out what is wrong with that item...


Message flagging option
If you have a good idea about where a problem is, but you can't narrow down precisely what is causing the problem(ie, you know that an event you are running isn't setting something correctly, but you don't know where in the event the problem is occuring), using a series of message flags is a good way to locate the issue.

If you have a crashing problem or a problem with a series of events not being called, then you can place dialog event objects in strategic places with short "flag" messages(ie., "1" or "Got here"). For example, if you have an event that executes 4 events in succession, and whenever this main event is run the game crashes you can identify which of the called events is the culprit by placing 4 flag messages; one in front of each event call with markers written something like, "Beginning event 1 call" etc. Then when the game is run you should see the dialog box pop up before executing each event. When the game crashes you will know which event was crashing(ie, if you saw "Beginning event 3 call" and then the game crashed before you saw the last flag message, then you know the problem lies in the 3rd event call, and you can debug that event).

If you have a problem with something being set incorrectly, then you can use a flag message before and after the event object that is being used to set something. Use a dialog box with tag values to display what the statistic or other thing that is being set before the call, and then another dialog box showing what it is after the call(for example, if you want to add 30 to strength, you could make a dialog box displaying &&Strength; both before and after the attribute wizard to add to the strength. In the game when the event is called, you would see a display box pop up showing the player's current strength, and then another one showing the current strength. If the attribute wizard worked correctly you would see a change occur in the dialog boxes).


Testing a known working picture
If you have a display problem with a picture, a quick way to determine if it is a code problem(you called something in the wrong way) or if it is a problem with the actual picture(format, colors, etc) is to substitute it with a known working picture. This ca be something that you have already used that displayed correctly, or a default picture from within Coldstone's art lib.

Note that it is possible to be both a problem with code and the picture. If you can't get a known good picture to display properly, fix the code so that you can view the known good picture, then substitute it back to the original picture. If the original picture is no longer viewable with the working code, then fix the picture.


------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url)

So Stark... when are you going to write "Coldstone: The Definitive Guide" for O'Reilly? You are almost there! Good job! 😄

Apollo16

------------------

I've also found that being able to teleport around from map to map is a pretty valuable time saver.

In my case I use a plugin because it will be much easier to remove from the eventual release than the other option, of coding it into the game, would be.

Right now all the plugin does is allow me to teleport from map to map. As my game evolves, though, I will eventually add ways to quickly level up, or add quest related items. Thus making it easier to test specific things quickly.

------------------
(url="http://"http://jankostar.net/sanko")my Page of Garbage(/url)

Great info Stark. Really informative. I hope I'll be able to use it soon... now if only I had a game to at least debug 😉

------------------
What stands before us
today is a meer foreshadow
of tommorow, fight hard or
die trying.

Thanks a bunch, Stark. If everyone reads and follows this, the number of "Help! Coldstone doesn't work!" posts on this board will vastly decrease. 🙂

------------------
I don't know what I'm talking about.
(url="http://"http://homepage.mac.com/glennfield/ColdstoneBugs.html")Coldstone 1.0.1 Bug List(/url) - last update 10/10/2002

Thanks for the suggestions, Stark. I will learn them by heart. In the meantime, I will post my stupid question anyway...

------------------
"Get back to work, you slacker!" - Duke Nukem