Jump to content
  • Advertisement
Sign in to follow this  
Zomis

Synchronizing Realtime Multiplayer games

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After having made a turn-based Multiplayer implementation of Minesweeper Flags at my site, I want to go into real-time Multiplayer development. The turn-based Minesweeper Flags game can be found here: http://www.zomis.net/games/flags The easiest real-time multiplayer thing that came to my mind was to have two squares travel around the playfield. I've made it working, but it isn't synchronized. When player1's x-position is 110 for Player1, Player1's x-position might be 104 for Player2. Only 6 pixels difference, but in realtime Multiplayer it must be perfect. All players move 10 times per second - a local timer controls this movement. I'm working in Flash (ActionScript 3.0) and using a PHP script as the server. I've implemented it so that any command that a player executes (change speed or change direction) is first sent to the server, then being sent back to all clients. And then all clients execute the action for the correct player. So what techniques should I use to make my games synchronized? I don't want to send too much data back and forth all the time, there has to be a better way, right?

Share this post


Link to post
Share on other sites
Advertisement
How you synchronize also depends greatly on what is being synchronized and how important time-critical it is. If it is a slower-paced game, you can often get away with event-based updates - that is, when player X moves, you send the information stating they have moved. You can also use TCP for this since resends are actually wanted (nearly) every time. If it is faster-paced, though, like a shooter, you will probably want to use UDP so you don't have to resend dropped packets, and constantly dish out information on the state of every entity. Information that is lost from dropped packets is just replaced shortly later by newer information instead of waiting around for the old information to be received before making use of the new information. This will result in a lot more bandwidth but a lot better synchronization.

The FAQ also goes into great detail about "TCP vs UDP", when to use each, etc.

When you say the positions are not equal in your second paragraph, is this after they have finished moving? Or while they are moving? If the latter, it is something you should expect for any networked game and can't be "fixed" but rather just "covered up" by using techniques like hplus mentioned. If its not synchronized when they are not moving, simply include that information. Include their current position, velocity, and any other relevant information to properly simulate the movement.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!