Checkers Tutorial launchGameServer() Question
by MrPhil (Philip Ludington) · in Torque Game Builder · 04/05/2006 (10:07 pm) · 2 replies
I have a question about the Checkers Tutorial. I noticed that the server command launchGameServer() does a little local client work.
So my question is wouldn't it be better or more in spirit with the separation between client and server to do this:
I realize this means that serverBeginGame() gets called twice, but maybe the server shouldn't get that command from the client?
Anyways, give me some insight please :D
function launchGameServer()
{
// we are no in a match
$inMatch = true;
// init the server's boards
ServerCheckerBoard.init();
ClientCheckerBoard.init(); //<-- The local work I'm talking about
// tell the client to start the game
commandToClient($playerConnection, 'StartGame');
}So my question is wouldn't it be better or more in spirit with the separation between client and server to do this:
function launchGameServer()
{
// we are no in a match
$inMatch = true;
// init the server's boards
ServerCheckerBoard.init();
// tell the clients to start the game
commandToClient($playerConnection, 'StartGame');
commandToClient($serverConnection, 'StartGame');
}I realize this means that serverBeginGame() gets called twice, but maybe the server shouldn't get that command from the client?
Anyways, give me some insight please :D
About the author
My name is Philip Ludington, I'm a professional programmer by day and I dabble in game development by night. Learn more about my projects at www.MrPhilGames.com
#2
Thanks Steve!
04/08/2006 (1:04 pm)
Yeah, I get what you're saying. It's just my strong typing objected oriented nature showing. If you wanted a dedicated server version of the game then you would want to change this, but I understand it is only a tutorial. I just needed to make sure my understanding of things was calibrated correctly. Thanks Steve!
Torque 3D Owner Stephen Zepp
A) A "co-located" executable, in that the client and the server are in the same executable memory space (using the same executable).
B) When you are the one that selects to host a game, you are the one that will be the "server" in the col-located manner described above.
You -could- do what you mention with some work, but it's not really inline with the assumptions above (and not needed).