Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualChumble

Posted 20 August 2013 - 04:03 PM

For network data you do not send all the input message to all clients you send position updates and interpolate between the previous and current one to make a prediction for future movement. TCP connections have a high overhead as all messages need to arrive and processed in order, miss one and the server has to resend it, UDP is a better solution. In the case of UDP if you get a message that has a older id than the latest you receive you ignore it instead.

 

Your second outline is more along the lines of how XBL and PSN games work.

Sorry, I guess I wasn't clear. I am not sending input messages to the clients, I am sending updated coordinates.

 

Yeah, I know UDP is generally reccomended .. I went through lots and lots of "TCP vs UDP" threads before sticking with TCP...Basically because TCP was easier. I'm starting with easy stuff, getting comfortable with it, then once I understand its limitations, I'm moving on to more complicated optimizations.

 

 

 

Just going to take a crack at answering #1...

 

The way I got around this before is by keeping track of a boolean that is set to true on keyPressed, and false on keyReleased.  In your "keyPressed" event handler, just set the variable to true, and the keyReleased, set it to false.

 

Then, in your game's update loop, you simply check whether that key is down and if it is take the appropriate action.

 

When I implemented it, if I recall correctly, I had a 256 element boolean array, and used the Keycode to directly insert into the array.

 

 

Hmm.. yeah, that could work, I'll give it a shot. Thanks!


#1Chumble

Posted 20 August 2013 - 04:02 PM

For network data you do not send all the input message to all clients you send position updates and interpolate between the previous and current one to make a prediction for future movement. TCP connections have a high overhead as all messages need to arrive and processed in order, miss one and the server has to resend it, UDP is a better solution. In the case of UDP if you get a message that has a older id than the latest you receive you ignore it instead.

 

Your second outline is more along the lines of how XBL and PSN games work.

Sorry, I guess I wasn't clear. I am not sending input messages to the clients, I am sending updated coordinates.

 

Yeah, I know UDP is generally reccomended .. I went through lots and lots of "TCP vs UDP" threads before sticking with TCP...Basically because TCP was easier. I'm starting with easy stuff, getting comfortable with it, then once I understand its limitations, I'm moving on to more complicated optimizations.


PARTNERS