• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Local Player issue

Status
Not open for further replies.
Level 15
Joined
Dec 6, 2008
Messages
346
Hello,
I was searching though Hive for more details about the Local Player thing, and found just some little info about it.
Is it possible to use function "if GetLocalPlayer() == udg_Player then" for turn on/off trigger? For example:

  • open Gate06
    • Events
      • Unit - A unit enters Region 111 <gen>
    • Conditions
    • Actions
      • Destructible - Open Gate (Horizontal) 6407 <gen>
      • Set Player = (Owner of (Entering unit))
      • Custom script: if GetLocalPlayer() == udg_Player then
      • Trigger - Turn off (This trigger)
      • Sound - Play Lever <gen>
      • Custom script: endif
      • Wait 5.00 seconds
      • Destructible - Close Gate (Horizontal) 6407 <gen>
I am very Interested to know which functions for the Local Player only are bugging in multiplayer, may you post them here? Thanks.
 
Level 6
Joined
Jun 18, 2004
Messages
119
No, this will certainly cause desyncs.

Anything that requires synchronization cannot be used in local blocks. For instance, creation of objects, or anything that will cause difference in behavior on different computers.

Things that don't require net traffic (like changing visual aspects of a unit, or the path of a special effect) can be changed locally.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
Is it possible to use function "if GetLocalPlayer() == udg_Player then" for turn on/off trigger? For example:
No as it will cause a desync. You need to turn triggers on/off for all clients, not just one.

Things that don't require net traffic (like changing visual aspects of a unit, or the path of a special effect) can be changed locally.
Most things do not require net traffic... WC3 is not LoL or DotA2.

Anything which alters the game state will cause an out of sync if run locally. For example if you kill a unit (which does not require net traffic) locally for one player then the game will out of sync that person as the unit is dead on his client and alive on all others.

I am very Interested to know which functions for the Local Player only are bugging in multiplayer, may you post them here? Thanks.
None bug with it. Just if it causes the game state to change between clients (lose sync) then clients will be dropped for being out of sync.

GetLocalPlayer() returns the player belonging to the client currently executing it. This means it will only ever be able to return playing human players. Since this player is different between clients it will mean the result is not deterministic between clients so can be used to introduce out of sync elements into WC3. This is important for art and other visual effects since it allows you to show them only to a single player and since they are graphics only they do not alter the game state so the clients remain synchronized.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
How exactly w3 detects desyncs?

I played torchlight 2 with some of my friends we had quite a bit(is this correct use?) desync problems while playing the game, since torchlight team is members of old blizzard team I was wondering that.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
How exactly w3 detects desyncs?
Like all games that operate in that way do. Some form of periodic checksums. Some times it can even be the RNG seed.

I played torchlight 2 with some of my friends we had quite a bit(is this correct use?) desync problems while playing the game, since torchlight team is members of old blizzard team I was wondering that.
Not applicable. If it is anything like Diablo II (the game the developers made you are referring to) it uses a different synchronization model. Specifically the model is the same as used by LoL, HoN and DotA2 as well as WoW and Diablo III.

Basically it streams you the results computed by a server. This is to stop cheating since client results are never reliable.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Like all games that operate in that way do. Some form of periodic checksums. Some times it can even be the RNG seed.

Does it check periodically or it checks whenever something related happens?Periodical check could be abused by adding some extra gold and spending it instantly.

Also it feels like there are so many things to check: lots of object handles, unit/destructable attributes, status of players etc...I thought instead of checking everything there could be a more elegant way.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
Does it check periodically or it checks whenever something related happens?Periodical check could be abused by adding some extra gold and spending it instantly.
Checks peridocially. Cannot be abused since spending the gold instantly results in out of sync as your client will spend the gold correctly but on other clients the order to spend the gold will fail as you have insufficient gold. All state is tracked by all clients so they know what you can see, how much you own, even what state your stuff is in when they cannot see it. This is how map hacks can exists and why map hacks in DotA2, HoN and LoL do not exist since in those games the server only streams you what you can see.

Also it feels like there are so many things to check: lots of object handles, unit/destructable attributes, status of players etc...I thought instead of checking everything there could be a more elegant way.
It obviously does not check everything. Instead it might only check a few things such as the current state of the RNG. WC3 being heavily RNG based will quickly suffer from out of sync problems as soon as the game state varies. There might be other values checked as well, and how often they are checked I do not know.

Simutrans uses this, and it is an open source game. You can see such an implementation there. I think they check RNG as well as a few key checksum values every period defined by the server in time.
 
Status
Not open for further replies.
Top