View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

# Synchronizing players

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1executor  Members

Posted 12 April 2000 - 05:03 AM

I have problems synchronizing two players with DirectPlay. The problem is that one computer is faster than the other and it''s units are moving faster. The efect is that two units (one from each player) that should be moving at the same speed are moving at different speeds. One computer has 40 fps and the other has 20 fps. With each frame the unit is moved two pixels. This way the two units are moving at different speeds. How do I make them move at the same speed? (It''s a RTS game with peer-to-peer DirectPlay multiplayer)

### #2Michalson  Members

Posted 12 April 2000 - 05:14 AM

I can think of two solutions. The first (but not the best) is to limit the framerate to the lowest system. What you might want to do instead is limit your framerate to something high, say 60 fps. At each frame you need to determine how much time has passed since the last frame and then move units accordingly. If some units are moving at 1 pixel/frame at 40fps then you might have to create more detailed position information based on some unit rather than pixels, like 4 units = 1 pixel. Tell me how it works out, I’m looking at creating a multiplayer RTS this summer and would be interested to know what other issues come up.

### #3Anonymous Poster_Anonymous Poster_*  Guests

Posted 12 April 2000 - 06:06 AM

Seperate the update of the units from the frame rate. Synchronize both clients to a timmer, and use that timmer inforamtion + data to extrapalate position of units. That''s the way i do it. Good luck.

-ddn

### #4cyberben  Members

Posted 12 April 2000 - 06:08 AM

I''ve seen a lot of games (Yes commercial ones) use time for unit posititioning rather than frams. So the rendering of the screen is a totally different part of the program than the updating of the units. So the frame rate doesn''t matter. So when you update your units you calculate the time it''s been between the last update and now and then use your speed (30 pixels per second or something) and calculate the distance to move it.
Try looking at Microsofts Age of Empires. It works like this. We networked a game from a P133 w/out MMX w/ a 2Mb generic graphics card to a PIII 533Mhz w/ a Voodoo 3 3000 and 128MB of ram. The frame rates were like 12-15fps vs. 60fps. But you could see the unit moving further an the slower computer per frame. The graphics just look a bit choppy on old systems.
Hope that helps!
- Ben

P.S. According to a recent thread on Task and Thread prioities in windows. Many of these games we talk about hav multiple threads running. Maybe they''ve got a thread syncing and moving all the units and thread that paints everything?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.