Sign in to follow this  
Imbesile

Game Mismatching

Recommended Posts

Alright, Don't know if this is the right place to do this, but here goes. For years I have been playing Command and Conquer. With C&C Generals I have been more than frustrated. We play 2 people just fine. When we try more we keep getting Game Mismatches with the server. Sucks huge... As developers what can be done to stop this from happening? Do we have periodic server save points so if something like this happens the server can sync everybody together again? Do we just kick them out of our game? (like what happens now on C&C G). What is the solution? Thanks, John

Share this post


Link to post
Share on other sites
Well, you need to know *WHY* this happens.

If you're making a RTS, if the game is basically deterministic (random events controlled by a PRNG which is the same on all machines, seeded with the same value), then of course only the changes (for example orders) need to be sent.

This is great, but you need to make sure
- You know exactly which tick you're sending the command on (to be executed on) - and that it gets executed on exactly the same tick on everyone's machine - moreover, if several commands happen in the same tick, they happen in exactly the same order everywhere. This is usually achieved by *not* executing the client's command on the client machine, rather just sending to to the server, and only executing it when it comes back from the server. Because the server will send everything to all clients in the same order, it should get done in the same order.

- You need a reliable network interface so you don't lose commands (usually using TCP is a good idea)
- You need to make sure that everything is deterministic - which means that uninitialised variables etc which might otherwise be benign, are going to screw your game up - ensure that you don't have any.

---

Of course you need to make sure that all the clients are running exactly the same version of the game. This can be performed at connect-time, by having the clients send their version (and or the server send its). This should be a source version number which is different in every single release of the game, including all patches, even development builds.

---

Finally, you need to make sure that your game save/load map serialisation function (which you will presumably use for network games too) is absolutely rock-solid. No differences in the map of any kind must be present, otherwise a desync will happen.

If you detect a desync, possible options are:
- Just kick the client off - not very helpful
- Resync the game by sending another complete dump of the game state, and all commands since (which need to be queued if the other players are still playing while the map dump is downloading)

To detect a desync, I think that various properties of various units are hashed together, and the value compared (possibly also including a random number from the consistent random number generator). This means that hopefully, in the event of a desync, this is detected fairly quickly.

This could be done every few seconds or something.

Obviously I can't tell you why your C&C is desyncing, but perhaps one of the players is using an unofficial binary of some kind - make sure that all your opponents have the same version (WITHOUT third party cracks, hacks or patches (which includes NOCD patches)).

Of course you wouldn't be playing a cracked binary, but make sure that your opponents aren't either.

Mark

Share this post


Link to post
Share on other sites
I like the assumption of the hacked copy. LMAO. C&C G just sucks. You would think that a big named company would be able to handle network code. Or atleast fix it within a 2 year time span.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this