Client / Server and script question.
by Claude-Alain Fournier · in Torque Game Engine · 07/20/2004 (7:11 am) · 3 replies
Hi,
I can't really find that information :
Currently I have the client and server in one app (as in FPS example) but I plan to have both separated at later stage with server side sitting on a different box.
1. Now by looking at the script code I found that supposedly client side stuff (example InventoryGui.cs from the inventory ressource) is using player.cs calls... Is it not supposed to use commandToServer to request the information ?
2. In the resource the following function exist clientCmdPopInventory(%player){....} and in that function the player is used as if player.cs is available. I believe that's wrong and will work only if server and client make one application.
3. If player.cc and server/scripts/player.cs are sitting on the server side only, so Client side should not have access to player.cs functions ?
I think that correct answers are :
1. Yes use commandToServer
2. Ressource is wrong and should not use player.cs functions
3. Yes player.cs are on server only
Can somebody comment on that ?
Thanks in advance
CAF
I can't really find that information :
Currently I have the client and server in one app (as in FPS example) but I plan to have both separated at later stage with server side sitting on a different box.
1. Now by looking at the script code I found that supposedly client side stuff (example InventoryGui.cs from the inventory ressource) is using player.cs calls... Is it not supposed to use commandToServer to request the information ?
2. In the resource the following function exist clientCmdPopInventory(%player){....} and in that function the player is used as if player.cs is available. I believe that's wrong and will work only if server and client make one application.
3. If player.cc and server/scripts/player.cs are sitting on the server side only, so Client side should not have access to player.cs functions ?
I think that correct answers are :
1. Yes use commandToServer
2. Ressource is wrong and should not use player.cs functions
3. Yes player.cs are on server only
Can somebody comment on that ?
Thanks in advance
CAF
#2
If you look a little deeper, you will see that the player is being passed back to the client from the server to access the inventory.
This works because the player data is streamed from the server to the client on each of the callbacks.
I didn't use this resource myself as I didn't want all of the player data being sent back to the client. This would give the client access to data they shouldn't. They can't realy do anything with it, I just didn't want them having access.
Anyways, there is another inventory resource, same guy. I think its his first try.
In that one, just the actual inventory is passed back. May want to take a look at that.
07/20/2004 (10:57 am)
That resource works across a dedicated server to client situation. If you look a little deeper, you will see that the player is being passed back to the client from the server to access the inventory.
This works because the player data is streamed from the server to the client on each of the callbacks.
I didn't use this resource myself as I didn't want all of the player data being sent back to the client. This would give the client access to data they shouldn't. They can't realy do anything with it, I just didn't want them having access.
Anyways, there is another inventory resource, same guy. I think its his first try.
In that one, just the actual inventory is passed back. May want to take a look at that.
#3
I know that call, and I was not sure about it being correct as it passed the player to the client, that was the reason why I was not sure about the whole concept.
@Simon :
I have the same "requirements" I don't want to give too much to the client and full Player information is a no no. I don't want inventory details (like weapon stats) to be visible on the client side. So if I understand well, in that particular case with each call the whole player.cs script (more or less) is send to the client !! Not very efficient. What I planned anyway is to have a client side inventory container and pass only inventory information from the server, not the actual player object.
Thanks for both aswers.
Regards,
CAF
07/20/2004 (12:01 pm)
@Westy :I know that call, and I was not sure about it being correct as it passed the player to the client, that was the reason why I was not sure about the whole concept.
@Simon :
I have the same "requirements" I don't want to give too much to the client and full Player information is a no no. I don't want inventory details (like weapon stats) to be visible on the client side. So if I understand well, in that particular case with each call the whole player.cs script (more or less) is send to the client !! Not very efficient. What I planned anyway is to have a client side inventory container and pass only inventory information from the server, not the actual player object.
Thanks for both aswers.
Regards,
CAF
Torque Owner X-Tatic
It will be in the form:
commandToClient(%client,'PopInventory',%client.player);
look through the invenotry server scripts, this will likely be in a serverCmd function.