Download

[Networking] Handle movement

Hi there.

I got some trouble with my c++ server and game with the movement, i’m asking how it should be handle.

At the moment i’m doing:

  • Tick
    • Detect if player moving
    • If moving
      • Send position to the server, the server will make all check and verification about the speed hacking etc.
      • If ok
      • Send to all player around my new position

The problem now is the delay…

By doing this i got a lot amount of packet on my game (16 to 20 bytes) per packet each tick, with a lot of client moving my packet stack is overcharged and i got a big delay between all my moving client to reach the final position.

I tried an oter solution by moving with a input key pressed (pressing w set foward to true and update the movement on all near player) but the delay between the send and recv make the position wrong.

I’m not using ue4 network, i made a listen server using boost asio async and game client using it too.

ps: i’m doing the movement from client because i’m not reading the map on the server side to check the collision map info etc

I fixed it, i made a separate thread who is running all the packet processing, because tick limit the amount at 120 per second than a separate thread 1000 and fill a list of movement to execute in my entity.