MFGG Forums
Question about hunting for bugs - Printable Version

+- MFGG Forums (https://forums.mfgg.net)
+-- Forum: MFGG (https://forums.mfgg.net/forumdisplay.php?fid=4)
+--- Forum: Developer Discussion (https://forums.mfgg.net/forumdisplay.php?fid=10)
+--- Thread: Question about hunting for bugs (/showthread.php?tid=3332)



Question about hunting for bugs - GeneSu730 - 06-01-2025

Dear All:

Have any of you had a bug in your source code that you have not caught for years because its effects were rather sporadic?

For the last 5 years, I noticed that maybe 1 out of 20 times, my Super Mario game would freeze. I had no idea what could be doing it.

Yesterday, however, I found a very subtle bug in a subroutine dealing with my animation layer. My animation layer has each animated tile with a sequence of frames. The sequence is of variable length and is dynamically allocated at run-time. However, some tiles are just single frame (such as stone or metal blocks that Mario leaves behind after hitting treasure boxes). The sequence would be of one element but my code would attempt to access a "second" element, creating a serious memory access error.

I would not have found this error except I tried to expand this subroutine to add certain special effects to my animation layer such as thunder and gradual lighting. It seems like I did not catch this bug for the last 8 years because the memory after the allocated sequence would usually read NULL, which signified the end of the sequence. However, it doesn't always have to be NULL, which is why I suspected the game froze from time to time.

Has something like this happened to you? You scratch your head for years as to why your game sometimes doesn't work once in a blue moon. Then you suddenly want to recode a subroutine and you find something that doesn't add up?


RE: Question about hunting for bugs - Grey Goo - 06-01-2025

For years? Not really. For few days? Likely, but whats probably because of my coding style, simplicity (and check or swap around for memory boundaries). This doesn't mean one would not get stuck on certain type of coding error. Wrong logic. Logic itself adds up, but its effects are wrong and thus it may take long time debug, before you notice that you are using wrong logic. Makes wonder if you got same type of coding error?...


RE: Question about hunting for bugs - VinnyVideo - 06-01-2025

First of all, it's good to hear that you finally tracked down the random crashing bug! That was an annoying one... and a really hard one to pin down.

When I was working on Career Fantasy, I had a few hard-to-solve bugs - for example, a bug where the game would crash if a player attacked a turn after healing or buffing. There were also some pesky bugs if player or enemy parties had exactly three members. Those took a little while to fix completely.


RE: Question about hunting for bugs - GeneSu730 - 06-01-2025

(06-01-2025, 03:30 PM)VinnyVideo Wrote: First of all, it's good to hear that you finally tracked down the random crashing bug! That was an annoying one... and a really hard one to pin down.

When I was working on Career Fantasy, I had a few hard-to-solve bugs - for example, a bug where the game would crash if a player attacked a turn after healing or buffing. There were also some pesky bugs if player or enemy parties had exactly three members. Those took a little while to fix completely.

Actually, Vinny, the bugs you describe have seem to have a concrete trigger. I fixed two memory access errors before. The first dealt with big enemy footprints and the second dealt with Charging Chuck. My comp sci teacher said that bugs are easier to fix if they have predictable triggers and produce lots of output.


RE: Question about hunting for bugs - VinnyVideo - 06-02-2025

True. My Career Fantasy bugs weren't quite as random as yours, but it still took a lot of digging to find the root cause of them, especially since JRPG battles rely heavily on RNG.