开发者

socket programming - how do multiplayer shooting game servers handle the timing?

开发者 https://www.devze.com 2023-01-12 10:32 出处:网络
How can the shooting game servers handle the timing, for example when a player shoots another, how do they make sure that both players get the message at开发者_Python百科 the exact same time.

How can the shooting game servers handle the timing, for example when a player shoots another, how do they make sure that both players get the message at开发者_Python百科 the exact same time.

or on most of them u see every detail that a player makes in every second, and both players see the exact same moves on their client? how do the game servers manage to send these moves to all clients (players) at the exact same time?


They don't see them at the exact same time.

The server will determine whether or not the shot hit, and send updates to the clients. The clients will then draw the bullets, blood etc.

There is a timing loop there, but not every event has to be in sync. This is why you see player jumping around under high latency.

From their perspective they are running smoothly, but due to the latency , your client isn't getting updated fast enough.


Most of the packets are sent at a big enough delay that it will make everything look choppy. Everything the client shows will have lag compensation (predicting where projectiles, players, etc. will be in between frames) to make it look like the packets are coming at the same time.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号