commandToClient networking questions
by Bruno Campolo · in Torque Game Builder · 01/16/2010 (8:24 pm) · 5 replies
I have two questions:
1) are commandToClient UDP packets buffered at all before being sent to the client? For instance, if I execute 100 commandToClient statements in a row all to the same client is there some buffering going on in the engine so that only maybe 10 packets get sent? or should I be combining commandToClient data myself?
2) is commandToClient a synchronous or asynchronous statement? In other words, does it wait for the packet to be sent before moving on to the next statement or is there another thread/process that handles this and the statement will return immediately?
1) are commandToClient UDP packets buffered at all before being sent to the client? For instance, if I execute 100 commandToClient statements in a row all to the same client is there some buffering going on in the engine so that only maybe 10 packets get sent? or should I be combining commandToClient data myself?
2) is commandToClient a synchronous or asynchronous statement? In other words, does it wait for the packet to be sent before moving on to the next statement or is there another thread/process that handles this and the statement will return immediately?
About the author
Creator of Bantam City Games, a one-man independent game development studio. To learn more, check out 'A Game Developer's Saga', a game development blog at: http://www.bantamcity.com/blog
#2
commandToClient is asynchronous. IIRC, this function really just builds a network event that will be sent in the next processing loop.
01/19/2010 (2:20 pm)
I'm almost certain that the packets are not buffered. I always combine data into logical group for client processing.commandToClient is asynchronous. IIRC, this function really just builds a network event that will be sent in the next processing loop.
#3
Can you give me an example of what you would consider a logical group to send to the client?
Thanks Again!
01/19/2010 (11:47 pm)
Thanks for the info! You are helping me alot on these forums! :) Can you give me an example of what you would consider a logical group to send to the client?
Thanks Again!
#4
When the game starts, I send a message to every client using commandToClient that combines all of this information into one message, like
When any player's information changes, I just send each client the one player's information in the same format.
The logic group here is all of a player's "Stat Sheet" information.
Hope that makes sense!
01/20/2010 (5:31 am)
We have "stat sheets" on each player that you can access by simply hovering over the player's boardgame piece. Simply put, when you hover over the piece, a panel slides onto the screen with the player's occupation, alignment, hit points, and the like.When the game starts, I send a message to every client using commandToClient that combines all of this information into one message, like
PSEUDO:
foreach( %client )
{
foreach( %player )
{
%message = %player.number TAB %player.name TAB %player.occupation TAB
%player.alignment TAB %player.hitPoints;
commandToClient( %client, 'SetPlayerStatSheetInfo', %message );
}
}When any player's information changes, I just send each client the one player's information in the same format.
The logic group here is all of a player's "Stat Sheet" information.
Hope that makes sense!
#5
Thanks for the help.
01/20/2010 (8:23 am)
Hey, you answered my question and another question I haven't even asked with that example! You rock!Thanks for the help.
Torque Owner Bruno Campolo