Game Development Community

AdvanceObjects has bad object?

by Jay Barnson · in Torque Game Engine · 05/12/2005 (8:06 pm) · 6 replies

Okay, I'm finding a weird "once in a blue moon" type error that's driving me nuts. I've got a bad object on the ProcessList when it's calling AdvanceObjects(). It has some semi-random data that just HAPPENS to match the ShapeBase mask and so it's getting called.

Any idea what I could be doing to cause this?

About the author

Jay has been a mainstream and indie game developer for a... uh, long time. His professional start came in 1994 developing titles for the then-unknown and upcoming Sony Playstation. He runs Rampant Games and blogs at Tales of the Rampant Coyote.


#1
05/13/2005 (11:08 pm)
What does the debugger say about the memory you're trying to call on?
#2
05/14/2005 (9:11 am)
I'll see if I can repro the error fully again today. The object apparently is of the proper type as my custom object, so it's getting all the way into the class ProcessTick(). The problem is that it's data - which all normally gets zeroed out or set to plausible values by my constructor - is set junk like 0xcececece.

So I check on a couple of flags (which are coming out false and true based on the bogus flag value), and then I call a function which calls a function to find the height of the ground beneath it via getContainer()->castRay. That's where it crashes, due to it's position being out in never-neverland.

It's interesting that the function calls within the object are succeeding - it's just that the data is smashed. It COULD be a data corruption, I suppose, but it's acting like an object that has never been initialized via the proper constructor call. Maybe a call to a parent class's constructor?

Unfortunately, that was the best I was able to come up with from the debugger's information. Anything specific I should look for the next time it comes up? The last time it occured was after I'd let the game run for a long time... though occasionally it happens right off the bat.
#3
05/14/2005 (2:33 pm)
It sounds like a "lost" reference to an object that was removed/deleted, and didn't clean up properly from your objects list--are you doing anything unusual with how you remove objects from the game world by chance?
#4
05/14/2005 (5:48 pm)
Nope, just calling deleteObject(). At least I *think* that's normal :)

It's entirely possible I've done something naughty in my subclass that is causing it, but I'm not sure what could be mucking with the behavior of deleteObject.
#5
05/15/2005 (7:04 am)
You can be using delete properly, but if you aren't properly registering your object itself as it's created, or possibly creating and using a direct pointer reference to the object, and then deleting via that reference, it could cause unexpected scenarios.

If you'd like to email me with your implementation I can take a quick look, and see if anyone can spot anything obvious.
#6
05/16/2005 (10:43 pm)
Thanks a million, Stephen. The files are away. I appreciate you taking the time to do this.