Game Development Community

SetCollisionTimeout Crash

by Drew Hitchcock · in Torque Game Engine · 10/18/2004 (1:14 pm) · 17 replies

The SetCollisionTimeout function (member of the item class) has been giving me problems lately, and I was wondering if anyone could confirm that there is a problem. Forum searches haven't turned up anything particulary relevant.

Almost everytime I call the SetCollisionTimeout function, I will either get an 'invalid packet' error, or the entire game will just crash.

If you'd like to try to reproduce the problem, the easiest way is to run starter.fps with a clean 1.3 torquedemo, open the console, and type "1507.throw(Crossbow, 1);" where 1507 is the player's id. If the player successfully throws the crossbow (which has happened to me a few times) pick it up again and throw it again. Within 2 or 3 throws you should get the crash.

I've noticed that the crash is more reliable in first person mode, but that might be my imagination.

Anyway, I just though I'd throw this out to the community and see if everyone else is having the same problem, and if there's any way to fix it.

#1
10/21/2004 (8:06 am)
I just had someone confirm that this is a crash in stock torque.

I've attempted to debug this, but the crash happens a little while after the function call, not directly because of it, so it's a bit hard to debug.

Running in Debug mode, the engine says 'Error, NULL ghost encountered'
#2
10/21/2004 (10:33 am)
Glad to hear it wasn't just me. I recently redid throwing like actions, starting with the stock script code. The timeout line always crashed, and without it, the objects always hit the player throwing. So, I simply redid my logic to were neither case was applicable.
#3
10/23/2004 (3:39 pm)
Well, it looks like I've found a fix....not that anyone except Erik seems very interested.

anyway, line 850 of item.cc looks like this:

S32 gIndex = stream->readInt(10);

it should look like this

S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize);

This fixes the crash, so you can actually use the throw function in script after you change this.

EDIT: fixed line number
#4
10/23/2004 (4:05 pm)
Thanks for the fix Drew. This just fixed my problems with thrown items 'disappearing' and then 'reappearing' after they've been thrown.
#5
10/24/2004 (1:13 am)
Nice catch :)
#6
10/24/2004 (10:42 am)
Great work Drew.
#7
10/25/2004 (11:44 am)
Glad to help :)
#8
11/03/2004 (10:39 pm)
I fixed this one. Thanks, Drew.
#9
11/23/2004 (1:04 am)
Just ran into this problem yesterday when I decided to start the throwing functionality and was driving me crazy.

Fortunately I found this thread! Thanks for the fix!

Nick
#10
11/27/2004 (5:41 am)
Simply amazing. I can't explain how long this was a problem for me. Excellent work.
#11
11/27/2004 (7:13 pm)
Great Drew !
Now i can use 1.3 again :)
#12
02/06/2005 (4:05 pm)
I just put some throwing items in my dev project, instant fix, hopefully this will be implemnted as a bug fix soon. So no one else has to run search for it. Nice job Drew.

Eddie.
#13
02/07/2005 (12:57 am)
@Eddie

Ben Garney confirmed that this will be in 1.4 (I sent him a patch a few months ago.).
#14
03/11/2005 (12:51 pm)
Thanks drew
#15
03/15/2005 (12:04 am)
This is in 1.4, confirmed.
#16
07/12/2005 (5:51 am)
I just grabbed the latest TGE and it was not in here. Everytime I pull the latest TGE I have to implement this change.
#17
01/02/2007 (3:52 am)
This change is in TGE 1.5.