Debugging (via path-fixing) in squiffy

This is not squiffy-specific advice but more for newbies trying to learn how to organize things. I've got a game, "StoreyMinus" which I was pretty proud of. Last weekend I was playing through and there was a minor chance of something random happening at certain stages. Oddly, it happened each time I went through that point. Curiously I looked through the code.

Turns out I'd been path-testing code at one point during development. Something like this...


    if (get("path2")==1){squiffy.story.go("Tunnel special event");}

Clearly this event should happen 1 time in 11 (don't know why my probability was so specific). Still, clearly I wanted to test it and did. Then the wife must have wanted something or a cat came in to play. All I know is I left this force-test (the alteration of path2) to 1. And so you always got it. Fixed the bug and reloaded the game.

Now here's the lesson. In every case (other than this) I place a TTD (Things To Do) notification next to ANY temporary code (so this sort of thing doesn't happen). It should have looked like this...

    set("path2",1);  //TTD

Then, before release, I check to make sure I didn't leave any TTDs behind. This makes sure that all my debug statements and testing is cleared correctly before a release. But in this case, I didn't. Very embarrassing.

Ignoring the case where I didn't, always make sure you flag temp code so you know where it is when it comes time to release. Okay, lecture over. Dismissed!

I'm used to flagging code with TODO (where there's code that doesn't exist yet, or a placeholder), FIXME (a bug that I've found but didn't have time to fix properly), or DEBUG (as in this case). Using capitals makes it easier to spot them; and I assume the same words are used by a significant number of programmers, as my usual text editor's default syntax-highlighting rules make them show up bright red if they occur in comments.

Yop. A lot of coders have tricks to keep things straight. It just galls me that I missed this one. I'm pretty solid about always marking temporary logic changes and this time I let it slide/got distracted.

This topic is now closed. Topics are closed after 60 days of inactivity.