Game Development Community

Understanding serverCmd and clientCmd

by Quinton Delpeche · in Torque 3D Professional · 10/09/2013 (9:32 pm) · 3 replies

My TorqueScript skills have become a little rusty and I just want to check something with everyone else.

With a Multi-player Game (in this instance a Dedicated Server and a Client connecting to it), the following basic rules apply:

-- anything to do with the "%client" or the "client" should be done via clientCmd sent from the server as part of the basic game rules (for lack of a better word).

-- anything to do with the "%game" or the "game" should be done via serverCmd sent from the client and verified by the server as part of the basic game rules (for lack of a better word).

I think I am right in this assumption ... but instead of making an a$$ of u and me (more me than you), can anyone just confirm if this is the right assumption.

Thanks in advance.

About the author

Gobbo Games is an Independent Games Development company operating from Durban in South Africa. We believe in creating high-quality cost-effective games that remain true to the belief of Independent Game Developers around the world.


#1
10/10/2013 (4:04 am)
I agree with your assumption.
#2
10/11/2013 (12:08 pm)
Agreed.

Since you said your skills are a little rusty, let me remind you for serverCmd methods the %client parameter is not passed, rather the engine sends that to the callback function. Just in case you end up getting confused on it, now you know. Same with other people too. :)

function blah()
{
   commandToServer('Bleh');
}

function serverCmdBleh(%client)
{
    echo(%client SPC "called Bleh");
}
#3
10/11/2013 (12:11 pm)
Yeppo ... It is all coming back to me now.

I managed to implement what I needed to ... Worked like a charm. :)

Thanks for the confirmations and clarifications.