Game Development Community

Is weapon state-machine fully server-side?

by Kenneth Eves · in Torque 3D Beginner · 10/03/2012 (10:02 am) · 0 replies

I have three questions about the weapon state-machine system.

1. Does the state machine run server-side?

I'm thinking it must be server-side because the onFire script is also server-side.

...

2. Would that make the C/S communications loop look like:

1. left-click by player.
2. client catches click, sends event to server.
3. server receives event.
4. server processes event based on state-machine.
5. state-machine switches to "Fire" state.
6. state-machine triggers "onFire" script.
7. server creates and starts projectile, along with effects.
8. clients ghosting the character renders projectile and effects (including char who fired the shot).

...

3. Is the first person weapon rendering on the client also triggered by the server?

Reason I ask this, I'm trying to figure out if the client side even touches the state system, or is simply responding to the server telling it what to do.

// FIRE
   // Fire the weapon. Calls the fire script which does
   // the actual work.
   stateName[5]                     = "Fire";
   stateTransitionGeneric0In[5]     = "ReadyMotion";
   stateTransitionOnTimeout[5]      = "NewRound";
   stateTimeoutValue[5]             = 0.15;
   stateFire[5]                     = true;
   stateRecoil[5]                   = "";
   stateAllowImageChange[5]         = false;
   stateSequence[5]                 = "fire";
   stateScaleAnimation[5]           = false;
   stateSequenceNeverTransition[5]  = true;
   stateSequenceRandomFlash[5]      = true;
   stateScript[5]                   = "onFire"; <============================= handles weapon firing?
   stateSound[5]                    = LurkerFireSoundList;
   stateEmitter[5]                  = GunFireSmokeEmitter;
   stateEmitterTime[5]              = 0.025;