Do good multiplayer/mmo client<>server games use latency within movement calculations?

前端 未结 5 1589
灰色年华
灰色年华 2021-02-03 16:27

There\'s a couple of questions here.

Imagine I have client A who\'s going to send the following message to Server: \"START MOVEMENT FORWARD\".

The server will no

5条回答
  •  迷失自我
    2021-02-03 16:38

    I think that in most mmo's your client mainly moves without interaction with the server unless bad lag occurs. The server reproduces the movement with the help of the messages the client send to the server. So if for example the server lags, the client will stop recieving feedback from the server and revert to the position the server determine that you are at. That is why you jump back several frames during bad lag. This way the server will also have control over your speed so that you are not speedhacking. If your client moves at a certain rate which is over the speed determined by the server, you would simply jump back the extra frames.

    Other clients would not let you move at all without response from the server within a certain amount of time. This is the times you would experience 'freeze-lag'.

    Of course there are also occurences where the server simply take the position sent by the client and blindly trusts it. These are the games that are generally vulnerable to teleport hacks.

    When it comes to the position of other players there indeed is a delay, which can be seen if you take two computers, connect to a game such as wow and move the two characters simultaniously. You would see that on both computers the non-local character will start moving after you really started moving him.

    The client usually have some sort of lag compensation. So if another player is moving at a certain direction and then stops, your client will still simulate the movement of that player until you recieve a message from the server that he changed direction or stoped moving. That is why other players can jump back and forth when the ping is high. This is also why players can seem to just slide/run/walk away when you hit lagspikes and then return to their real position when your clients recieve positions from the server.

    Of course this changes from engine to engine but it's a rather general aproach.

    Edit: Forgot to add that it is very common for the server to also use lag compensation. If you hit someone in a mmo that is in range of you, that person might not be in range from the servers view. So the server takes the latency for both your clients and tries to match up if you were really in range of eachother or not.

提交回复
热议问题