How can I fix latency problems for car game?

Posted by Freddy on Game Development See other posts from Game Development or by Freddy
Published on 2014-06-11T15:26:08Z Indexed on 2014/06/11 15:43 UTC
Read the original article Hit count: 229

Filed under:
|
|

Basically I'm trying to make a online car racing game for IOS using Game Center real time multiplayer. I have setup a timer that sends data every 0.02 seconds to the other player with the current position and current angle. However sometimes, it will take LONGER then these 0.02 seconds for the package to be sent and then received. In this case i have implemented a method that "calculate" what the next position should be if no position is received based on the last position and angle. However, when the data then receives for let say 0.04 seconds after, it will change back to the last position, which will result in the car "jumping" back and lag. And If i just keep ignoring the data it will never take any input from the other user. Is their any way to prevent this? I suppose this needs to be fixed with some client-sided algorithm.

© Game Development or respective owner

Related posts about ios

Related posts about objective-c