How do I calculate the velocity from pixels runned

0 votes
So I am making an online game with AppWarp, and I should use de UTC time and velocity to guess the position of the ball (Pong Game). My game uses Libgdx, and its actors uses Scene2d. They move by the method moveBy(x,y); which it means to add X and Y to its actual position. (I think it uses pixels) So I dont know how to calculate the velocity to calculate and guess where the ball is at the moment. I have thought about sending the actual position and the UTC time. Then when I have received the position and the UTC time, I should calculate the time it has last for the information to arrive and ..? The velocity is constant: moveBy(600,300); Any idea?
asked Jul 24, 2016 in Android by Raul Mateo (15 points)

1 Answer

0 votes

Hi Raul,

I guess there must be time involved while calling moveBy. So, when you are calling moveBy then you must be setting that in what time duration the distance set in the moveBy need to be travelled. If yes, then you can send that time too to the other player end as well. When you receive the same at other end, you can manipulate the time in which the set distance need to be travelled and the time elapsed between sent and received time for that particular message.

I hope it will help.

Regards,

Rajeev

answered Jul 26, 2016 by rajeev.etc (1,660 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...