Computer Speed and Sync
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
January 02, 2001 11:23 AM
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
Good Luck
-ddn
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
cu,
Prefect
Widelands - laid back, free software strategy
January 06, 2001 06:37 PM
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
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
Popular Topics
Advertisement