开发者

Synchronization in multiplayer networked game?

Recently I have been working on a multiplayer networking app. I had successfully implemented the client server model using Bonjour services and NSStream objects. The two way communication has been done successfully.

The problem I'm facing is: the two devices running the app are connected via local wifi. There is a latency problem while sending the messages from client to server and vice versa.

Describing in brief:

  • It's a car racing game with at most two players.
  • One server and other client.
  • When client press the buttons a particular message is sent to the server telling which key or button was pressed. Then the server respond开发者_如何学Gos accordingly and make changes on the client's car on the server itself. These changes are not always the same. There is always a difference between the actual location of the car on the client's screen and that in the server screen.

Any ideas?


Welcome to the world of networking. :)

These are the classic difficulties with game networking programming. There's a lot of different techniques to overcome these issues.

This blog has great info on the subject and will probably help you out.

http://gafferongames.com/networking-for-game-programmers/

You may be specifically interested in this article:

http://www.gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜