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

Multiplayer Maddness (Im going insane!)

Started by
1 comment, last by alexpnd 23 years ago
Hello! I''ve got a little problem in my realtime multiplayer game. I''m 14 and have just begun peeking into directplay, so i need help with this one. I''m sending the peers data to the other peers (may as well be client to server) and am constantly getting different games on the clients (split games). How do fix do this! Im going crazy. Here is an "mock-up" example of my code (in Visual Basic): ______________________________________________________ Sub GameLoop() If CurrentTime - LastTime > UpdateInterval then Update = True LastTime = CurrentTime End if UpdatePlayers End Sub ______________________________________________________ Sub UpdatePlayers() PlayerMoved = False If PlayerKeyDown Then PlayerMoved = True If Update = True then If PlayerMoved then SendMoveData End if End if End Sub - See, if update is false and the player moves, then it wont get updated on the other computers. Any help would be appreciated
----------------------------visit bluecatstudios.i-p.com
Advertisement
Hi alexpnd,

I can better answer your question if you clarify what you mean by "split" games.

Do you mean that the game does not appear to be identical on the peers? If that is the case then you will be hard pressed to get the game to replicate its state exactly across the peers (with any efficiency).

Some multiplayer games utilize game states to keep clients refreshed. One way to synchronize exact duplication is to lock each client to a state#. For example:

  BEGIN STATE1    The host sends an update message to each peer with the state value of 1.    Each peer receives the message and updates their game state.  Each peer sends a message back to the host that they have completed their task.    The host waits to send the next state until all clients have acked back their completion.END STATE1BEGIN STATE2    Repeat...END STATE2  


As you can probably guess, the above method would be EXTREMELY slow. This is why most online games do not require the exact same state on each machine. If you ever played Tribes2 on two computers side-by-side, you would find out that the game does not look exactly the same on them. This is because the server does not force the clients to update at the same time.

The general rule of thumb is to make the game work in such a way that players cannot tell they arent synced up perfectly. You do this with interpolation tricks among other things.



LostLogic
www.lostlogic.com
Author, Multiplayer Game Programming

LostLogicwww.GamerOutfit.comXBox 360 Community Games Reviews and NewsExisled - 2D/3D Shooter for XBox 360

But if you''re not synching every state can''t you get problems like in Diablo II where you''re killed by a critter that isn''t even near you?

Even with really good interpolation routines you''re still going to end up with problems. Surely a better way is to force state on critical things (so that your state is very small and your state updates are therefore relatively quick) and then just leave 100% predictable stuff to the client?

I''m very new to this, so I''m just asking.



I have plenty of talent and vision, I just don''''t give a damn.
'Doing the impossible is kind of fun' - Walt Disney

This topic is closed to new replies.

Advertisement