多人联网游戏中的同步? [英] Synchronization in multiplayer networked game?
问题描述
最近我一直在开发一款多人网络应用。我使用Bonjour服务和NSStream对象成功实现了客户端服务器模型。双向沟通已成功完成。
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.
我面临的问题是:运行该应用的两台设备通过本地wifi连接。从客户端向服务器发送消息时存在延迟问题,反之亦然。
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.
简要描述:
- 这是一款最多有两名玩家的赛车游戏。
- 一台服务器和其他客户。
- 当客户按下时按钮将特定消息发送到服务器,告知按下了哪个键或按钮。然后服务器做出相应的响应,并在服务器本身上对客户端的汽车进行更改。这些变化并不总是一样的。客户端屏幕上的汽车实际位置与服务器屏幕上的实际位置之间始终存在差异。
任何想法?
推荐答案
欢迎来到网络世界。 :)
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 - 程序员需要了解游戏网络
祝你好运!
这篇关于多人联网游戏中的同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!