06-01-2025, 12:29 AM
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?
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?