简体   繁体   English

C ++:游戏和网络速度

[英]C++: Speed of game and Networking

I have a question regarding delta time to make my game run framerate independent in a multiplayer setting. 我有一个有关增量时间的问题,以使我的游戏在多人游戏设置中独立于帧速率运行。

Will using the delta result in the same speed for every client? 使用增量会为每个客户带来相同的速度吗? Or should the clients receive the delta used by the server and use that to make the game run at the same speed? 还是客户端应该接收服务器使用的增量,并使用该增量使游戏以相同的速度运行?

Kind regards 亲切的问候

A common approach is to use a fixed amount of ticks per time (eg 30 ticks per second). 一种常见的方法是每次使用固定数量的ticks (例如,每秒30个滴答声)。 (Only) in these ticks any game objects are updated. (仅)在这些刻度中,将更新任何游戏对象。 For Rendering you interpolate between the ticks. 对于渲染,您需要在刻度之间进行插值。

How synchronization works is largely dependen on a number of factors. 同步如何工作在很大程度上取决于许多因素。 Client and Server can synchronize in each tick through some kind or barrier-mechanism, or the server sends updates on each tick and the clients don't do ticks themselves at all. 客户端和服务器可以通过某种机制或屏障机制同步每个刻度,或者服务器在每个刻度上发送更新,而客户端根本不自己做刻度。 Of course there are a lot more possibilities, but this should give you a start, I hope 当然,还有更多的可能性,但是我希望这可以给您一个开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM