| 01-09-2004, 09:58 AM | #1 |
I know TriggerSleepAction() doesn't work correctly during multiplayer games (desyncs?). But I need this function in my triggers for multiplayer map! And TriggerSleepAction() uses GetRandomReal() as argument. What should I do to make this work and avoid desync? Using timers doesn't seem to be a good idea in that trigger... P.S. This doesn't work even in singleplayer game: Code:
[color=skyblue] function SubWait takes nothing returns nothing call TriggerSleepAction(0.1) endfunction function MyFunc takes ... returns ... .... ForGroup(GetPlayersAll(), function SubWait) .... endfunction [/color] |
| 01-09-2004, 10:21 AM | #2 |
Have you tried PolledWait()? http://jass.sourceforge.net/doc/api/...rce.shtml#1118 It uses a timer workaround with TriggerSleepAction. Cheers, Tommi |
| 01-09-2004, 10:26 AM | #3 |
No, I haven't... thank you for this tip, I'll try using it. And one more question: can GetRandomReal() cause desyncs when being used as PolledWait() argument? |
| 01-09-2004, 10:51 AM | #4 |
TriggerSleepAction did never desync. The wait time was just divided by the number of players or something... |
| 01-09-2004, 11:09 AM | #5 |
and i could add that the TriggerSleepAction-bug was fixed, now it waits the correct ammount of time in multiplayer but....if sumone lags or anything like that, the sleep-action does not "wait" for the lag....so that's why you have to use polled wait to wait the correct game-play ammount of time. About getrandomreal....ofcourse it shouldn't desync.....all the players always get the same number (unless you get the number in a local-player branch ofcourse), as that's how the randomity work. Just like in C++, warcraft automatically sets a "random" (often using the current-time of the computer) seed to the randomizer at the beginning of a game...and if all players have this same seed, they'll all get the same numbers in the same row...notice how you can do a WE-testmap with a "fixed" seed for testing-purposes...that basicly initializes the randomizer without a random-seed, so everytime you test-map it'll use the same seed resulting in the same sequence of random numbers. As randomizers do not create "random" numbers, they just go through some HEAVY algorithms with some specific seed to create a seemingly random number. Atleast that's how i learned how it works, you may proove me wrong. Cubasis |
| 01-09-2004, 11:31 AM | #6 |
For those interested in random number generation in Blizzard's games, here's a link to Jarulf's post about about random number generation in Diablo 1 and Diablo 2 and how it affects multiplayer games: http://www.theamazonbasin.com/d2/for...ic=37162&st=26 Cheers, Tommi |
| 01-09-2004, 01:38 PM | #7 |
Tommi, Cubasis40, PitzerMike - thank you for help. |
