Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Player Movement Interpolation / Prediction  (Read 4411 times)

0 Members and 1 Guest are viewing this topic.

firepro20

  • Newbie
  • *
  • Posts: 22
    • View Profile
Player Movement Interpolation / Prediction
« on: December 05, 2019, 02:16:09 am »
I am currently sending a UDP packet using sf::Packet type for data transmission.

What would be the ideal logic for interpolating between the last two packets received position and the current one? So it will be based on the last three data packets?

At the moment all I have is a send and receive packet on both server and client respectively.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Player Movement Interpolation / Prediction
« Reply #1 on: December 05, 2019, 09:58:29 am »
You wouldn't really interpolate between packets, but you'd do a client side physics calculation and move your objects accordingly. Once the server response with a new data point, you set the correct position.

There's no "ideal logic" to this, but it all depends on your code.

Also here's an article that might be interesting to you: https://www.kinematicsoup.com/news/2017/5/30/multiplayerprediction
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything