Game Development Community

Particle explosion do not work at client-side !!

by BLACKHOUND · in Torque Game Engine · 10/16/2002 (11:17 am) · 48 replies

hello i need some help

my explosion show only at server-side, why ??

----------------

Code :

function SmokeIt()
{
...

%p = new explosion() {
dataBlock = "SpellExplosion";
position = "526.874 86.8943 145.435"; //%finalPos;
};
MissionCleanup.add(%p);

return %p;
}
-----------------

what is the problem ?

thx
Derek
Page«First 1 2 3 Next»
#41
08/22/2006 (5:43 am)
Anyone?

Come on guys, someone must have this nailed. It's pretty important stuff eh?

I've got a multiplayer game, it's working great. The only problem is stuff I'm blowing up only shows on the PC hosting the game. It would be a really big deal if someone could shed some light on this, and help me get it working...go on, you know you want to. 8)
#42
08/22/2006 (6:49 am)
If you look at the above referenced resource
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8135

+ add just a tiny bit of code as explained then you are all set.

Works for us/me in multiplayer with ded server
#43
08/22/2006 (7:06 am)
Okay, cool. If this resource does the job, I'll get our guy in for a day to code it for us. Just so we know for sure, is it obvious where all this stuff goes from the resource above etc etc.? and what scripts/parts of the engine need to be changed etc.

So do you think it works fine when followed to the letter and all that?

Many, many thanks for your help here Thomas, I only ask these quuestions as our guy has been defeated by the explosions across network thing before, although this may not have been the resource he was working from.
#44
12/18/2006 (9:47 am)
@Thomas tried to add that in but get out of bounds errors etc
Could you post the complete working cpp file?
#45
12/18/2006 (1:32 pm)
Here is a quick and dirty way to network explosions through script.

Here is the server side portion of code:
//Make explosion
  %dbName = "RootGroup/DataBlockGroup/CrossbowExplosion";
  %dbID = nameToID(%dbName);
     
  //Play the explosion for the clients
  for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
  {
    %client = ClientGroup.getObject( %clientIndex );
    CommandToClient(%client, 'CreateExpl', %pos, %dbID);
  }

Here is the client side portion of code:
function clientCmdCreateExpl(%pos, %dataBlock)
{
  createExplosion(%pos, %dataBlock);
}

*The explosions are currently not networked. A projectile is ghosted and the explosion datablock information is given to the client. Because Torque uses ghosting for security we cannot just access the datablock by name on the client side. What we do here is access the datablock object from server and then let Torque's networking do the translation for us.
#46
12/18/2006 (2:36 pm)
@Joshua createExplosion is not a console call. Are you saying to do this?

function clientCmdCreateExpl(%pos, %dataBlock)
{
%a = new Explosion()
{
dataBlock = %datablock:
position = %pos;
rotation = "1 0 0 0";
};
}
#47
12/18/2006 (3:01 pm)
I am sorry for the confusion, it seems that createExplosion is a function I added myself into the engine.

Here is the code:
void createExplosion(Point3F position, ExplosionData* data)
{
  Explosion* pExplosion = NULL;
  
  Point3F p = position;
  
  Point3F n;
  n.x = 0;
  n.y = 1;
  n.z = 0;

  pExplosion = new Explosion;
  pExplosion->onNewDataBlock(data);
  MatrixF xform(true);
  xform.setPosition(p);
  pExplosion->setTransform(xform);
  pExplosion->setInitialState(p, n);
  //pExplosion->setCollideType( collideType );
  pExplosion->registerObject();
}

ConsoleFunction(createExplosion, void, 3, 3, "pos, datablock")
{
  Point3F position;
  dSscanf(argv[1], "%f %f %f", &position.x, &position.y, &position.z);
  
  ExplosionData* data;
  Sim::findObject(argv[2], data);
  
  createExplosion(position, data);
}

I put this code in the projectile.cc file. Sorry for any confusion. I guess this hack is not as quick as I said.

*Your way might work too although I cannot properly test it at the momment. There may or may not be a reason why I did not do it that way. I wrote this code quite a bit ago before I developed better commenting habbits.
#48
12/18/2006 (4:25 pm)
Oddly enough it did work but I dont trust doing things that way, I'll probably do what you did.
Thanks mucho for the input!
Page«First 1 2 3 Next»