网络游戏源代码分析

We evaluated and researched today’s most popular netcode frameworks for multiplayer games to inform your decision. 

我们评估和研究了当今最流行的多人游戏网络代码框架,以帮助您做出决定。

Every multiplayer game has to account and solve for inherent network-related challenges that impact the game experience, such as latency, packet loss, and scene management, and games solve these challenges in a variety of ways. Finding the right solution depends on a game’s genre, the scale of its players and networked objects, competitiveness, and other aspects, like how much control is needed over the networking layer. Different scenarios require different netcode solutions.

每个多人游戏都必须考虑并解决影响游戏体验的与网络相关的内在挑战,例如等待时间,数据包丢失和场景管理,并且游戏可以通过多种方式解决这些挑战。 找到合适的解决方案取决于游戏的类型,玩家的规模和网络对象,竞争力以及其他方面,例如需要对网络层进行多少控制。 不同的场景需要不同的网络 代码解决方案。

There’s no perfect, one-size-fits all solution for all kinds of games and experiences. For example, an FPS game running on a dedicated game server with server authority for cheat prevention, such as Apex Legends, will have completely different netcode requirements than a MOBA running on a P2P topology with deterministic rollback for cheat mitigation like Heroes Strike.

对于各种游戏和体验 ,没有完美的,一刀切的所有解决方案 。 例如, 在具有防欺诈功能的服务器授权的专用游戏服务器上运行 的 FPS游戏(例如 Apex Legends) ,与在P2P拓扑上运行并具有确定性回滚以减轻欺诈行为(如 Heroes Strike) 的MOBA相比,将具有完全不同的净代码要求 。

Because there’s no single netcode solution for all scenarios, developers need to evaluate the options and decide which netcode solution – or combination of solutions – best suits a title’s needs. In many cases, they may also need to extend or customize existing netcode.

由于 没有针对 所有 场景的 单一网络代码解决 方案,因此 开发人员需要评估选项并确定哪种网络代码解决方案(或解决方案组合)最适合标题的需求。 在许多情况下,他们可能还需要扩展或自定义现有的网络代码。

Unity和Netcode (Unity and netcode)

As you may already know, Unity has two different first-party netcode solutions. UNet solves for GameObjects and is currently in maintenance mode, while DOTS-netcode solves for ECS and is in Preview.

您可能已经知道, Unity有两种不同的第一方网络代码解决方案。 UNET解决了 GameObjects,目前正处于维护模式,而DOTS-网络代码解决了 ECS 并在预览。

We currently support UNet’s LLAPI for customers shipping on consoles, but it isn’t a full solution for most higher-level networking needs. Luckily, Unity has a strong and very talented open source community and partner ecosystem, and their contributions provide numerous solutions that are well-suited for different scenarios.

目前,我们为在控制台上发货的客户支持UNet的LLAPI,但是对于大多数高级网络需求而言,它并不是一个完整的解决方案。 幸运的是,Unity有一个 强大而又非常有才华的开源社区和合作伙伴生态系统 ,他们的贡献提供了适合不同场景的众多解决方案。

We’ve recently reiterated our commitment to contributing to this space with a first-party Unity netcode solution in our Road to 2021 blog post. While we’re working on this solution, we want to make it easier for creators to explore and evaluate various netcode alternatives to make the right choices for their titles.

最近,我们在《 通往2021年的 路途》 博客文章中 重申了通过第一方Unity网络代码解决方案为这一领域做出贡献的承诺 。 在研究此解决方案时,我们希望使创作者更容易探索和评估各种网络代码替代方案,以便为自己的标题做出正确的选择。

用信息武装自己 (Arm yourself with information)

Our team has gathered feedback about some of the most widely used third-party netcode solutions, and we’ve created a decision tree to help guide you through the process of deciding which framework might work best for you.

我们的团队收集了有关一些使用最广泛的第三方网络代码解决方案的反馈,并且我们创建了一个决策树来帮助您指导您确定哪个框架最适合您的过程。

To create these tools, we gathered and analyzed data from three sources:

为了创建这些工具,我们从三个来源收集并分析了数据:

  • A survey of over 200 Unity users that asked for information about their experiences with specific netcode frameworks

    一项针对200多个Unity用户的调查 ,要求他们提供有关使用特定Netcode框架的经验的信息

  • Over 20 in-depth interviews with users actively shipping multiplayer games with Unity

    积极进行Unity发行多人游戏的用户进行了 20多次深入采访

  • Learnings from prototypes we built with MLAPI, DarkRift 2, Mirror, and Photon Quantum.

    我们使用MLAPI,DarkRift 2,Mirror和Photon Quantum构建的 原型中学习

We’ve scored and ranked the top netcode solutions referenced by successful customers based on the following variables:

我们已根据以下变量对成功客户引用的顶级网络代码解决方案进行了评分和排名:

  • Stability/support: This was evaluated along three axes – the likelihood of bugs or crashes, response time to fix issues or help debug a challenge, and the likelihood of breaking changes to the APIs.

    稳定性/支持: 沿三个方面进行了评估-错误或崩溃的可能性,修复问题或帮助调试问题的响应时间以及破坏API更改的可能性。

  • Ease of use: We compiled users’ evaluations of how easy it is to get started and perform common tasks, including the provision of good samples, documentation, tutorials, and the solution’s offering of simple APIs for prototyping.

    易用性 :我们汇编了用户对入门和执行常见任务的难易程度的评估,包括提供良好的示例,文档,教程以及该解决方案提供的用于原型的简单API。

  • Performance: We looked for limited GC/allocations, minimal latency overhead, performant compute, and ideally the ability to multithread to score this.

    性能 :我们寻求有限的GC /分配,最小的等待时间开销,高性能的计算以及理想的多线程得分能力。

  • Scalability: Similar to performance, we evaluated the solution’s ability to support a larger number of connected clients without a large sacrifice in performance.

    可扩展性 :与性能类似,我们评估了该解决方案在不牺牲性能的情况下支持大量连接客户端的能力。

  • Feature breadth: We focused on mid-level features like object and variable replication, RPCs, scene management, and so on. We also looked for higher-level features like prediction and lag compensation.

    功能广度: 我们专注于中级功能,例如对象和变量复制,RPC,场景管理等。 我们还寻找诸如预测和滞后补偿之类的高级功能。

  • Cost: This consideration factored in both the cost of the libraries/solution and possible hidden costs, such as operating overhead that has to be managed separately.

    成本 :此考虑因素同时考虑了库/解决方案的成本和可能的隐性成本,例如必须单独管理的运营开销。

Before jumping into our study’s results and recommendations, it’s important to stress two points. First, choosing a netcode solution for your game is a critical decision, and you should still perform your own evaluation. We want to make the process easier for you by sharing our summary of the most common options, but you should do your own assessment as well, based on the specifics of your game. Second, this list doesn’t represent all of the alternatives, especially at the transport level, where many solid solutions exist, such as enet, litenetlib, ruffles, telepathy, and others.

在进入我们的研究结果和建议之前,必须强调两点。 首先,为您的游戏选择一个网络代码解决方案是一个至关重要的决定, 您仍然应该执行自己的评估 。 我们希望通过共享最常用选项的摘要使您的工作更轻松,但是您也应该根据游戏的具体情况进行自己的评估。 其次,此列表并不能代表所有替代方案,尤其是在存在许多可靠解决方案的传输级别上,例如enet,litenetlib,ruffles,telepathy等。

The information below is a start, but we recommend that you also download the full report, where we go into greater detail about these third-party netcode solutions:

以下信息只是一个开始,但是我们建议您还 下载完整的报告 ,在此我们将详细介绍这些第三方网络代码解决方案:

  • MLAPI

    MLAPI

  • DarkRift 2

    DarkRift 2

  • Photon PUN

    光子PUN

  • Photon Quantum 2.0

    光子量子2.0

  • Mirror

    镜子

仍然需要帮助来决定吗? (Still need help deciding?)

We’ve also created a diagram to help walk you through the process of making this critical decision. Please keep in mind that all abstractions miss critical details – we can’t possibly share every technical variable that might influence your decision – but these are some of the elements you should consider as you start evaluating solutions to support your game’s pathway to success.

我们还创建了一个图表,以帮助您完成做出此关键决定的过程。 请记住,所有抽象都忽略了关键细节–我们可能无法共享可能影响您决策的每个技术变量–但这是您开始评估解决方案以支持游戏成功之路时应考虑的一些要素。

开始评估网络代码解决方案的高级指南 (High-level guide to starting to evaluate a netcode solution)

And, in case it helps, here’s a quick glossary of some of the key terms used in the decision-making tree:

并且,如果需要的话,以下是决策树中使用的一些关键术语的简要词汇表:

  • Dedicated game server (DGS) – a client-server network implementation where the server is hosted on dedicated compute – i.e., separately from the client devices. This option is expensive, but scalable and secure.

    专用游戏服务器(DGS) –客户端-服务器网络实现,其中服务器托管在专用计算上-即与客户端设备分开。 此选项价格昂贵,但可扩展且安全。

  • Listen server – a client-server implementation where the server is hosted on a client device. It’s inexpensive, but not scalable and not secure.

    侦听服务器 –客户端-服务器的实现,其中服务器托管在客户端设备上。 它价格便宜,但不具有可扩展性和安全性。

  • Deterministic lockstep – a P2P implementation where only inputs are sent to all other players and synchronized in a “locked step” (i.e., synced for the same simulation tick all at once), and determinism on each client ensures that they all stay at the same state. This system is inexpensive and secure, but with complex determinism.

    确定性锁步 –一种P2P实施,其中只有输入被发送到所有其他参与者,并以“锁定步骤”同步(即,一次同步完成同一模拟滴答),并且每个客户端的确定性确保它们都保持相同州。 该系统便宜且安全,但是具有复杂的确定性。

  • Deterministic rollback – an enhancement of deterministic lockstep where clients forward-predict inputs while waiting for updates. This setup is more complex but enables a more responsive game than lockstep. It’s relatively inexpensive and secure, but with very complex determinism and simulation.

    确定性回滚 –确定性锁步的增强,客户端可以在等待更新时对输入进行前瞻性预测。 此设置更为复杂,但与锁步相比,它可以使游戏响应更快。 它相对便宜且安全,但是具有非常复杂的确定性和仿真性。

To see our analysis in more detail, check out the full report (we’ll ask you a few questions before downloading). This in-depth overview will be more comprehensible if you have some familiarity with multiplayer and networking concepts. Need a refresher? This talk covers most of the essentials.

要更详细地查看我们的分析,请查看 完整的报告 (在下载之前,我们会问您几个问题)。 如果您对多人游戏和网络概念有所了解,那么这种深入的概述将更加容易理解。 需要复习吗? 本 讲座 涵盖了大多数要点。



We hope this information is helpful, and please let us know if you have any comments or questions about our analysis, or if you find any bugs or concerning data points.

我们希望这些信息对您有所帮助, 如果您对我们的分析有任何意见或疑问,或者发现任何错误或与数据点有关 , 请告知 我们。

翻译自: https://blogs.unity3d.com/2020/09/08/choosing-the-right-netcode-for-your-game/

网络游戏源代码分析

网络游戏源代码分析_为您的游戏选择正确的网络代码相关推荐

  1. 转:UNITY,如何为你的游戏选择正确的网络类型

    https://unity.cn/projects/network-service

  2. python3源代码分析_分析一点python源代码

    偶然看了一下python的部分源代码,感觉python的作者写的代码真心很美,简洁美观,学习之. 举几个例子抛砖引玉一下: defremovedirs(name):""" ...

  3. 栈应用_检测成对符号是否正确使用(代码、分析、汇编)

    目录: 代码: 分析: 汇编: 代码: LinkList.h LinkList.c LinkStack.h LinkStack.c 栈-线性表 main.c #include <stdio.h& ...

  4. amixer 如何切通道_制作播放列表时如何选择正确的通道和画幅?

    在每天做影院播放列表的时候我们需要根据播放影片的画幅和3D/2D等情况选择正确的放映机通道和画幅命令,如何在TMS上选择正确的自动化命令呢,今天为大家简单介绍一下. 什么是宽幅和遮幅? 宽幅(SCOP ...

  5. Unity3D RPG角色扮演游戏源码(上下)-----源代码分析----01-----主角人物动画

    在源代码的里面有fbx格式的模型文件,发现有2个文件,一个是骨骼动画文件,可以分割为多个动画片段,还有一个是模型文件,但是没有动画,但是可以导入分割好的动画片段到动画元素里面, 按照下面的说明,分割了 ...

  6. Unity3D RPG角色扮演游戏源码(上下)-----源代码分析----04--修改菜单窗口

    Unity3D RPG角色扮演游戏源码(上下)-----源代码分析----04--修改菜单Shop窗口 此脚本用于创建商店以销售商品 --------------------------------- ...

  7. python游戏代码怎样才能玩好英雄联盟_用Python编写代码分析《英雄联盟》游戏胜利的最重要因素...

    原标题:用Python编写代码分析<英雄联盟>游戏胜利的最重要因素 点击上图查看 Python Web 开发入门实战[教学大纲+教学进度表] 介绍 在过去的几年里,电子竞技社区发展迅速,曾 ...

  8. HTML5游戏开发/微信游戏开发--猜灯谜游戏源代码分析

    最近码友问我:"你的CSDN是不是废了?",我一看,握了个大草,1年半没更新了--工作.家里琐事太多,每天挤遍全身乳沟也不超过3个小时,所以--所以这全TMD都是借口!有好几个码友 ...

  9. mfc使用cef源代码实现_如何获得微信小游戏跳一跳源码以及源代码组合包括哪些...

    很多小游戏都是由源代码编写而成的,那大家知道源代码组合包括哪些吗?手机游戏源代码怎么使用的呢?还有,如何获得微信小游戏跳一跳源码?下面就由奇瑰网小编带大家来了解一下相关的内容吧. 源代码组合包括哪些 ...

最新文章

  1. 手机怎样投屏到电脑_手机有线投屏到Windows电脑
  2. yaf_dispatcher.c 的 yaf_dispatcher_fix_default函数
  3. 数字IC设计bilibili-Designer Compiler的理论笔记+实操
  4. NoSQL Databases - CouchDB
  5. Mongoose Schemas定义中timestamps选项的妙用
  6. shell grep 变量_老司机给出的关于 shell 脚本的8个建议,必收!
  7. 在Bootstrap框架中,form-control的效果
  8. Nginx的11个phases
  9. isdigit()、isalpha()、isalnum() 三个函数的区别和注意点
  10. 信息安全系统设计基础实验三
  11. InstallShield使用完全教程
  12. 设置桌面上计算机的图标更改,电脑如何修改桌面应用的图标
  13. 天龙八部服务器维护怎么进去,天龙八部怎么进不去?维护了吗?到什么时候?...
  14. 微信公众号自定义服务器,微信公众号自定义服务器的第一次验证
  15. thinkadmin中日期的使用
  16. 上班族一定得学会、掌握的jpg转word技巧
  17. 使用Java统计英文文章的单词频率。
  18. P1027 [NOIP2001 提高组] Car 的旅行路线 (图 最短路)
  19. html文本显示不完整,div css网页显示不完整的原因分析及解决方案
  20. IPFS系列 - 分布式哈希表(DHT)

热门文章

  1. 微分恒等式(助于找到均值、方差和其他矩)
  2. Apollo星火计划学习笔记|L1 Apollo平台安装(2021年9月更新)
  3. 后台java,前台JSP实现Excel导出(已经在后台查询,直接在前端实现下载,系统后台整体框架使用SSM)
  4. matlab画图x轴
  5. 阿里云全球交付中心正式成立,打造一流的全球服务能力
  6. 比较完整的A2C.c
  7. npm --save-dev 和 --save的区别
  8. python 输出第一行1个* 第二行3个* 第三行5个*
  9. 新媒体时代下,用户思维的体现和运用
  10. for in 中的index