Fastpaced online game (2D platformer) - Networking Server/Client

250 views Asked by At

I started a new project, a fast-paced online game (some sort of 2D MOBA). I encountered a problem with the part of netcode about client prediction & server reconciliation.

Game Mechanics: 2D - Platformer (MOBA)
Movement: WASD (jump / left / down / right)
Abilites & Autoattack: J/K/L
Architecture: Client/server (authoritative)

My netcode is using these techniques:

  • Client-side prediction & server reconciliation
    • Server is sending position & data to the player, the player is replaying the last unprocessed inputs
    • Client is sending input each frame at a fixed timestep (60 times/sec) which are processed on the server-side
  • Other entities are interpolated
  • Bullets/abilities are extrapolated (Dead reckoning)

So far, this is working good on clients. My question is, how to handle some sort of forced movement?

For example, another player stuns or slows down you, on the server, you will be slowed down or stunned, but you will not know it before the packet arrives, since you are predicting the next state, it will teleport you back because your speed was changed to 0 or lower (in case of slow), it will immediately turn you back (teleport).

What is a good way to handle this technique? I was thinking about interpolating between the current position and the position on the server, but it is not working well for me.

0

There are 0 answers