🎉 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!

network syncronization...

Started by
0 comments, last by Bruno 22 years, 9 months ago
Hello I''m tryng to implement multiplayer network on my engine, and so far it''s working nicely on my little lan., but, when tryng it over the internet as i expected i have lot''s of latency., so my bots instead of moving smoothly on the world they jump from place to place. Essentialy what i''m doing is sending the player''s position/direction/angle , so when this information get''s to the other side with big delay my bot just jumps around as i said before. What i have done in the server machine is, in each pack i send, i have an id number that i increment each time i send the package. On the client side, i check the id number to see if it''s the same or if it is diferent., if it''s diferent that means i have a new package, so i update the bot position, if it''s the same it means i''m still with the old package, so what i do in this case is i just update the bot position with is direction. This works more or less,but i cannot do it allways, because as you already have guessed if the latency is to big the bot can easily bypass the real bot position on the server, so i only do this in the client 6 times. Anyways this is how i''am handling things.., so, i just wanna know if someone has already implemented something like this, and how did you overcome this problem ? I also have another problem, to mantain a constant framerate when moving the camera, i multiply the player position with a speedfactor. Even in my Lan, if the client machine is slower than the server machine the speedfactor will be diferent, so, the camera will look smooth in the slower machine, and the bot will look very fast in the faster machine. I can fix this just by multiplyng the bot position(that cames from the client) with the current machine speedfctor, but i''m not sure if this is correct, because the bot may be in a position in the client machine, and in another diferent position in the server machine. anyways, i hope who''s reading this understood my problem..., thanks, Bruno
Advertisement
It seems like your engine is not time based but rather fixed rate. That is the faster the machine, the faster the update rate, the faster the object move for a given time. Use a scaling variable based upon the passage of time between each frame and your desired update rate, and scale the velocity componenet to fix the speed problem.

There are alot of methods to smooth out the client. Smoothing algorithms for movement, using splines will work well. Once you''ve worked out that problem, the next problem is to synchronize clients so they see the same thing. A good solution is to use a timmer synchronization algorithm (see www.codewhore.com, look for NTP), and extrapaltion. Once you''ve gone this far, you will proably have a decent network infrastructure. The next step is to optimize the network to reduce the bandwidth load, apparent and transactional latency, increase server load, and increase quailty of the simulation.

Once you''ve gone that far, there isn''t much more that can be or needs to be done for the network side, I''ve found 8^)

-ddn

This topic is closed to new replies.

Advertisement