Sync Errors

Sync Errors

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

incidenta5
Posts: 37
Joined: 15 Mar 2006, 00:40

Sync Errors

Post by incidenta5 »

Is there any particular reason that we see sync errors when one player builds 500 farks etc.. ?

I'm curious what exactly causes sync problems. Usually the game will send delayed sync packets and everything is fine, but in some cases the sync problem is permimant for the duration of the game.
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Post by Das Bruce »

Cheating, lag, different mod/map versions can all cause sync errors.
heze
Posts: 38
Joined: 28 Apr 2005, 23:32

Post by heze »

Also the game can get out of sync in a very long game with lots of unit by a tiny bug that causes miscalculation and that happens very rarely. Very hard to track down such. (Maybe a resync system could fix this.)
User avatar
Zenka
Posts: 1235
Joined: 05 Oct 2005, 15:29

Post by Zenka »

A resync option would meen that the host send his current status to all players.
but hcuch a current status would involve an enormouse amount of data, since Spring is build on just the transfer of command and every player simulates a game. (how a relay works)
A resync package would include all pos, status, orders of all units and heightmaps.
Lord JoNil
Posts: 47
Joined: 28 Dec 2005, 03:20

Post by Lord JoNil »

But wouldn├óÔé¼Ôäót it be better if a resync system were in place. It would for example paused the game and do a full resync and then resume again when it is finished. Instead you├óÔé¼Ôäóre 3 hour game permanently losing sync.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

yes, just someone needs to implement it
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

That depends upon you trusting that the one that brought you all out of sync isnt the host....
User avatar
Zenka
Posts: 1235
Joined: 05 Oct 2005, 15:29

Post by Zenka »

AF wrote:That depends upon you trusting that the one that brought you all out of sync isnt the host....
If the sync error is cause by a differ of mods or maps, this would only temporary solve it. and the sync errors well be back very quickly.
If there is an other reason, why should it matter tho who's game you resync?
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

Resync shouldnt be necessary if no desynching occurs at all.

Prevention > Cure.
incidenta5
Posts: 37
Joined: 15 Mar 2006, 00:40

Post by incidenta5 »

Couldn't you structure the 'synced' data in such a way that it periodically takes a checksum of certain parts of the game state? This is slightly different than what goes on at the moment.

That way, clients would exchange checksums to determine who caused the game to desync. Then only that particular part of the game state would be resynced by the host.

Assuming a generic resync system would also resync the heightmap, this would save alot of bandwidth.
jouninkomiko
Posts: 436
Joined: 26 Aug 2004, 08:11

Post by jouninkomiko »

I couldn't agree more, incidenta. What I'd like to do is analyze the code more, and see how the checksum is computed. I **think** it has a section of memory that contains synced data, and the checksum is computed on that entire memory block, but I haven't investigated. What'd be ideal is to have the classes that contain synced data implement a "GetHash" function or something of the sort as well as a "Resync" method that can take serialized data and resync the data inside.
User avatar
Dr.InfernO
Posts: 223
Joined: 18 Nov 2005, 13:55

Post by Dr.InfernO »

I regonized that RAM is a really important factor for syncerror free games.
if someone has less than 512MB RAM it's getting choppy on medium maps (16x16) with huge battles.
patmo98
Posts: 188
Joined: 09 Jan 2006, 17:51

Post by patmo98 »

Zenka wrote:If there is an other reason, why should it matter tho who's game you resync?
One thing that can cause a desync is cheating. Cheating is very easy for a programmer. The only protection is that the game gos out of sync if anyone cheats. But if the host was cheating and everyone synced to the host, nothing could stop the host from cheating.

I.e: If the host gives himself a Krogoth, that Krogoth will only exist on his computer, and the game would go out of sync. If re-sync is enabled, the Krogoth would be re-synced to all of the computers, and the host would have an extra Krogoth.

I think that Tobi was working on a voting system for a while, but now he's concentrating on preventing sync errors, espcally between Linux and Windows. I don't remember for sure.
incidenta5
Posts: 37
Joined: 15 Mar 2006, 00:40

Post by incidenta5 »

You could at least stem the tide of most cheats by doing a checksum on the executable itself in realtime. Open a handle to the executable and feed it into an md5 hash function.

The tricky part would be identifying whether or not the checksum was calculated on the executable being run, instead of one sitting in another folder.

Since this is an opensource game, it's pretty much impossible to stop the majority of 'all-seeing-eye' modifications.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

as you already say, commenting out a few lines of code and recompiling would break your measures...

anyone can always spoof the md5sum message after all...
incidenta5
Posts: 37
Joined: 15 Mar 2006, 00:40

Post by incidenta5 »

Tobi wrote:as you already say, commenting out a few lines of code and recompiling would break your measures...

anyone can always spoof the md5sum message after all...
Submitting memory for peer-review might work better. You could scan specific functions with a runtime disassembler for obvious breaks in code.

Ex (memcmp stuff is from memory, not sure about parameters offhand ;) ):

To incorperate this into the game, sync the pMemory buffer accross hosts and allow the existing system to deal with it. Also, you could have the game check different functions upon request of any client connected to a game (with spam protections; i.e. 1 request every 30 seconds, maximum of 128 bytes w/ checksum).

Code: Select all

void *p = &myFunc;
char *pMemory = new char [32];
for(int i=0; i<32; p++)
{
 pMemory[i] = (char)(*p);
 i++;
}

//Somewhere else in code..
send(socket, pMemory);

//Somewhere else in code..
recv(socket, pTheirMemory);

if(!memcmp(pMemory, pTheirMemory))
{
//Sync error!
throw(new SyncError("Exeecutable Data Mismatch!"));
}

This way, you would have to do alot more to spoof the system. You could load up a second executable and feed it the correct function's instructions; however, it would be more difficult.

The point is to deny the middle 50% of cheaters who can modify code and recompile, but are otherwise incapable of doing anything really advanced.

The top 10% would obviously be able to circumvent this given time.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

It's sill not too hard... you hack the exe to output the data which is send over the net to file, then you hack it to read that data and send it over the net instead of grabbing your actual code. Then you can modify the protected code as much as you want without anyone noticing.

ie. it will ALWAYS be possible to spoof network messages, no matter how obfuscated you make the checking code. In general, circumventing the security measures probably takes less time then implementing them...

Only thing which may work is something with public/private keys and lists of trusted users...
jouninkomiko
Posts: 436
Joined: 26 Aug 2004, 08:11

Post by jouninkomiko »

Anyone could easily intercept this by figuring out what each function is supposed to hash to, then intercepting the message when its received and sending the correct number. Building a 100% effective anticheat measure is impossible. I mean, look at what happened with Quake 3 and punkbuster thereafter?
User avatar
BvDorp
Posts: 439
Joined: 14 Oct 2005, 12:09

Post by BvDorp »

how do other open source games handle this?
incidenta5
Posts: 37
Joined: 15 Mar 2006, 00:40

Post by incidenta5 »

jouninkomiko wrote:Anyone could easily intercept this by figuring out what each function is supposed to hash to, then intercepting the message when its received and sending the correct number. Building a 100% effective anticheat measure is impossible. I mean, look at what happened with Quake 3 and punkbuster thereafter?
This isn't intended to be 100% foolproof. By making changes break with every update, it will make it inconvenient to cheat.

Also, randomizing which sections are scanned and how much is scanned would mean that the attacker would require access to the original executable, and knowledge of how to pull certain signatures from its functions.

By making it impossible to hash every concievable combination of data, which by the way is version dependant in many cases, you require a certain skillset to 'cheat', thus limiting the number of people who could successfully pull it off without being detected.[/code]
Post Reply

Return to “Engine”