游戏网络弹丸实施/概念问题 [英] Game Networking Projectiles Implementation/Concept Issue

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

问题描述

我正在尝试针对通常与同步弹丸发射和游戏网络同步的一个常见问题寻求某种解决方案,但是不确定什么是最合适的.

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).

这时候我正在考虑对架构进行建模,类似于半衰期源引擎.客户端将在过去〜100ms或大约3帧(固定步骤30fps)内插远程实体,并使用客户端预测.服务器对模拟具有权限.考虑使用运动来编码实现似乎不错,但是对于弹丸,我不确定如何为所有玩家提供最佳游戏体验.

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

  1. 客户A和客户B彼此面对面站立.
  2. 客户端B开始向A发射,并像往常一样将输入发送到服务器. 服务器检测到火力输入并在其模拟过程中开始发射武器,同时将事件中继到客户端A.
  3. 客户端A接收到该消息,但过去仍在插值客户端B(与此同时,射弹现在正在向B的A方向移动) 服务器和客户端Bs计算机).
  4. 客户端A的渲染最终到达B发射弹丸并开始渲染的点.
  5. 客户A看到并跳了起来,很容易在屏幕上清除它.但是,射弹在服务器和客户端B的角度击中了他.
  1. Client A and B are just standing facing each other.
  2. Client B starts to fire toward A and sends input to server as usual. Server detects fire input and starts to fire weapon in its simulation while relaying the event to client A.
  3. Client A receives the message but is still interpolating client B in the past (meanwhile the projectile is now coming toward A on the server and client Bs machine).
  4. Client A's rendering finally gets to the point where B shot the projectile and starts rendering that.
  5. Client A sees it and jumps, easily clearing it on his screen. However, the projectile hits him on the server and on client Bs point of view.

这也是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

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

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