• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Do this code cause desync ?

Status
Not open for further replies.
Level 9
Joined
Apr 26, 2011
Messages
403
JASS:
 private player cp = Player(0) // Red Player

///Returns first *REAL* player from player 1-12
    private function emitter takes nothing returns player
        local integer i = GetPlayerId(cp)
        loop
            set cp = Player(i)
            exitwhen GetPlayerController(cp) == MAP_CONTROL_USER and GetPlayerSlotState(cp) == PLAYER_SLOT_STATE_PLAYING
            set i = i + 1
        endloop
        return cp
    endfunction
    
    // Places meta-data in the replay and in network traffic
   // only one player need to sync the data.
    private function emit takes string message returns nothing
        local string id = MISSION_KEY_PREFIX + I2S(num_msg)
        set num_msg = num_msg + 1
        call StoreInteger(gc, id, message, SUFFIX_VAL)
        if GetLocalPlayer() == emitter() then
            call SyncStoredInteger(gc, id, message)
        endif
        call FlushStoredInteger(gc, id, message)
    endfunction

if I disable above code, desync won't happen.

if I enable, it will only happen when someone leave.

and it do not happen all time. (at lease not happen when host have good connection)

if it happen, then it will cause mass disconnect.

so either normal or mass disconnect :(

I am not sure why it happen :(
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I don't think you're using SyncStoredInteger correctly. If you use that function it will sync the stored integers for every player with that of the "host", so where the value of those integers (one for each player) may have had different values after SyncStoredInteger they will all be the same.

It doesn't really make sense to locally sync all player values. What exactly is this supposed to do?
 
Level 9
Joined
Apr 26, 2011
Messages
403
I don't think you're using SyncStoredInteger correctly. If you use that function it will sync the stored integers for every player with that of the "host", so where the value of those integers (one for each player) may have had different values after SyncStoredInteger they will all be the same.

It doesn't really make sense to locally sync all player values. What exactly is this supposed to do?

The code is for W3MMD Library.

the data is use by hostbot parser so they can read game's stat (it will never read the stored integer in game)

the reason for localplayer code : only host or first real player can Sync data to everyone (to reduce network traffic)

and I don't know what FlushStoredInteger(gc, id, message) do, look like it didn't clean up the game cache entry.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
the reason for localplayer code : only host or first real player can Sync data to everyone (to reduce network traffic)

The command to sync data is not sent by the host. It is sent by the game at which point it syncs a value in game-cache to the host's corresponding value. If you only execute a function that syncs a value for all players for a single player, then you're going to desync from every other player who isn't "syncing" in that particular instance. The idea doesn't really make sense, anyways.

and I don't know what FlushStoredInteger(gc, id, message) do, look like it didn't clean up the game cache entry.

Not too sure. Maybe it does it just doesn't "reset" the value for it. If the memory is available that doesn't necessary mean that it has a "null" value.

Either way, if the only concern you have is reducing network traffic; try removing the local block and instead simply do SyncStoredInteger.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Is the message parameter synced? I also do not think that SyncStoredValue is local-friendly. Flushing removes the entry/can be newly filled anytime afterwards. The only way to get a value from any client I have heard of is described here by unit selection since SelectUnit is one of the few actions that you can play locally but which gets broadcast.
 
Level 9
Joined
Apr 26, 2011
Messages
403
my desync is fixed

I just disable W3MMD on default.

then turn it on if game is host by Hostbot.

desync never happen on hostbot (hostbot can wait or reconnect player to avoid desync)

so this W3MMD desync issue is temporary fixed for anyone who have same problem
 
Status
Not open for further replies.
Top