How often are networked variables updated? Or, are they only updated when they are changed?
They're updated when they're changed. However, when a player joins it'll spam it to hell and back.
Thanks, thats exactly what I needed to know.
I thought they updated automatically every 30 seconds?
[QUOTE=iRzilla;26211964]Who told you this? I've never heard that before.[/QUOTE]
I've heard this, but I wasn't sure if it was true or not.
[QUOTE=CmdrMatthew;26211998]I've heard this, but I wasn't sure if it was true or not.[/QUOTE]
Well now you know, huh?
[QUOTE=|FlapJack|;26205139]However, when a player joins it'll spam it to hell and back.[/QUOTE]
What do you mean? They will be sent multiple times to the same player, or sent to every player?
I think he means if a player joins, he will get spammed to fuck with everyones vars who are already on the server.
[QUOTE=Nevec;26218159]What do you mean? They will be sent multiple times to the same player, or sent to every player?[/QUOTE]
They get sent to the player every 30 seconds even if the value hasn't changed.
So I was correct?
[QUOTE=blackops7799;26221961]They get sent to the player every 30 seconds even if the value hasn't changed.[/QUOTE]
But why? Does it have something to do with compensating UDP's unreliable nature? (Hell do they even use UDP?:confused:)
[QUOTE=iRzilla;26224900]Because it's a MP game. Lots of packets are being sent such as movement. It doesn't need to be 100% accurate.[/QUOTE]
But health and money needs to be accurate.
So, what's the point in sending them every 30 seconds, and why hasn't garry fixed that?
Networked vars are only "updated" when they are changed, but they are checked for changes very frequently. That is to say, you won't get network lag by having a bunch of networked vars, but it gets very expensive to loop through tons of them multiple times to check if they [i]should be sent[/i] every second.
[QUOTE=iRzilla;26225147]Valve don't need money ingame, mostly everything is predicted clientside in Source games anyway. And the chances of inaccurate packets in UDP are quite low tbh.[/QUOTE]
I though nwvars are garry's.
[QUOTE=Nevec;26225213]I though nwvars are garry's.[/QUOTE]
I think they interface with a Source engine feature.
[editline]22nd November 2010[/editline]
I was asking garry about them a while back. I saved a chat log.
[code]
Tuesday, July 13, 2010
8:07 AM - Grea$eMonkey: Hey garry, quick question about networking in GMod. I heard somewhere that NWVars are syncronized on the client on a per-request basis. Is this true?
8:11 AM - garry :D: what does that mean
8:11 AM - garry :D: the clioent requests it?
8:11 AM - Grea$eMonkey: Yeah
8:12 AM - garry :D: it does that sometimes, just liek it does with all the vars in normal hl2
8:12 AM - garry :D: like when starting to record a demo
8:12 AM - garry :D: or when joining a game
8:12 AM - garry :D: or when lagged out and recovering
8:12 AM - garry :D: but thats for all vars, not just a single bar
8:12 AM - garry :D: var
8:12 AM - Grea$eMonkey: What does it do the rest of the time?
8:13 AM - garry :D: sends on change
8:13 AM - Grea$eMonkey: So does it store it in a temporary cache or something?
8:14 AM - garry :D: ?
8:14 AM - Grea$eMonkey: Well I'm working on a networking system as part of a base gamemode and trying to find ways to make it more efficient.
8:15 AM - garry :D: when the var is set on the server, it goes hey, this isn't the same, mark it as changed
8:15 AM - garry :D: then every 0.1 seconds or whatever, it goes through them all, and if its marked as change it sends to all clients, then marks it as unchanged
8:16 AM - Grea$eMonkey: Ah, I see.
8:21 AM - Grea$eMonkey: thanks for the help. :)[/code]
informative
That could probably be improved upon.
[QUOTE=Disseminate;26233968]That could probably be improved upon.[/QUOTE]
That's basically what I was doing with Narwhal's Networking system. The concept is all there, and it's wayyyy more efficient that GMod's NWVars.
Sorry, you need to Log In to post a reply to this thread.