Saturday, June 07, 2008

XeO3: I knew it!!!

Oh well... I knew it was going to smoothly... I've discovered a bug thats gonna delay things until I manage to find and fix it. Shooting at the boss you eventually stop firing for some reason. No idea why, but it looks like your bullet counter goes negative, and then is unable to fire any more. No idea why - theres only 2 places which reduce the counters, and I cant see how this is possible - fek.


Iapetus said...

Part of the joy of coding games ;)

TNT said...

Freeing same bullet twice because it collides with two boss parts during single frame? Been there, done that :)

If you have free_bullet index right before/after free_bullet table it might be that you get index out of bounds, and then overwrite index itself when trying to update bullet free status.

Mike said...

Yeah I'm not sure as I can't figure out currently how to trap it BEFORE its too late! I think its something to do with shooting explosions.
Now thats not right anwyay and its easily fixed, but I want to figure his out first before I fix it, otherwise it'll just burry itself and be harder to find later.

TNT said...

Add sanity checks both before and after places where you update counters. If counter is bad then enter endless loop - that way you can check the game state at the time bug hits. Keep a copy of previous frame state into some free memory if necessary.

That's how I found out where and why I was freeing the same object multiple times.

Mike said...

Yeah, done that already :)

Trouble is its too late by that point... I really need to trap it when it goes wrong, and thats not when the counter goes wrong.

I'm slowly narrowing it down, but its still eluding me.