Author Topic: out of sync  (Read 4659 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
out of sync
« on: 17 January 2008, 10:34:11 »
hi martino some thoughts about the synchronization:

Here you discribed the multiplayer things:
http://www.glest.org/glest_board/viewto ... 2&start=15

if you did it like this there should be no problems with win / linux

The problem we had yesterday is probabaly not an out of sync error.
The commands are sent to the server and the server adds them to a list and let them execute in the next keyframe.
BUT:
this command can be based on the former keyframe, where a unit exists which is no longer there. This is not an out of sync error and can be ignored.

An example of what I think happens:
A keyframe(No30) is near and a unit(No5) gets a command. The command is send to the server, but the server already sent it's list to the clients for the next keyframe(No30). So this command from the client is added to the list for the new  keyframe(No31).But with commands from keyframe(No30) the unit(No5) is killed/morphed or whatever.
There are two possible problems:
1- when adding the command to the list for keyframe(31) the commands from keyframe(30) had removed the unit.
2- when executing commands from the list of for keyframe(31) the unit is no longer there.

Whatever happens, if a unit doesn't exist anymore( no unit can be found in the world with this id) this does NOT mean the game is out of sync! There is only a command for a unit that no longer exists, which can safely be ignored. Only the commands are synchronized in the game, but I think not the reactions on commands.

Out of sync can usually only happen on a very slow client who cannot execute all commands until next keyframe!  When he reaches the next keyframe and could not execute all commands, the game gets out of sync.

What do you think?
« Last Edit: 1 January 1970, 00:00:00 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

martiño

  • Behemoth
  • *******
  • Posts: 1,095
    • View Profile
(No subject)
« Reply #1 on: 17 January 2008, 11:12:20 »
Hi,

I don't think this can happen, because:

- Dead units remain in the battlefield for about 10 seconds, and even the ones that disappear stay in the game for a while after dying. Keyframes are now every 100ms, so there is 10 every second.

- When units morph they have the same ID, so that should not be a problem.

There is no problem with synching slow/laggy clients, since they will be running the game later than the server, and everybody always executes commands in the same frame, in fact the network message stores the frame number to check that.

I think the problem we had yesterday is that since we were using different versions of the game, that are even using different code and are compiled under different OSes with different compilers, the game might not execute exactly in the same way in all machines, so after a while units start dying in one of the machines but not in the other, so that's why we got out of synch, in fact this never happened to me with windows only players in beta1

Martiño.
« Last Edit: 1 January 1970, 00:00:00 by martiño »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
(No subject)
« Reply #2 on: 17 January 2008, 12:16:28 »
in the units xmls you can find in the attack definition:

Code: [Select]
<attack-strenght value="215"/>
<attack-var value="25"/>
<attack-range value="3"/>


Is the <attack-var value="25"/> an example of what is probably handled
different in the OSes/machines? Everything that includes some random factor
is a possible reason? Is this what you mean?

By this on one machine a unit is dead while on another it's still alive!
« Last Edit: 1 January 1970, 00:00:00 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

martiño

  • Behemoth
  • *******
  • Posts: 1,095
    • View Profile
(No subject)
« Reply #3 on: 17 January 2008, 13:58:22 »
All random stuff is made in a deterministic way, i have my own random algorithm, that was part of the work i had to do to make games be in synch, but other things could be done different, like timers for example.
« Last Edit: 1 January 1970, 00:00:00 by martiño »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
(No subject)
« Reply #4 on: 17 January 2008, 16:07:29 »
Yes, thats a problem , but does it really matter ?
We should try what happens if you simply ignore this error.
Probably everything works fine when you didn't exit. You can log these things as warnings to see what sort of problem it is. In my opinion this is ok for a beta. I will change the code for me and see what happens.
Wine-Win seems to be the best way to get these errors , I will test it.( but not today, no time)
« Last Edit: 1 January 1970, 00:00:00 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

martiño

  • Behemoth
  • *******
  • Posts: 1,095
    • View Profile
(No subject)
« Reply #5 on: 17 January 2008, 16:38:09 »
I disagree, I'd rather get a crash and know that things aren't working properly than play an unsynchronized game, which would be a waste of time INMHO.

Anyway I will prevent people from playing cross operative systems, so as long as people don't modify their data, this should never happen.
« Last Edit: 1 January 1970, 00:00:00 by martiño »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
(No subject)
« Reply #6 on: 17 January 2008, 18:27:24 »
okok, sorry that I didn't give up here it's a really bad problem. I shut up now :D

But I will do some tests, probabaly I can find the problem. A thing that I saw when I created the indians was the problem with the hit calculation when you have fast shots(thunderbirds).The hit calculation was completly different on slow and fast computers. When I find something I will tell you.
« Last Edit: 1 January 1970, 00:00:00 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

 

anything