gpt4 book ai didi

unity3d - 游戏架构 P2P 加入游戏中期

转载 作者:行者123 更新时间:2023-12-02 02:50:50 25 4
gpt4 key购买 nike

我正在写关于不同游戏架构的论文,但我还没有找到这个问题的答案。我已经用谷歌搜索了几个小时,但没有找到答案。

我正在阅读这篇文章:https://gafferongames.com/post/what_every_programmer_needs_to_know_about_game_networking/

还有一段讨论游戏的 p2p 限制:

The final limitation occurs because of the way the game synchronizes by sending just the command messages which change the state. In order for this to work it is necessary for all players to start from the same initial state. Typically this means that each player must join up in a lobby before commencing play, although it is technically possible to support late join, this is not common due to the difficulty of capturing and transmitting a completely deterministic starting point in the middle of a live game.

正如作者所说,当有 p2p 连接时,玩家应该在开始游戏之前加入大厅,而不是加入正在进行的游戏。他说这是因为在现场比赛中很难传输完全确定的起点。

谁能告诉我这是为什么?是因为要传输的数据太多,可能会造成一些延迟问题,还是存在其他问题?

最佳答案

要传输的数据量并不是最大的问题,但肯定会产生影响。

为了让事情更简单一些,我会给你一个例子,说明在客户端/服务器模型中应该做什么,即玩家连接到中央服务器,中央服务器运行游戏引擎并将游戏状态发送到玩家的电脑。服务器的任务是尽可能保持客户端对游戏的看法一致,即玩家健康/位置、 map 中对象的位置等。

假设比赛中有 7 名玩家,其中第 8 名玩家希望加入正在进行的游戏。服务器需要保证新玩家及时收到游戏的当前状态,这就需要服务器上的处理/网络资源。这不仅从编程的角度来看具有挑战性,而且会导致服务器上的资源使用量激增,这在理论上会影响其他进程以及当前匹配本身。

在 P2P 游戏模型的情况下,服务器是玩家的一台机器,与网络有关的问题会放大,因为与普通家庭相比,服务器通常具有更好的互联网连接。以上仍然成立。

在纯 P2P 模型的情况下,每台机器直接相互通信(我不认为现代游戏实际上这样做),这成为在全网状分布式中保持一致性的一个非常具有挑战性的问题系统。

关于unity3d - 游戏架构 P2P 加入游戏中期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52283270/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com