Game Development Community

Bug: Trying to shoot with a dead object causes hard crash.

by Kodafox · in Torque Game Builder · 04/07/2007 (3:41 pm) · 7 replies

This one's pretty easy to reproduce.
Go to the combat game behavior section of the behaviors playground.
Use the tank or ship to kill the other three times (until the other doesn't respawn)
Fire using the dead ships fire button.
TGB Crashes.

#1
04/24/2007 (9:17 am)
This bug is very easy to reproduce (1.5 beta 3). It's not just restricted to the shoot behaviour but all behaviours with key bindings..eg Asteriods movement / shoot etc. Seems like the unbindObj call is not actually dropping the bindings.

Correction: The crash is consistent on key releases. So if your player can move or shoot (via behaviours) and dies while you are still firing/moving the game will run fine until you release the key. This applies to any key that has been bound to the dead object which was pressed at time of death.

Totally loving behaviours tho. So much I actually posted!
#2
04/24/2007 (4:41 pm)
Might this not be related to the bug mentioned in the thread right above this one?

Check it out (with fix) here.

Does adding that fix and recompiling fix the issue?
#3
04/25/2007 (3:36 am)
Hi Eric, sorry no PRO license at the moment so I can't verify that the fix will work for this bug. Anyone with PRO want to test the fix works for this? The issues do seem very similar tho as they both call functions on non existent objects. The funny thing is with this one is that it just seems to be on key releases. If you just leave your player to die then try to move or shoot it behaves as expected and does nothing. If you hold fire until your player dies then release it TGB just falls over.

Hopefully this one will get ironed out in the next beta release :)

There is also another little issue relating (kinda) to this with takesDamgage & dealsDamage . They seem to be a little out of sync if a projectile does 10 damage it actually does 1000 damage. So if you want to shoot something twice before it dies its health has to be 2000. This should be easy to hack a workaround in script or just add a couple of 0's to your health for now. Its a little frustrating at first when everything keeps dying when you shoot it and it has 1000 health. This can be replicated in the playground as well in 1.5b3.
#4
04/25/2007 (3:09 pm)
It sounds like you're having issues with behaviors? Have you looked at the code behind the behaviors you're using? I've seen a behavior using takesDamage (fish tutorial I think?) that uses a multiplier internally and this may be what you're seeing?

What is the code you're using for 'fire'? Are you using a behavior? If so, can you verify that the actionMap is not actually set up to call the fire() function on keyReleased? Each button press has two points to which you can bind a function: keyPress and keyRelease. Sounds like maybe the function is set up to fire on keyRelease?
#5
04/26/2007 (1:27 pm)
Hi Eric, no I'm not having issues with behaviours but more how they behave or more accurately misbehave. All the issues above can be replicated with behaviours included with the 1.5 beta 3. If fact they can all be tested and verified with the playground. The code used for the "fire" is the Shoot Behaviour and takesDamage etc are the standard supplied ones... not ones taken from tutorials (tho they are likely to be very similar).

With the takesDamage/dealDamage combo the expected behaviour for 10 damage dealt is 10 damage taken. There are no multipliers in either source file (other than * 1000 for a respawn). For example in the playground with no modifications to any code or behaviours... shoot the ship with the tank once. If it goes red then your behaviours are working fine and making the correct calculations. If not the ship you shot just explodes. This is wrong. It should take 10 hits to kill and show varying shades of red until its dead. I've had a good mooch of the code for these behaviours and can't see anything that would cause this script wise.

The key bindings issue is also behaviour based. Its not just shoot but releases of any behaviour bound keys that down held when and object has killed by takesDamage. Try it. Kill that ship three times while holding its shoot key or a move key ... when its finally dead and disappeared release the key. TGB will die hard. It's a bug and it doesn't look like its script based.

Despite these little issues I think behaviours are a stunning addition to TGB. Anything that allows you to make a basic asteroids clone from scratch in under 10 mins is just genius :)
#6
04/30/2007 (4:33 am)
Just a quick follow up on this. After nuking tgb completely and a clean reinstall the takesDamage/dealsDamage issue seems fine. Tho oddly the scripts used are exactly the same.

The key release crash issue with the Shoots behaviour is still valid tho.
#7
05/07/2007 (3:55 pm)
The crash with shoots behaviour has been fixed for the next release - bug id #2975