Skip to main content
added 12 characters in body
Source Link
KaareZ
  • 1.9k
  • 1
  • 19
  • 30

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync. Heres a picture to describe it: enter image description here

Ps. This a technique I just made up, so theres probably someother techniques that will give you even smoother movement, but this is pretty easy to implement.

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync. Heres a picture to describe it: enter image description here

Ps. This a technique I just made up, so theres probably some that will give you even smoother movement, but this is pretty easy to implement.

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync. Heres a picture to describe it: enter image description here

Ps. This a technique I just made up, so theres probably other techniques that will give you even smoother movement, but this is pretty easy to implement.

added 259 characters in body
Source Link
KaareZ
  • 1.9k
  • 1
  • 19
  • 30

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync. Heres a picture to describe it: enter image description here

Ps. This a technique I just made up, so theres probably some that will give you even smoother movement, but this is pretty easy to implement.

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync.

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync. Heres a picture to describe it: enter image description here

Ps. This a technique I just made up, so theres probably some that will give you even smoother movement, but this is pretty easy to implement.

Source Link
KaareZ
  • 1.9k
  • 1
  • 19
  • 30

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync.