Game Networking Projectiles Implementation/Concept Issue(游戏网络射弹实施/概念问题)
问题描述
我正在尝试找到某种解决方案来解决同步弹丸射击和游戏网络的常见问题,但我不确定哪种方法最合适.
I am trying to come to some sort of solution to a common problem with synching projectile firing and game networking in general, but am unsure on what would be the best fit.
这是一个 2D 动作横向卷轴,带有多个射弹(没有即时打击武器),并且已经有很多框架(C# XNA 框架和 Lidgren 库).
This is a 2D action side-scroller with several projectiles (no instant hit weapons) and already has much of the framework in place (C# XNA Framework and Lidgren library).
此时我认为架构将被建模为类似于半衰期源引擎.客户端将在过去 100 毫秒或大约 3 帧(固定步长 30 fps)内插入远程实体,并使用客户端预测.服务器对模拟具有权限.考虑用运动来编写实现似乎很好,但是当谈到射弹时,我不确定如何才能最好地为所有玩家提供最佳游戏玩法.
At this time I am thinking the architecture is going to be modeled similar to the half-life source engine. Clients will interpolate remote entities ~100ms or about 3 frames in the past (fixed step 30fps) and using client side prediction. Server has authority over the simulation. Thinking about coding the implementation with movement seems fine, but when it comes to projectiles I am unsure of how it would best work to provide the best gameplay for all players.
客户 A
客户B
服务器
Client A
Client B
Server
- 客户 A 和 B 只是面对面站着.
- 客户端 B 开始向 A 发射并像往常一样向服务器发送输入.服务器检测到开火输入并在其模拟中开始开火,同时将事件转发给客户端 A.
- 客户端 A 接收到消息,但仍在过去对客户端 B 进行插值(同时弹丸现在正朝着 A服务器和客户端 Bs 机器).
- 客户端 A 的渲染最终到达 B 发射弹丸并开始渲染的位置.
- 客户 A 看到它并跳了起来,在他的屏幕上轻松清除它.然而,弹丸在服务器和客户端 B 的角度击中了他.
这也是 2D 横向卷轴,所以一切都是可见的.
This is also 2D sidescroller so everything is visible.
这似乎是使用插值的基本副作用(我认为这是必须的,但我愿意接受建议),因为即使没有任何网络延迟,也存在固有的插值延迟.
It seems to be a fundamental side affect of using interpolation (which I think is a must, but am open to suggestions), as even without any network latency there is inherent interpolation latency.
我知道它不可能是完美的,但是我可以实施更多或更好的方法来混淆或改善它,使其看起来很好/无缝,还是我遗漏了任何明显的东西?武器的发射确实在射弹实际发射之前有很短的动画时间,我意识到我们可以利用这段时间来隐藏一些延迟,但武器不是即时射击,无论如何我看着它总是会有这么大的差距,客户端试图躲避弹丸和其他客户端看到他们的弹丸击中他们.
I know it cant possibly be perfect, but are there any more or better ways that I can implement to obfuscate or ameliorate this so that it looks good/seamless, or am I missing anything obvious? The firing of the weapon does have a short animation time before the projectile is actually fired which I realize we can use that time to hide some of the latency, but the weapons are not instant fire, and any way I look at it there is always going to be this large gap with the client trying to dodge projectiles and other clients seeing their projectiles hitting them.
我们可以在玩家移动的情况下在服务器上使用延迟补偿,但我认为这对这种情况没有帮助?
We can use lag compensation on the server for cases where the players are moving, but I dont think that could help this situation?
如果弹丸击中导致客户端 A 的位置发生改变,我将不得不倒回客户端 A 并使用新数据重播他的输入,或者如果没有,我必须将弹丸从半空中移开(也许他们会死),无论哪种方式都很丑:(.
If the projectile hit causes client A's position to be altered I would have to rewind client A and replay his inputs with the new data, or if it doesnt, I have to remove the projectile from mid-air (and maybe they die), ugly either way :(.
推荐答案
有趣的是你应该提到半衰期,valve居然发表了一篇关于这个的文章,客户端延迟补偿方法
Funny you should mention half-life, valve actually published an article about this, Latency Compensating Methods in Client
航位推算是网络游戏中非常普遍使用的技术,因此您应该能够在网上找到有关此的更多信息.
Dead-Reckoning, is a pretty generally used technique in networked games so you should be able to find some more information about this online.
Google 给我带来了这篇 gamasutra 文章,它也可能对您有所帮助,航位推算延迟隐藏
Google brought me this gamasutra article which might help you as well, Dead Reckoning Latency Hiding
这篇关于游戏网络射弹实施/概念问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:游戏网络射弹实施/概念问题
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04