🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Updating position/velocity over the network

Started by
0 comments, last by AndersO 22 years, 8 months ago
Hello all. I''m having troubles with updating positions/velocitys over the network. The idea is to calculate positions locally at the client and then send it to the server wich then send it to the other clients. This is how I calculate the position locally (the usual equations): position+=velocity*time + 0.5*thrust*time*time; velocity+=thrust*time; Now, sending the position is straightforward, the velocity is not. The ''time'' in above equations is the time it took to render/update a frame, so its going to be different on different computers depending on how fast it is. So I need to "take out" the frametime dependancy from the velocity I guess. I tried to send this instead: velocity_to_send=velocity/time; And then on the receiving clients multiply by their local frametime. But that didn''t really work so good as I thought it would. The velocity gets wrong and I cant understand why. Oh yea, I need to send the velocity because of the prediction on the clients ofcourse. So any ideas?
Advertisement
competely seperate the your rendering from your logic code.

are you trying to do extrapolation? if so I recommend sync''in all the clients to the server time and going from there.

ie
xpos = xpos + xvel * time_spent_traveling_over_net;


do a search, this forum has lots of good topics about sync''in.

This topic is closed to new replies.

Advertisement