System GetLatency

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Surely, it would just be tacked on the end (or start) of the Update function... or something.
I was wondering that it may slow down the function. :p
 

quraji

zap
Reaction score
144
Now, I need something explained to me.
a) How does getting the elapsed time of a timer arrive to getting latency? Timers' times aren't sync'd are they? If they are it seems pretty fast and we should start syncing data through timers..

b) Isn't measuring the gap between players on a timer that's been running for the whole game inaccurate? Won't the gap get larger as time goes on? That would suck..

c) I shouldn't do this after just waking up, I'm confusing myself.
 

quraji

zap
Reaction score
144
It does this:

Update:
1) On each computer, stores the time remaining on the timer to gamecache, with a different key for each player.
2) Syncs the gamecache value, whatever that means. I still haven't gotten a clear explanation as to how this operates/behaves.. sometimes I hear that it syncs they value according to what the "host" (fastest responding player) has, sometimes to whom ever calls it...I don't know.

Get Latency:
1) Subtracts the given player's gamecache value from the host's.

I don't see how this gives a latency value. Plus, I think there's an error in that recent code:
JASS:
        call FlushGameCache(InitGameCache("GetLatency"))
        set gc = InitGameCache("GetLatency")
        
        if HaveStoredInteger(gc,"Host","Id") then  // is this pointless or what?
            set HostId = GetStoredInteger(gc,"Host","Id")
        else
            set HostId = GetPlayerId(GetLocalPlayer())
            call StoreInteger(gc,"Host","Id",HostId)
            call SyncStoredInteger(gc,"Host","Id") // I'll assume that the value will be synced to whoever responds the fastest (presumably the host)
        endif
        
        set Host = Player(HostId) // should be "set Host = GetStoredInteger(gc, "Host", "Id")"?
 

saw792

Is known to say things. That is all.
Reaction score
280
@quraji

Normally, using the gamecache sync natives will do what you described, i.e. sync the value to the fastest responding player (which it seems can vary, but is usually the host). However, when the sync natives are called locally they will sync the value that the local player has to all other players. As one of the gamecache keys is different for each player it is effectively performing a local sync for every player in the game on a different location within the cache, which results in each individual player's value being distributed to all other players.

eg:
JASS:
local integer i = GetPlayerId(GetLocalPlayer())
call StoreInteger(gc, "blah", "bleh", i)
call SyncStoredInteger(gc, "blah", "bleh") //Will send the id of the host (usually) to all other players caches

//Result:
//GetStoredInteger(gc, "blah", "bleh") == 0 if red is the host
//...

local integer i = GetPlayerId(GetLocalPlayer())
call StoreInteger(gc, "blah", I2S(i), i)
call SyncStoredInteger(gc, "blah", I2S(i)) //Will send the id of every player to every other player

//Result:
//GetStoredInteger(gc, "blah", 0) == 0
//GetStoredInteger(gc, "blah", 1) == 1
//GetStoredInteger(gc, "blah", 2) == 2
//etc.
 

quraji

zap
Reaction score
144
@saw
That's what I suspected, thanks for clearing that up.

That still doesn't explain how this system is supposed to work :p
 

saw792

Is known to say things. That is all.
Reaction score
280
It's based on the theory that timer progress would be slightly offset from that of the host's due to net traffic, and thus by recording it locally you could then find the difference to find the latency. This means that while a timer may still be running on your local computer, a few ms earlier it may have expired on the host's computer. Or something...

Sounds plausible, right? :p
 

quraji

zap
Reaction score
144
It's based on the theory that timer progress would be slightly offset from that of the host's due to net traffic, and thus by recording it locally you could then find the difference to find the latency. This means that while a timer may still be running on your local computer, a few ms earlier it may have expired on the host's computer. Or something...

Sounds plausible, right? :p

Not to me, haha. That's why I'm waiting for Kingking or someone to say exactly what's going on because I just don't see it.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
It's based on the theory that timer progress would be slightly offset from that of the host's due to net traffic, and thus by recording it locally you could then find the difference to find the latency. This means that while a timer may still be running on your local computer, a few ms earlier it may have expired on the host's computer. Or something...

Sounds plausible, right? :p

It is something like that. :D

JASS:
call FlushGameCache(InitGameCache("GetLatency"))
        set gc = InitGameCache("GetLatency")
        
        if HaveStoredInteger(gc,"Host","Id") then  // Is there any host detected?
            set HostId = GetStoredInteger(gc,"Host","Id")//If there is, you are not the host.
        else
            set HostId = GetPlayerId(GetLocalPlayer()) //If no.. You are the host.
            call StoreInteger(gc,"Host","Id",HostId) //Save the value
            call SyncStoredInteger(gc,"Host","Id") // Sync the value to all players
        endif
        
        set Host = Player(HostId) // The is used to prevent desyncies
 

quraji

zap
Reaction score
144
Okay, I'm just going to flat-out say this will not get latency. Please refute me.
 

quraji

zap
Reaction score
144
:banghead: See the replay.

It will prove nothing, but I'll watch it anyways.

Edit: Watched it, numbers on a multiboard mean nothing to me when the concept still doesn't make sense. And I don't understand why you try to update so often both in the system itself and on the multiboard when gamecache syncing takes time. I thought it was odd that the value was always 375, 500 or 625. What's that mean?

Also, there should be more people in game..
 

Jesus4Lyf

Good Idea™
Reaction score
397
All he needs is a test with someone on lan, and someone in another country, and he can prove that it provides a measure of latency... what's in the replay, in that regard? Does it have in chat who is from where or something, and a clear demo of different latencies being returned for players who are further away?
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
I thought it was odd that the value was always 375, 500 or 625. What's that mean?
That the action windows in wc3 bnet hosted games grows with 125ms each time. Eg, the delay on bnet is always (250+125*n) ms. The 250ms is a fixed amount and the reason why lan and some bot hosted games doesn't have the same delay.

The code works somewhat like this:
[ljass]call StoreReal(gc,"Test",Number,TimerGetRemaining(GameTimer))[/ljass]
Wc3 stores a value in the gamecache (duh)

[ljass]call SyncStoredReal(gc,"Test",Number)[/ljass]
The jass engine tells wc3 that it needs some synced network traffic. Based on your recent _ping_ wc3 decides on what action window this action should occur. Eg, 0, 1, 2, 3 ... windows in the future. Your computer sends the action packet to the host, along with a number telling it in what action window this should happen. The host forwards it to all players. When the players get the packet, they wait until the corresponding action window happens.
Since action windows only happens each (250+125*n) ms it's impossible to get another _latency_ than that, this is true for unit orders and the such too.
In this context, latency is not the same thing as ping. Latency is a discrete value only loosely coupled to the ping.
Now, I'm not really an expert on how exactly wc3 syncs actions between different players so there might be some error in here :p
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Interesting way to sync local datas :thup:

Read the last comments :
JASS:
private function Update takes nothing returns nothing
        local integer i = GetPlayerId(GetLocalPlayer())
        //Magic! Does not desync!
        call StoreReal(gc,&quot;Test&quot;,Number<i>,TimerGetRemaining(GameTimer))
        //Store the value of timer.
        call SyncStoredReal(gc,&quot;Test&quot;,Number<i>)
        //Sync the value to other players&#039; gamecache.
        // it happens only one time when all local datas are synchronised, and not X times where X == number of human players ?
        // it might be like that but i just want to be sure
        // call BJDebugMsg(&quot;Sync done&quot;)
    endfunction</i></i>


Also what happens when the game is hosted with a "0 delay host bot" ?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Also what happens when the game is hosted with a "0 delay host bot" ?
Sounds interesting, mind to test it?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top