Advertisement

Computer Speed and Sync

Started by January 01, 2001 10:13 PM
2 comments, last by Bitruder 23 years, 11 months ago
I''m developing a simple game in VB using directdraw and having multiplayer using Winsock. I''ve got the communication working, but I have a problem with computer speed. I have a spaceship which flys around, and currently I update it''s position every 5 ticks (dx.tickcount). When I run this on a 166, it updates the ships position less often than my 750. Therefore, when they are linked (two computers), it creates a jumping effect. This is because I send the exact position 2 times a second, and also when the throttle or direction of the ship changes. In between the updates, each computer caluclates the other ships position on its own. Since each computer moves the ship at a different speed, the update position never agrees. How can I fix this? When I tried updating the ships position at higher intervals (30 ticks for instance), it created choppy animation. Please Help
Assuming that a tick means the same to both machines say 100ms. You send the current tick with the update packet or group of update packets if you want to save on overhead. Use a timmer synchronzation scheme such as NTP, which an implentation description can be found here www.codewhore.com . So when you recive an update packet you can extrapalate or buffer the information so you won''t get that anonying jumping effect.

Good Luck

-ddn
Advertisement
Uhhh.. NTP is a protocol to distribute the current local time (or GMT) over a network, _not_ the game time. What you''re looking for is a basic dead reckoning algorithm; there should be enough stuff written on it already.

cu,
Prefect
Widelands - laid back, free software strategy
You would synchronize timmers if you wanted to reduce the latency and increase smoothness for the client. If not then its very possible the client and server would become increasingly desychonized and either the client runs faster than the server, at which time, things start to jump backwards or the client runs so much slower than the server at which point the latecny would greatly interfer with gameplay. If the client knew what time it was on the server (within an accpetable error) it could better buffer or extrapalate out of sync packets to its current predicted server time.

Previous posts have touched on this matter to greater depth, if your intrested. Visit www.codewhore.com for a more indepth explanation.

Good Luck

-ddn

This topic is closed to new replies.

Advertisement