• 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.

[Trigger] Triggering Myth - .25sec wait

Status
Not open for further replies.
Level 7
Joined
Mar 12, 2006
Messages
407
I hope this is the right forum, didnt know where to post else

Ok I repeatedly read that the minimum wait for
  • Wait x seconds
is 0.25 seconds


Today i watched the Mythbusters busting some myths and so i feel inspirated to prove all those people wrong ;)

Ok here you go !

  • buster1
    • Events
      • Player - Player 1 (Red) types a chat message containing start as exact match
    • Conditions
    • Actions
      • Set bool = True
      • Trigger - Run runner <gen> (checking conditions)
      • Wait 1.00 seconds
      • Set bool = False
  • buster2
    • Events
    • Conditions
    • Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
      • Wait 0.01 seconds
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • bool Gleich (==) True
        • 'THEN'-Actions
          • Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: blabla
        • 'ELSE'-Actions
First trigger starts the second one, waits 1 second and then sets bool to false which will prevent trigger 2 from displaying messages
If you run this it will show 7 to 9 messages
Which basically means that
Wait time is bigger then 0.01 (or if then else takes a while to be executed)
Wait time is a lot smaller then 0.25!
Wait time is NOT! constant

Ok just to prove my theory a bit more
modify the wait time in trigger 1
Set wait to 0 => no messages
Set wait to 0.1 => one message

So you see there might be a minimum wait time but it is definetely a lot shorter then .25 and i think it might depend on your computers speed



Ok now i feel like Hyneman until someone proves me wrong (or tells me that this is already been posted )
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
A far more accurate test, done with GUI since this is the GUI forum.

It displays between .12 and about .25, but it is far more often at .25 (2/3 of the time). Waits are also significantly slower on multiplayer. Also, the generally fastest accepted wait time is <.1, but that's for 0 or -1 second waits.

I'm not sure you fully understood the topic (Or that most do).

And this just proves further, not less, that waits suck.

  • Timer
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Countdown Timer - Start Tim as a One-shot timer that will expire in 99999.00 seconds
          • Wait 0.01 seconds
          • Game - Display to (All players) the text: (String((Elapsed time for Tim)))
 
Level 17
Joined
Apr 13, 2008
Messages
1,608
It actually has been proven long ago. Wait time is affected by processing time, as far as I know. I remember reading something like using timers instead of waits results in more accurate "wait times", but I have never tried it and I don't really care until I want to use these tiny wait times.
 
Level 7
Joined
Mar 12, 2006
Messages
407
Ok, its just that i read about this limit like 2 times a day minimum, hopefully some people read this thread and change their opinions ;)

And yeah your method is way more accurate but it basically proves the same thing, waittime is not .25 secs ;)
so... your Hyneman, and I'm Savage, can live with that :D


(and of course wait sucks, didnt want to question that)
 
Level 17
Joined
Apr 13, 2008
Messages
1,608
It's not a stupid question at all. I would also like to know because the stuff I googled up about this is very contradictive.

Most probably Polled wait (aka wait game time) waits through lag but the simple wait doesn't.
Polled wait uses a timer, but as far as I know it's as accurate as a simple wait, in addition it leaks 4 bytes every time it's used..

I have also found a function named polledwait2 by Vexorian:
http://wc3jass.com/viewtopic.php?t=206
I haven't tested it yet, dunno if it's any good, there are several reports that it caused the users' map to crash.

In my opinion the Wait is a more lightweight wait function probably intended for single player / campaign use, while Polled Wait is intended for multiplayer, but I have no idea why are they so inaccurate. Well, if you want to go for precision you have to use timers or periodic events.
 
Last edited:
Level 5
Joined
Aug 27, 2007
Messages
138
Polled wait is nothing but a timer, really, but it leaks and it's slow. I think if you're really worried about the normal wait screwing up, you're much better off with a timer or PolledWait2, which makes Polled Wait faster and and removes the leak.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
I found PolledWait to be more inaccurate(a lot) than TriggerSleepAction but I haven't put that to extensive tests.
I think timers have even less minimum interval, but it causes lag due to the number of executed functions per second.
 
I found PolledWait to be more inaccurate(a lot) than TriggerSleepAction but I haven't put that to extensive tests.
I think timers have even less minimum interval, but it causes lag due to the number of executed functions per second.

Timers are more accurate, and have a really low interval, yes, it has been verified.

But generally, if you loop and wait, or run a periodic timer and perform the same amount of executions, it will lag.

It isn't the timer's fault, it will generally lag if you do too many executions with a really low interval.
 
Status
Not open for further replies.
Top