Game Development Community

Debris not working?

by Jacob Dankovchik · in Torque Game Engine · 06/05/2004 (5:16 am) · 12 replies

I was tryin to do some stuff with debris, when i happened to notice it wasnt workin in explosions. I just downloaded the latest HEAD and tried, no debris there either. Nor is there any smoke in the crossbow explosions. Everyone else is gettin this prob, right? Just thought i'd point it out, and if it has been, sry.. :P

#1
06/05/2004 (5:38 am)
I've seen it too, I didn't find the problem so I switched back to 1.2.2
#2
06/05/2004 (10:48 am)
Ok here's the deal. I went ahead and "fixed" this by changing Explosion and Debris ::onAdd function back to the way they were before.

They were changed not too long ago to fix a crash issue related to creating explosions in script. However it seems that fix has caused the debris to not render at all.

This issue needs to be looked at in the future...
#3
06/05/2004 (2:07 pm)
So it's better to crash and burn than to not debri?
#4
06/05/2004 (2:41 pm)
@Gonzo
No one said that.

@Robert Blanchet Jr
What is the new way of creating an explosion?
#5
06/05/2004 (7:07 pm)
Also, what exactly were the circumstances that made this crash? Cause i dont remember it jsut plain crashin on all explosions, so what DID cause it?
#6
06/05/2004 (10:22 pm)
Making an explosion or debris on the client side resulted in crashes.
#7
06/06/2004 (5:27 am)
Ok.. Well, would perfer if ya keep debris workin tho instead of the explosions.. :P But does it look like this will be remedied soon? Thanks.
#8
06/06/2004 (11:29 am)
Infact.. think i'll take this time to now post wot it is i jsut made.. once i finish some more work, may submit it as a tut.. Its gibbing for the players!

simply add this:
if (%damage > (%this.getdamageLevel+35))
%this.gibme = true;

to the beginning of Armor::damage in player.cs, and then add:

if (%this.gibme == true)
{
%p = new explosion() {
dataBlock = "GibExplosion"; //name of ur player's explosion
position = %obj.getPosition();
};

%obj.schedule(0.01, "delete");
MissionCleanup.add(%p);
%obj.setImageTrigger(0,false);
return;
}

to the top of Armor::onDisabled and then an else and brackets to enclose everything else.. then just copy the crossbow explosion and everything paired with it, rename and change settings to ur liking, and your good to go! :D I noticed that throughout torque theres bits and peices of wot looks like an attempted gib system but was never compelted... So, i just whipped up this makeshift version.. ;) Hope it works for ya! :D

edit: quick note, the 35 is the value of ur negative health it takes to gib.. so if the damage done would take u 35 below 0 on ur health, u'll gib.. get the idea? good.. ;)
#9
06/07/2004 (9:34 am)
I recently tagged this issue when working with explosions. I noticed a check was placed in the code that, during the onAdd event for explosion/debris it was checked to see if it was being called by the client instance. If so, then abort. But this was causing the explosions/debris not to show up.

I removed that simple check and it started working. But I have not seen any crashes, even in multiplayer.

How is this supposed to work? The explosions and debris are spawned on the server and then the data is propagated to the client with the explosionID bits so that it gets rendered? At least, I believe that's how it works.

Either way, something is indeed broken here.
#10
06/07/2004 (10:10 am)
It has never ever been causing crashes on our servers previously.. and that's with 40+ players testing.
#11
06/09/2004 (8:13 am)
David,

Before that check, what would happen is if the server, and you had to be running a dedicated, created an explosion in script then it would crash the dedicated server.

Even if it didn't crash the server, there is nothing in the explosion to propogate the explosion from the server to the client.

To fix the issue I thought I would add isClientObject checks in the onAdd functions for Explosion and Debris. I also believe the Splash effects are effected by this as well.

What I have noticed now though is the isClientObject check always fails, regardless of it being a client object or not.

Tim Gift has advised me that the Explosion, Debris, and Splash are all meant to be pure client side only effects. However, we recognize that it may be desireable for server scripts to create explosions on the server. So with that information in mind I will fix the issue with Explosions, but I am also going to add sanity checks in Debris and Splash to make sure that they are not created on the server side.
#12
06/09/2004 (9:37 am)
@Robert: Thanks, that clears things up. I saw code in ShapeBase for ExplosionID and DebrisID but I am guessing this is leftovers from the Tribes days when the engine would auto-blowup objects when their damage went too high.

I also saw the same issue with isClientObject() always returning false. Never occurred to me that isClientObject would be the one at fault here, doh.

I agree that these effects should be rendered, tracked, etc. purely on the client side, but I would like to initiate these effects from the server side. (And it looks like I'm not the only one, judging from the questions here.) I'm utilizing melee code, and the object state isn't tracked in C++ code at all as it is with projectiles. So explosions have to be spawned by the server, unless I wanted to make a C++ glue class -- But I see no reason to do so for something so simple as a melee weapon. I'm happy to handle it all in server-side script.