Author Topic: [fixed] 3.7.1 Out of sync when cancelling metamorphosis  (Read 954 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
[fixed] 3.7.1 Out of sync when cancelling metamorphosis
« on: 16 December 2012, 22:57:53 »
Hi, today we had an out of sync while playing which made me think a lot.
What happened:
I played magic and I was forced to morph nearly all my initiates to Battlemages, because I was attacked and did not had enough fighters. But my opponent was attacked too by a third player and so he gave up on attacking me. When I saw this I though that I better interrupt all those morphing units because otherwise I would not had anymore initiates to get gold.  SO I send all the morphing units back to gold.
The result was an "out of sync" because excatly in the moment where my command was executed some of the initiates were already morphed to battlemages. But "mining" is not a command a battlemage can do .... ( unknown command for unit xxx game out of sync )

Thinking about this, I came to the conclusion that something similar is the reason for "out of syncs" with slow computers falling back  too, becasue a morphing initiate for example gets an command, but when the command is executed its no longer an initiate , its a battlemage then!

How to solve this ?
We must detect if this unit maybe was a unit of this unit type before and in this case we simply skip the command if there is no such command class.

But how to differ this from a real out of sync ?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: 3.7.1 out of sync caused by morphing units
« Reply #1 on: 19 December 2012, 22:44:53 »
Idea how to solve it:

1. Commands should record the frame # when they where given by the user ( the frame number the user had on his computer.
2. If a unit morphs to another unit type we store its former Unittype and the frame when it happened.

before we give a command to a unit we check if the command is older than the last morph. If this is the case we skip the command without saying "out of sync".
What do you think? Is there a more easy way ?
« Last Edit: 20 December 2012, 13:08:52 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

tomreyn

  • Local Moderator
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: 3.7.1 out of sync caused by morphing units
« Reply #2 on: 20 December 2012, 16:28:50 »
As far as I know it's not possible to queue commands after morphing (which could be considered an issue on its own). While this behaviour persists, the easiest solution would seem to be to discard all commands by the time morphing completes.

Alternatively, you could just not execute commands which aren't available, without (forcefully) going out of synch. I.e. downgrade the fatal error to an informational status message only written to terminal/verbose output.

Both of which feels more like a hack, though. Your solution is much cleaner.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: 3.7.1 out of sync caused by morphing units
« Reply #3 on: 20 December 2012, 23:34:25 »
one more improvement on mine:

We just store the frame when last morph happened for a unit so this can be null or the frame when last morph happened. No need to store former UnitType. When we see a frame in the command which was given before last  morph of unit we skip it :D .

( Sadly this will change the network command and by this it will be incompatible with current version .... )
« Last Edit: 3 May 2013, 10:14:31 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: 3.7.1 out of sync caused by morphing units
« Reply #4 on: 3 May 2013, 10:36:49 »
uh lets don't forget this ....
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: 3.7.1 out of sync caused by morphing units
« Reply #5 on: 23 May 2013, 06:16:19 »
This might possibly be fixed by svn rev# 4302 please test

tomreyn

  • Local Moderator
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: 3.7.1 out of sync caused by morphing units
« Reply #6 on: 25 May 2013, 22:38:07 »
Sadly not, yet, reproduced today on r4314.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: 3.7.1 out of sync caused by morphing units
« Reply #7 on: 25 May 2013, 22:58:56 »
Fixed in 4317

 

anything