Game Development Community

MRepairRate possible bug (bug for me at least)

by Clint S. Brewer · in Torque Game Engine · 02/16/2005 (4:36 pm) · 3 replies

disclaimer
I've made lots of changes to the engine.

problem
Recently I was converting the concept of damage into hit points. At the same time I was implimenting a skill that lets the player heal naturaly. I used the built in repair rate to do so. This was the first time I have really used the repair rate code. The problem I ran into was that when the main character died, it would be dissabled for a second, but then would switch back into the enabled state because it would get one tick where it could repair itself a smidgen before it had beed deleted.. You can imagine the horror as corpses thought to be dead suddenly jumped into life and became valid targets again.


in ShapeBase.cc

in the processTick function
in the section of code that applys the repair rate, you will see that it starts something like this
// Repair management
   if (mDataBlock->isInvincible == false)

then goes on to apply the repair. Note that there is no check whether or not we ar Enabled currently

my fix
add an aditional check here
if(mDamageState == Enabled)

and do the repair adjustment only if that passes


[re-disclaimer]
I'm not sure if this will be a problem in the standard engine, and it could be caused just by the way I'm handling damage in my game.

#1
02/16/2005 (11:29 pm)
Quote:
You can imagine the horror as corpses thought to be dead suddenly jumped into life and became valid targets again.

I love this ,thats what make a game scary :)
#2
02/17/2005 (10:57 pm)
Haha yes indeed. I do have to admit that once it started happening I killed myself over and over again for about a minute until there were arround 15 of my corpses arround. good. clean. fun.
#3
02/19/2005 (4:47 pm)
I would think the better approach would be to turn off repair when the thing is dead. ;)

The repair rate stuff was used in T2 in order to implement the repair gun. So it naturally works if the thing is destroyed.