HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Multiplayer Problem: Wait / TriggerSleepAction / PolledWait take longer than supposed

08-14-2006, 01:55 PM#1
Laosh'Ra
an issue which only occurs in multiplayer: the wait x seconds (gui) seems to have a minimum of about 0.5 seconds (it waits a half second even if its supposed to wait only 0.01 seconds).
i tried the jass action TriggerSleepAction(x) but it also didnt get shorter than 0.45 seconds. PolledWait(x) at least has a minimum of 1/3 seconds.

this is the way i tested:

i made a trigger which does 2 things: activating another trigger (which starts looping) and waiting 10 seconds itself. after the 10 seconds it counts the number of processed loops within the other trigger returning the average execution per second.
i've chosen 10 seconds because the loopspeed might vary a bit. longer time = exacter result. i also added a wait at map initilization to prevent any preloading stuff or w/e from disturbing the test. the loop itself doesnt do anything except counting up an integer. the map itself was totally empty.

is there any way to get very short lasting waits even in multiplayer? i'd be happy with 0.1 seconds...
08-14-2006, 01:58 PM#2
The)TideHunter(
We know, PolledWait and TriggerSleepAction arnt accurate.
Use timers, as they are very accurate.

EDIT: A timer can go into 3 decimal places.
Anyways, heres a example:
Collapse JASS:
function MyFunctionIWantToRun takes nothing returns nothing
// Do Stuff
endfunction

function MyFunctionThatIsGoingToSleep takes ... returns ...
    local timer t = CreateTimer()
    // Do stuff before wait
    call TimerStart(t, YourWaitTime, false, function MyFunctionIWantToRun)
endfunction
08-14-2006, 02:25 PM#3
Laosh'Ra
thx a lot :D