游戏中的网络问题 [英] Networking problems in games

查看:108
本文介绍了游戏中的网络问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找特定于游戏的网络设计和技巧.我知道一些问题,并且对其中的一些问题有部分解决方案,但是有些问题我还看不到.我认为对此没有确定的答案,但我会接受我真正喜欢的答案.我可以想到4类问题.

I am looking for networking designs and tricks specific to games. I know about a few problems and I have some partial solutions to some of them but there can be problems I can't see yet. I think there is no definite answer to this but I will accept an answer I really like. I can think of 4 categories of problems.

不良网络

客户端发送的消息需要一些时间才能到达服务器.服务器不能只处理它们FCFS,因为这对于等待时间较长的播放器是不公平的.对于此问题的部分解决方案是在消息上添加时间戳,但是您需要做两件事:

The messages sent by the clients take some time to reach the server. The server can't just process them FCFS because that is unfair against players with higher latency. A partial solution for this would be timestamps on the messages but you need 2 things for that:

  • 能够信任客户端时钟. (我认为这是不可能的.)
  • 您可以测量的恒定延迟.您如何处理可变延迟?

许多游戏使用UDP,这意味着消息可能会丢失.在那种情况下,他们试图根据已有的信息来估计游戏状态.重新建立连接后,如何知道估计状态是否正确?

A lot of games use UDP which means messages can be lost. In that case they try to estimate the game state based on the information they already have. How do you know if the estimated state is correct or not after the connection is working again?

在MMO游戏中,服务器处理大量客户端.分配负载的最佳方法是什么?基于游戏中的位置?将一组客户端绑定到服务器?您可以避免通过服务器发送所有内容吗?

In MMO games the server handles a large amount of clients. What is the best way for distributing the load? Based on location in game? Bind a groups of clients to servers? Can you avoid sending everything through the server?

玩家离开

发生这种情况时,我看到了2种不同的行为.在大多数FPS游戏中,如果主持游戏的玩家(我想他是服务器)离开了其他人则无法玩.在大多数RTS游戏中,如果有任何玩家离开,其他玩家可以在没有他的情况下继续玩.没有专用服务器怎么办?每个人都知道完整的状态吗?他们是否正在以某种方式转移服务器的角色?

I have seen 2 different behaviours when this happens. In most FPS games if the player who hosted the game (I guess he is the server) leaves the others can't play. In most RTS games if any player leaves the others can continue playing without him. How is it possible without dedicated server? Does everyone know the full state? Are they transfering the role of the server somehow?

访问信息

下一个问题可以通过专用服务器解决,但是我很好奇是否可以不使用一个服务器.在许多游戏中,玩家不应该知道游戏的完整状态. RTS中的战争迷雾和FPS中的围墙就是很好的例子.但是,他们需要知道某个动作是否有效. (例如,您可以从那里开枪射击我还是在地图的另一侧.)在这种情况下,客户需要验证对未知状态的更改.这听起来像可以通过巧妙地使用加密原语来解决.有什么想法吗?

The next problem can be solved by a dedicated server but I am curious if it can be done without one. In a lot of games the players should not know the full state of the game. Fog-of-war in RTS and walls in FPS are good examples. However, they need to know if an action is valid or not. (Eg. can you shoot me from there or are you on the other side of the map.) In this case clients need to validate changes to an unknown state. This sounds like something that can be solved with clever use of cryptographic primitives. Any ideas?

作弊

在受信任的客户端环境中,上述某些问题很容易解决,但这是无法假定的.是否有在80%的普通用户-20%的作弊者环境中都能工作的解决方案?您真的可以制作一个可以正常工作的反作弊软件(并且不需要内核模块之类的可笑东西)吗?

Some of the above problems are easy in a trusted client environment but that can not be assumed. Are there solutions which work for example in a 80% normal user - 20% cheater environment? Can you really make an anti-cheat software that works (and does not require ridiculous things like kernel modules)?

我确实阅读了这个问题和一些答案 https://stackoverflow .com/questions/901592/best-game-network-programming-articles-and-books ,但其他答案则链接到不可用/受限制的内容.这是一个与平台/操作系统无关的问题,但是也欢迎针对特定平台/操作系统的解决方案.

I did read this questions and some of the answers https://stackoverflow.com/questions/901592/best-game-network-programming-articles-and-books but other answers link to unavailable/restricted content. This is a platform/OS independent question but solutions for specific platforms/OSs are welcome as well.

推荐答案

认为加密将解决此类问题是一个非常常见且非常糟糕的错误:客户端本身当然必须能够对其进行解密,因此完全没有意义.您并不是在增加安全性,只是在增加晦涩感(将会被破解).

Thinking cryptography will solve this kind of problem is a very common and very bad mistake: the client itself of course have to be able to decrypt it, so it is completely pointless. You are not adding security, you're just adding obscurity (and that will be cracked).

作弊太特定于游戏了.有些游戏无法完全消除(FPS中的aimbots),而有些游戏如果没有搞砸,则根本不可能(基于服务器的回合游戏).

Cheating is too game specific. There are some kind of games where it can't be totally eliminated (aimbots in FPS), and some where if you didn't screw up will not be possible at all (server-based turn games).

通常,诸如此类的网络问题与预测密切相关,而预测是一个非常复杂的主题,最好是 ,在

In general network problems like those are deeply related to prediction which is a very complicated subject at best and is very well explained in the famous Valve article about it.

这篇关于游戏中的网络问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆