|
发表于 2007-1-5 09:41:29
|
显示全部楼层
http://www.wc3jass.com/viewtopic.php?t=2726
PipeDream
Wed Mar 29, 2006 11:11 am
I tried to use this to measure game latency
[jass] function GetHost takes nothing returns nothing
local timer t = CreateTimer
local real dt
call TimerStart(t,20.,false,null)
set dt = TimerGetElapsed(t)
call StoreInteger(udg_MedalCache, "Alpha", "Beta", GetPlayerId(GetLocalPlayer()) + 1)
call TriggerSyncStart()
call SyncStoredInteger(udg_MedalCache, "Alpha", "Beta")
call TriggerSyncReady()
set udg_GameHost = Player(GetStoredInteger(udg_MedalCache, "Alpha", "Beta") - 1)
call FlushStoredMission(udg_MedalCache,"Alpha")
set dt = TimerGetElapsed(t) - dt //dt is now max latency, I think
call PauseTimer(t)
call DestroyTimer(t)
set t = null
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Game latency: "+I2S(R2I(dt*1000))+"ms")
endfunction [/jass]
also tried SyncSelections() instead of TriggerSyncStart/TriggerSyncReady()
Didn't work out. TriggerSyncStart/ready always consumed 500ms, SyncSelections() 250ms. Possibly all sync commands do a 250ms sleep and SyncStoredInteger really does sync by itself.
Anyone got other ideas?
这些历史资料我都不知道是从哪里挖出来的。。。 |
|