Hey, A Message Board
« Networking, Lag Compensation, and Hit Detection »

Welcome Guest. Please Login or Register.
May 26, 2013, 3:33am




Hey, A Message Board :: Call of Duty :: Hey, Den :: Networking, Lag Compensation, and Hit Detection
Page 1 of 6 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]
 AuthorTopic: Networking, Lag Compensation, and Hit Detection (Read 9,332 times)
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
 Networking, Lag Compensation, and Hit Detection
« Thread Started on Feb 4, 2013, 3:59pm »

Because Mousey shitposts a lot and you all deserve better from her

In not so recent developments, lag has taken the number one spot as a scapegoat for the average dickweed's death. So much so that people completely made up explanations as to how "lag comp screws you over" or whatever. On top of that, this bullshit is actually considered common knowledge in some places (gamefaqs, reddit, official forums, youtube, the list goes on). I'm sure that most of you have seen Den's quick post on lag compensation/anti-lag, but I'm going to expand upon that. I'm just trying to dispel some of the stuff surrounding that for the sake of this forum since I'm sure a good number of our users come from those sites i mentioned. Now keep in mind that I do not have any networking source code. This is going over the basics of a listen server alongside more gameplay related issues such as hit detection. It's important to note that while Treyarch and IW split off from each other at CoD4 (as in, both MW2 and W@W were modded from CoD4 and they've been modding their own game since then) there isn't really any evidence of them having changed the core networking mechanics beyond deciding hosts and organizing matches (there's a lot of speculation that black ops 2 has changed certain elements but no proof for now so I'll leave it at that). THAT BEING SAID, this is a fairly long read. The important points of each section will be printed in gold and key terms will be in green* for those of you who don't really care all that much.

*I apologize to the colorblind people who may have some trouble skimming because I picked green for keywords

Table of Contents
[1.0] How does networking work?
  • [1.1] Network Structure
  • [1.2] Transferring Data
[2.0] How does lag affect me?
  • [2.1] Latency, Jitter, Three bars, etc.
  • [2.2] Input Prediction
  • [2.3] Hit Detection and Lag Compensation
  • [2.4] Interpolation and Artificial Delays
[3.0] How does this come into play?
[*][2.5] Packet Loss
  • [3.1] Connection Discrepancies pt.1
  • [3.2] Connection Discrepancies pt.2
  • [3.3] Killcams
[4.0] Matchmaking
  • [4.1] Sorting players
  • [4.2] Hosts and Migrations




[1.0] How does networking work?

[1.1] Network Structure
[image]
Obviously multiplayer games need a system that is capable of transferring data between the players. Virtually all modern multiplayer videogames utilize Client-Server networking or Peer-to-peer networking. In the case of Call of Duty, it uses a certain type of Client-Server based network called a Listen Server. This differs from the standard Dedicated Server (The PC versions of BO2, CoD4, and W@W use this) in that a listen server hosts both the server and client in the same location. Listen servers are generally inferior to dedicated servers in every way except for price, because it is more stressful on a single system and is limited by the host's internet connection. To simply put it, Clients send data to the server, which then organizes it and sends it out to all of the clients simultaneously, which then use that data to generate the world. Here's a slightly closer look using the Quake 3 networking model:*

[image]
*The IW engine is based off of the Quake 3 engine along with countless other shooters. They have their distinctions but the basics are pretty standard.

THE SYSTEM WORKS AS SUCH:
So the Server or Host has a Master Gamestate. This is the "official" state of the game at any given time. The host will attach a sequence number and a timestamp onto it and send it out to the clients. This is called a Snapshot. When the client receives this data. It makes a copy of the master gamestate and saves it in its memory. The client will then compare the snapshots in memory to generate a game state. If the client doesn't have any "valid" snapshots in history (either the last timestamp was too long ago due to lag issues or it just has connected and hasn't received data yet) the client will compare the snapshot with the dummy snapshot, which has every value equal to zero. The client will at the same time send inputs from the player or game (movement, hit detection, etc.) to the Server. The client will also acknowledge that it has received the previous snapshot and tell that to the server. When the server receives this data from the clients it utilizes it to create a new master gamestate, and acknowledges each client that it received the data. Lather, rinse, repeat. *

[1.2] Transferring Data
The biggest setback of online gaming is that it has to obey the laws of physics. That being, data does not travel instantly. This causes major discrepancies in the actual game, but we'll get to that later (or skip to 2.1 if you don't give a fuck about how it works).

Now all games can choose to use TCP or UDP for data transfer. In short, TCP is very reliable at getting the information in its entirety and order from one location to another. However, the manner in which it does this is slow for various reasons. This is far too slow of a process in multiplayer games but it is perfectly fine for organizing matches, stat tracking, or pretty much anything that can afford to take more than half a second. UDP basically send the packet out with a destination stamped onto it and hopes it gets there; and it does that pretty well. The main issues with UDP is that packets tend to arrive out of order and it's quite prone to packet loss (around 1-5% of the data likely won't arrive). A good layman's comparison of the two can be found here (and it goes into more detail in the following articles).

So the game needs to use UDP for speed reasons. So developers have to find ways to get past its faults. Now for the first issue, which is packets arriving in the wrong order, the server assigns a sequence number to outgoing data. On the client side, if any data received has a sequence number less than that of the current sequence number, the data is trashed. This effectively keeps things in order. Packet Loss is handled by each packet containing an ACK or acknowledgement. The client and server use ACKs to tell one another that they have received each other's data. Obviously any important data that wasn't sent (and needs to be) is resent.

[2.0] How does lag affect me?

[2.1] Latency, Jitter, Three bars, etc.
Alright, back to a more macro-scale of networking. So we know that the main limit to online gaming is the sheer fact that data takes time to get from point A to point B. Latency is the time delay between these points. One way latency is the time taken to get from source to destination, while round trip latency is of course the time taken for data to go from the source, to the destination, back to the source. Jitter or Packet Delay Variation is the standard deviation in latency from the mean latency. Ping is a network utility for accurate determining latency, in which either a client or server sends a message to the other and awaits a response. The Latency Bars (or ping bars, whatever) display the results from one's most recent ping test to the host. It's a really simple system, really:

4 Bars = less than 100 ms of latency
3 bars = 100-200 ms of latency
2 bars = 200-300 ms of latency
1 bar = over 300 ms of latency

Now in a game like CoD, 100 ms of ping is a lot. When combined with interpolation (discussed in 2.4) and short kill times yields a significant delay in what a person does. Now that's not to say it isn't still accurate, (as far as hit detection goes, CoD is fucking fantastic for the shooter) just that poor connection has a huge influence on one's performance. I'm not going to be referring to connections as "four bars" throughout this because bars are fucking stupid and really only exist because a number is too complicated for some people.

[2.2] Input Prediction
Alright imagine the following scenario: You press the button that makes you move forward. Notice how your character instantly responds and moves forward himself. But how? After all, that data hasn't reached the server yet. This is the effect of Input Prediction. Input prediction realizes what the player will do before the information reaches the server and back to the client, and applies it instantly in order to smooth gameplay. Basically, Input prediction executes local commands instantaneously. The alternative here is for one to input a forward move, send that info to the server, which would send it back in the next snapshot, and then you would move. You'd be a clear split second behind everything you tried to do. This system allows the game to run fluidly for every individual client while having the side effect of one's commands being asynchronous with what the server is sending out in snapshots* (which will be more obvious in a bit).

*Of course you wouldn't be synchronized with the server anyway due to latency; however, without prediction you would receive your own inputs in the same manner that everyone else is getting them.

[2.3] Hit Detection and Lag Compensation
So, we know that input prediction makes the client asynchronous with the server, but how does that effect gameplay? Well the first major issue is with hit detection. Hit detection or hit authentication is the game's way of telling whether or not you've managed to actually hit your enemy. There are two main forms of doing this: Client Side Hit Authentication and Server Side Hit Authentication.

Client Side Hit Authentication means that each individual client keeps track of when it hits an enemy, and simply send the data of it being a hit to the server. The primary benefit of Client Side hit detection is that it is 100% accurate for the player shooting. The downside is that it's incredibly weak to lagswitches and hacking. It's entirely possible for a player to use a third party program to send a "hit" to the host without seeing a player or even firing your gun. Any player would be capable of using a lagswitch to its fullest extent.*

*at the moment, only the host can truly utilize a lagswitch because they are the ones sending data to the clients. If you're platinum or higher in league then you've likely seen this in action.

Server Side Hit Authentication is far more complicated. Let's take the following scenario:
[image]

You shoot at the guy on the left, because that's what you see. However the target is moving to the right. You aim, and shoot. Your console/PC sends your position, direction, and the fact that you shot to the server. Now lets say that you have a latency of something nuts like 200 ms. By the time that your command reaches the host/server, the target has moved to the spot on the right. But if the game utilizes the data exactly as you sent it, then it would register as a miss because there's no player there now. This is where Lag Compensation comes into play. Lag compensation effectively "rewinds time." It digs through its memory for a game state that matches the client's information and implements it under those conditions. This accounts for latency, interpolation, and anything else that creates a time delay that the game can manage to quantify. The benefits of Server side lag compensation are that it is virtually immune to things such as lagswitches and various hacks (however things such as god mode hacks and aimbotting would still work). The downside of course is that it's flat out not perfect. Modern day lag compensation is very accurate for what it's worth, but CoD sends data from each client at 30 states a second all the while running at close (or more in the PC version's case) to 60 FPS on each client. Small precision errors can still occur and have very unfavorable results.


It is fairly safe to assume that CoD uses either the above rewind-time system, or calculate player positions using sequence numbers. Sequence numbers are mainly used to keep packets in order, due to a flaw in UDP which can cause them to arrive scrambled. In terms of using them for synchronization, however, the host will create a snapshot 20 times a second and stamp a number on it (AKA "sequence Number"). That is sent out to every player, interpolated after a few, and used to generate their world. When your client sends out information back (done 30 times a second) it will put a sequence number on its own packet that matches the one used to generate the world. When the host/server receives this, then it will compare the sequence number on the packet received to a matching one in memory (which would obviously have everyone in the same locations accurately). This system is accurate as far as confirming hits goes, however it is obviously vulnerable to packet loss. if the packet being sent contains information of a hit, and is lost along the way, then there will inevitably be a delay before that information is re-sent.

On the server side, hit detection is accurate and lenient. Rest assured that if you shoot someone, then it will register as a hit. There are two exceptions to this rule, however. If the host receives information at any time that a player has been killed, then any more data it receives from that presumably dead player will not be sent to the other clients. Of course, due to latency, the server will realize that you are dead before you do. And if you were shooting someone, you are sending that information to the host. You can continue sending that information until that you receive notice from the host that you are, in fact, dead. This means that you can effectively tell the server that you have shot the enemy after the server knows that you've been killed. In order to stifle the inevitable BS that would come of that, the server will cut off all input that it receives from you until you respawn again. If someone plays halo online then they're probably familiar with two players killing each other simultaneously. However do to the quick-dying nature of cod, this would happen in nearly every head on encounter. This will be visualized later in 3.2. The second exception to the rule involves packet loss, which will be discussed in 2.5.

[2.4] Interpolation and Artificial Delays
One thing many players will notice when looking closer at connection issues is that players have artificial delays applied to them.*This is caused by interpolation. Interpolation stores snapshots and renders them a split second later in order to keep movement fluid. Take a look at the following graph:

[image]
The line represents the timeline of the game, with each segment depicting the time delay between snapshots. It is important to know that Real Time (Server), Real time (Client), and Current Rendering Time are all occurring simultaneously, but are all at different spots on the game's timeline. Starting from the right the server sends out a snapshot. As we know, there is a delay between when it is sent and when it is received by the client. When the client receives the snapshot, it stores it in memory. It does not render the snapshot instantly. More specifically it does not render that snapshot until it has another snapshot to compare it to. However then we have to remember that we are using UDP to transfer data. If we are only using the past two snapshots, then any packet loss whatsoever would cause choppy movement as the game would need to predict where enemies are heading in order to maintain a moving picture. Thus it is standard to have interpolation span at least three snapshots, or a 100ms "lerp" it is often called. The server sends data to the clients at about about 20 snapshots/second (and 30 packets/second from client to server), which means this creates an artificial delay of roughly 100 ms.

There is another artificial delay added to the host. Since CoD4 there has always been a (reported) 20-40ms artificial delay added to the host and clients*. If 51% of the clients have a ping higher than 110ms, then the average ping of all players will be added to the host.* Robert Bowling said that this was changed so that the host's latency was equal to that of the next lowest latency player, so take that as you will.

*going off toysrme's word here and don't have any variables/dvars/values for that. However testing in CoD4 showed this to be true.

There's another mechanic called extrapolation which predicts how the game will flow in a situation where too many snapshots were missed in a row to render a fluid scene. This is much less reliable for fluid movement and is rarely used for more than a fraction of a second in any game (if you have to extrapolate for over 250 ms then your connection's out of whack and there's no point).

[2.5] Packet Loss
Since a real time shooter like CoD is forced to use UDP, it is inherantly prone to packet loss. Now, as said earlier, data is sent from the server to the client 20 times each second and 30 times a second from client to server. Due to interpolation, missing one of these packets won't cause issues when rendering your in-game world. However, issues arrive when the exact packet containing information of a hit is dropped.

Now as said in 1.2, in order to compensate for potential packet loss, each packet sent contains an "ACK" or acknowledgement. Upon recieving information, the client or server will send out a response to the ACK to confirm that the information reached them. If the ACK is not responded to within a certain period of time, then the important information from that lost packet is added onto the new one. While this system does a good job of making sure missing information goes through, it is unfortunately not very fast. It will take at least the length of one's round trip latency before the client/server knows that a packet did not get through, and in most shooters, that is often too late.

While it is certainly possible for data to get lost on the way to its destination, bandwith can be a major factor in packet loss (and is also the only factor that you can do anything about). When there is not enough room for an incoming packet to be stored or transmitted, that packet will be dropped. While CoD doesn't use too much bandwith, having multiple appliances on the same internet connection can ovwerwhelm and stifle connection from your videogame, especially if those applications primarily use a TCP connection.

[3.0] How does this come into play?

[3.1] Connection Discrepancies pt.1
Input prediction and lag will cause players to be out of sync with each other. More specifically, each client will see the other players significantly behind themselves. The difference will basically be Time it takes for the data to reach the server + Time taken from snapshot to reach another client + The time delay caused by interpolation. This stacks up to make a pretty big difference. When mixed with the fact that hit detection is designed to work properly from the shooter's perspective, this causes some wacky effects. The first major one comes from coming in and out of cover. In both these pictures: You are Red (your perspective), the enemy is Blue (his perspective), and the place where you see the enemy is on your end is a blue shadow.

Running into cover
[image]

In this situation, we have an enemy who is running away from you as you are shooting him. On his end, he has turned the corner, safe from your view. However, due to lag, the last snapshot to be rendered on your system was when he was a split second behind. due to the fact that you can act instantly and that hit detection is client side, your shots will register shooting him even though in real time on his client, he is out of your view. If you've been on the bad end of this (and you almost certainly have) you'd notice that you can actually travel a fair distance behind cover. This isn't as "bullshit" as it seems simply because for half of this time, you were already dead, your client just hadn't gotten word of it and thus input prediction allowed you to move because as far as it was concerned, you were still alive.* In actuality the difference is more reasonable and it just looks worse because the information had to get back to you.

It's important to note that this is simply dependent on a connection discrepancy. It doesn't matter who has the better connection on either side because the latencies of the players involved stack together. You do need to acknowledge the fact that in CoD, if either you or the opponent is lagging, then they have a window of opportunity after you take cover to kill you.

*it ends up being the time to send your location at time of death to server + latency between server and client + interpolation + sending it back to server + sending it back to you. Long time. Very silly. Looks weird. will visualize in 3.2

Coming out from cover
[image]

In this scenario, you are camping. Enemy comes around the corner and starts shooting you. On your end of the spectrum, he hasn't come around the corner yet. Basically, he sees you before you see him simply because he is moving into the room and you're already there. Once again, hit detection favors the attacker in this engagement; and once again, the significance is a result of the two players' combined latencies. When playing, especially on a poor connection, it's important to remember that you can manipulate this fault in networking to your advantage. However it's not consistent or reliable so it's not some be-all end-all trick either.

[3.2] Connection Discrepancies pt.2
Now I'm going to show what happens in a head on engagement, not involving cover. Let's assume that me, aidsaidsaids, and kirbyderby are all playing a free for all match; and for the sake of this, we're going to assume that there is no interpolation and that the following values are realistic (interpolation would obviously be present, but it would add more frames to the scenario and the point gets across without it).
[image]
Alright, so Kirb is the Host. Aids has a latency of 100ms and Mousey has a latency of 200ms. For all practical purposes this is one way latency. Review the following silly drawing:
[image]

In this, Mousey and Aids have come across one another. Mousey has started to attack aids a little earlier than vice versa, and the server has recognized this.

[image]

In this you can see that Aids and Kirb and responding fairly quickly to one another. The host has recognized that Aids started to aim and aids has acknowledged Mousey beginning to knife.

[image]

Now let's assume that both Mousey and Aids killed one another simultaneously in real time. On both of their screens they have gotten a killing blow, but neither of that information has reached the host yet, so they will still be seeing (and executing commands) that they receive from the other players until the host has acknowledged this. Input prediction does not predict another player's death (obviously) so the server must confirm it. Also, neither players would receive a hitmarker on these hits until the server confirms it; Mousey would hear the sound of the knife stabbing, however.

[image]

Kirb receives the information from Aids saying that Mousey is dead. His system would immediately stop sending any information it receives from Mousey (including the upcoming knife) until she respawns. Neither Mouse nor Aids has received this confirmation that Mousey is dead and thus they are still alive on each other's clients.

[image]

Aids receives information that Mousey is dead and he stops shooting. Kirb is still receiving information from Aids that he is shooting (as he was until the death was confirmed). Mousey is just now receiving information that aids is shooting, which looks silly and weird after he has been knifed.

[image]

Mousey now receives the info that Aids has killed her. She immediately warps back to the place of death as it was on the server. The death would have seemed instantaneous and silly. If she had been shooting, then there would have been a period of where it appeared that bullets were hitting Aids but without hitmarkers to confirm them, simply because of how significant the delay is. The host would stop confirming that information the moment it acknowledges someone having killed her. Mousey would also have never received a hitmarker from the knife, as the host would never have confirmed the hit. Being on the bad end of a laggy connection will give you a serious disadvantage in all head on fights (but I'm sure you already knew that ;)).

[3.3] Killcams
Alright, so we saw that little frame by frame silliness that would show how it would appear from each player's perspective. Now let's see that in motion.

[image]
*this is probably how choppy your game would look if you didn't have interpolation

The killcam that Mousey would see would be from the host's perspective of what happened. You may notice that while it doesn't seem like much of a laggy mess as Mousey's perspective, it seems fairly quick for what it's worth because it doesn't have the delay that aids really saw due to latency. Killcams also do not show precise readings of where people shot or were looking at. They are shown at most 20 states per second and thus are being rendered on your client on a fraction of the information present from the shooter's perspective. Any video you see that is using killcams as an example for anything is worthless information (unless of course, they are trying to show that killcams are inaccurate).

[4.0] Matchmaking
[4.1] Sorting players
The matchmaking and hosting systems are the two networking elements that IW and Treyarch has actually put some serious effort into making better. As far as finding games, it's supposedly been really simple in the past (starting with mw2, when it comes to cod4 nobody knows how the hell it decided hosts and such).

Starting in MW2, a client searches for available games that reveal a ping of under 50ms. Your system then searches those games and deems if you're suitable to join or not (through whatever criteria are in place). If no suitable games were found, then it would increase the threshold by 10ms and search again. It has a cap so that you'll never be put into a game that reads 800ms, but that's pretty high up there. It seems to work this way up through MW3 but I'm unsure.

Not too long ago, Activision released an article on how public matchmaking puts players into games. The system basically boils down to:

1. Find "suitable" games within a certain proximity
2. Eliminate games that are outside the player's skill bracket
3. Choose the one with the lowest ping.

According to the article, the game puts a lower priority in getting you into a game with the best connection than previous titles did. Take that as you will (or read the article at least).

Black Ops 2 includes search preferences as well. I do not know what the specifics of each option are (though "Best," "Normal," and "Any" are pretty straightforward) Vond has mentioned in a tweet that sorting by "best" places an upper cap on what the matchmaking system will find to be an acceptable latency for you (though the context tweet no longer exists).

[4.2] Hosts and Migrations
The hosting system is the other thing that the devs actually put some effort into regarding networking.

According to posts by toysrme (the default values for many variables are present in these), CoD4 and World at War use an unknown system to determine host. Since then, the systems works as such:

Cod4 and onward:
The host will constantly be pinging its clients. A player is "unhappy" if their ping shows to be above 400ms. In order for a host to change, at least three players must be in a game, and more than 51% of the clients need to show that they need to be unhappy. If this yields true for 300 network frames (at 20 snapshots/second this means for 15 seconds), then the game will be dropped (Cod4/W@W) or the host will be migrated* (MW2 and onward).

*if someone is lagswitching and a migration occurs, then they suck at lagswitching

MW2:
MW2 introduced host migrations. The first host is chosen with a bandwidth race (see toys's post for specifics). This is done every time the host changes, which is done every time the old host leaves, a lobby merges, or if the host is not "suitable" for the game. Any time that the game would be dropped in CoD4, MW2 forces a host migration. If a migration takes longer than 40 seconds, the game is ended.

Black Ops:
Black Ops is nearly the same as MW2, however it runs the bandwidth test every time you sign into matchmaking to save time.

Could not find anything on MW3 or BO2. Feel free to shed some light if you know.



It's important to have realistic expectations. CoD runs on an old engine with network rates that became obsolete a decade ago. People die quickly. Lag is erratic and unreliable. She'll tell you she loves you and then kick your dog. It will help you and it will hurt you. It's gonna be there and there is nothing you can do to change that. Of course there are things you can do to mitigate connection issues, and it's particularly easy in the earlier PC versions, but that's a whole different topic. I'm not gonna tell you how to build a lagswitch or anything either. You're all big girls, you can figure that one out.


EDIT: Thread with commentary from an ex-developer on the subject
« Last Edit: May 6, 2013, 4:55pm by Mousey »Link to Post - Back to Top  IP: Logged
mmacola
True Bro
member is offline

[avatar]

the brazilian guy



Joined: Dec 2011
Gender: Male
Posts: 1,912
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #1 on Feb 4, 2013, 4:00pm »

first

Feb 4, 2013, 3:59pm, Mousey wrote:
Now lets say that you have a latency of something nuts like 200 ms.

My regular latency :(
« Last Edit: Feb 4, 2013, 5:05pm by mmacola »Link to Post - Back to Top  IP: Logged
markopolo
True Bro
member is offline

[avatar]

Am I tactical loitering with a LMG? Run out into the open and find out!!!



Joined: Nov 2012
Gender: Male
Posts: 747
Location: Wpg, Mb, Canada
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #2 on Feb 4, 2013, 4:15pm »

I woas going to make some crude Tl;DR joke....

But I did read it....

nice
Link to Post - Back to Top  IP: Logged
APOCALYPSE
True Bro
member is offline

[avatar]

Soviet power supreme



Joined: Jan 2013
Gender: Male
Posts: 106
Location: Baytown,TX
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #3 on Feb 4, 2013, 4:55pm »

Non-ironic golf clap.
Link to Post - Back to Top  IP: Logged
Slick
True Bro
member is offline



CoD doesn't suck, the community does.



Joined: Aug 2012
Gender: Male
Posts: 582
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #4 on Feb 4, 2013, 5:02pm »

Recommend sticky.
« Last Edit: Feb 4, 2013, 5:02pm by Slick »Link to Post - Back to Top  IP: Logged
zeroix
True Bro
member is offline

[avatar]

The Truth



Joined: Feb 2011
Gender: Male
Posts: 1,139
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #5 on Feb 4, 2013, 5:58pm »

Well that sealed the deal

I'm in love with maus
Link to Post - Back to Top  IP: Logged
bucket415
True Bro
member is offline

[avatar]



Joined: Nov 2012
Gender: Male
Posts: 399
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #6 on Feb 4, 2013, 6:48pm »


Feb 4, 2013, 5:02pm, Slick wrote:
Recommend sticky.
Link to Post - Back to Top  IP: Logged
KingVaroon
True Bro
member is offline

[avatar]



Joined: Dec 2009
Gender: Male
Posts: 10,592
Location: California
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #7 on Feb 4, 2013, 7:35pm »

What's up with the color scheme? I thought Den wears green and Mousey wears pink. Why is Mousey wearing Den's clothes????
Link to Post - Back to Top  IP: Logged
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #8 on Feb 4, 2013, 7:36pm »

it's my OpFor color palette.


« Last Edit: Feb 5, 2013, 8:55am by Mousey »Link to Post - Back to Top  IP: Logged
Usagi
True Bro
member is offline

[avatar]

Our whale cannot be stopped.



Joined: Dec 2011
Gender: Male
Posts: 736
Location: Pennsylvania, United States
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #9 on Feb 4, 2013, 7:36pm »

Cool beans.
Link to Post - Back to Top  IP: Logged
probaddie
True Bro
member is offline

[avatar]

Now with 25% more "pro" and 33% less "baddie"



Joined: Dec 2011
Gender: Male
Posts: 10,394
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #10 on Feb 4, 2013, 8:05pm »

Cheers on the excellent post. Six stars out of six. (Why out of six stars? Because cabbage, that's why.)
Link to Post - Back to Top  IP: Logged
UrbaneVirtuoso
True Bro
member is offline

[avatar]



Joined: Mar 2012
Posts: 11,391
Location: Land of Canucks.
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #11 on Feb 4, 2013, 8:41pm »

And I thought those anti-lag compensation videos on CoD4 were enough -- this takes the cake if people hadn't seen it before.

Good job. :3
Link to Post - Back to Top  IP: Logged
mw2baller
True Bro
member is offline





Joined: Dec 2011
Gender: Male
Posts: 608
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #12 on Feb 4, 2013, 11:00pm »

cod4 had the whole pseudo-bullet-travel effect so i'm pretty sure that's what caused a lot of earlier hit detection complaints.
Link to Post - Back to Top  IP: Logged
tiesieman
True Bro
member is offline

[avatar]

Shotgun midget



Joined: May 2011
Gender: Male
Posts: 962
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #13 on Feb 5, 2013, 6:21am »

you did a pretty gosh darn golly gee whiz good job explaining that mus
Hopefully some people will begin realise that there's just no viable workarounds to lag.


Do have a question about gamestates which toys talked about (how it's significantly lower on consoles). If anyone knows, what do these gamestates/rates affect? Buffer times? Delays between the client/server?
Link to Post - Back to Top  IP: Logged
Farslain
Bro
member is offline





Joined: Feb 2013
Gender: Male
Posts: 2
Location: England
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #14 on Feb 5, 2013, 7:05am »

That was an excellent write up, thanks for taking the time to produce it!

Quite a lot of that stuff was new to me, so I thought I'd de-lurk to show my appreciation.

I'm curious what peoples thoughts around here are concerning videos that address lag comp as a 'thing' are, like ovenbakedmuffin's vid I watched a month ago?

http://www.youtube.com/watch?v=ZoFnIckyoxg

Link to Post - Back to Top  IP: Logged
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #15 on Feb 5, 2013, 8:25am »


Feb 5, 2013, 6:21am, tiesieman wrote:
Do have a question about gamestates which toys talked about (how it's significantly lower on consoles). If anyone knows, what do these gamestates/rates affect? Buffer times? Delays between the client/server?


The main things are that:
1. data transfer won't be as accurate. since hit detection is client side this doesn't really matter, but killcams won't show things accurate at all.
2. the delay for interpolation must be higher to account for packet loss.


Feb 5, 2013, 7:05am, Farslain wrote:
That was an excellent write up, thanks for taking the time to produce it!

Quite a lot of that stuff was new to me, so I thought I'd de-lurk to show my appreciation.

I'm curious what peoples thoughts around here are concerning videos that address lag comp as a 'thing' are, like ovenbakedmuffin's vid I watched a month ago?

http://www.youtube.com/watch?v=ZoFnIckyoxg


I'll be honest I deliberately avoided listing OBM's video because it's only partially correct. It certainly does a good job of showing that BO2 handles local networking differently than MW2, and does show that input prediction will cause a player to be significantly ahead on their own screen than where other players will be seeing them, but it kind of stops there.

First, a roughly ~50ms delay is nothing new to CoD (its lower but there if you host a listen server on cod4 PC). And the extra 100ms delay for the local client could be explained by the delay caused by interpolation.

HOWEVER there really is no reason that interpolation is necessary on a local/system link connection. I will say that it's my own assumption though (I don't like the idea of a random 150ms delay for no discernible reason). So blops2 must have changed something.

But I mean the fact that he gets a consistent 100ms delay for all clients is pretty telling. The host getting a consistent 45ms delay is fairly consistent with the artificial ping that's been present since CoD4. Though at 20 states a second it's not going to be accurate if you measure it first hand with fraps/capture card.

And then we get to about 3:00 and he says "Authoritative movement interpolation does not occur in black ops 2 until a ping of over 800ms, and extrapolation is not used to counteract this choice."

Now FIRST OFF, if that was the case, then this would probably be the choppiest game on earth. You'd literally see people warping to adjust position every 3 frames.

He says that interpolation "prevents running ahead with the side effect of rubberbanding" in a little caption. Where effectively, it allows people to run further ahead than what they see since everyone is waiting an extra 100ms to render shit. Rubberbanding is just caused by high latencies/packet loss, where the host's data has become significantly different than a client's data for whatever reason and needs to adjust accordingly.

He lists extrapolation properly so I'll give him that.

He makes out the issue involving going to and from cover sound like a problem due to lack of interpolation (which it has), where it's unavoidable in any game that has input prediction.

So I mean he's basing a lot of his stuff off of information that he doesn't understand. "the lack of interpolation causes a signficant advantage for players turning corners," bleh. And then he ends up saying that the blame can fall on lag compensation which is funny because he quotes valve's article on lag comp which explicitly explains why it has nothing to do with this crap. Whoo! It's certainly not as tinfoil hattish as his MW3 video on the subject, and definitely isn't completely wrong. I'm happy you posted that though because I did want to go over it (though not in the main post).

Edit: Toys puts it better than I do.
« Last Edit: Feb 7, 2013, 9:45am by Mousey »Link to Post - Back to Top  IP: Logged
danoski666
True Bro
member is offline

[avatar]

"Constistency: Thats my shizz, nigga!"



Joined: Jun 2012
Gender: Male
Posts: 2,480
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #16 on Feb 5, 2013, 8:52am »

Yargh, this be fine post m8ey.
Link to Post - Back to Top  IP: Logged
Brick2urface
True Bro
member is offline

[avatar]

Putting the "laughter" back in "slaughter"



Joined: Feb 2012
Gender: Male
Posts: 1,598
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #17 on Feb 5, 2013, 9:27am »

Aren't you in college? When the Foxtrot did you have time for this?
Link to Post - Back to Top  IP: Logged
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #18 on Feb 5, 2013, 9:30am »

The same time everyone else has to actually play the game.

Unlike you I'm not triple majoring in shit like nuclear shotgunning though.

To be fair I spread out making this bit by bit for like....two weeks. The majority of that being the pictures.

« Last Edit: Feb 5, 2013, 9:34am by Mousey »Link to Post - Back to Top  IP: Logged
bucket415
True Bro
member is offline

[avatar]



Joined: Nov 2012
Gender: Male
Posts: 399
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #19 on Feb 5, 2013, 9:34am »

Mousey,

Do you stand by your previous statement that the differences we've (COD community) noticed, in regards to the "lag comp" issues from COD4 / W@W / MW2 vs BLOPS / MW3 / BLOPS2 are strictly related to the removal of Stopping Power? Because it looks like you are agreeing that there is a difference in the netcoding.

I can live with a few lag issues. I do understand that they are going to happen in an online game. What I can't really live with is the consistency of the completely bullshit deaths that these lag issues cause. Its like the system changed from the old games, where 90% of the games ran smooth and 10% had lag issues, to now, 90% of the games have lag issues and only 10% run properly.

Has the addition of theater mode, COD casting, the additional tracking of ridiculous stats (distance fallen, average altitude, etc) helped create these new lag problems?
Link to Post - Back to Top  IP: Logged
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #20 on Feb 5, 2013, 9:48am »

I'll be honest back in boston I can't get a decent connection for the life of me (forced to use wireless from a crappy location due to how the house is wired). And I still played Mw2 more than any other cod and will absolutely stand by that lag issues are still prominent as hell. So yeah, I'll still stand by SP being a major component of it appearing more fluid.

I won't say that it's strictly related to that though. another thing is that aim assist has supposedly changed as well in BO2's case. Changing the hosting system could have adverse effects I'm sure (I wouldn't be able to explain what, really though.) And despite that they haven't changed the networking in previous games, it wouldn't be the first time that they changed stuff that has been the same for years.

so I don't know for sure. I base that claim off of personal experience so take it as that.
Link to Post - Back to Top  IP: Logged
Lexapro
True Bro
member is offline

[avatar]

PSN: Lexa_pro



Joined: Dec 2009
Gender: Male
Posts: 841
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #21 on Feb 5, 2013, 10:17am »

Great read, would like some sources and citations though.

You know, before I spread the word.
Link to Post - Back to Top  IP: Logged
Dumien
True Bro
member is offline

[avatar]

Don't Look Into Its Eyes



Joined: Dec 2011
Gender: Male
Posts: 1,547
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #22 on Feb 5, 2013, 11:25am »

Your best post Mouse.

Excellent job. Easy Read.
Link to Post - Back to Top  IP: Logged
timeitself
True Bro
member is offline




[homepage]

Joined: Jan 2012
Gender: Male
Posts: 47
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #23 on Feb 5, 2013, 11:37am »

Nice post. Thanks for the very through explanation.

I'm guessing the whole blopshot (kill from second chance with primary weapon) was due to the way client side hit detection works. Makes a lot more sense with this info.

But I'm still wondering what the differences are in black ops 2. It certainly feels different. Playing on a three bar feels as bad as a 2 bar from the previous games. I notice many more instances of rewind lag comp. Hearing more than lethal damage fired at an enemy who kills me. Maybe there isn't a difference, maybe there is one but not so much related to lag comp? Any idea why the ammo counter isn't in sync with the firing animation? Can we assign any significance to how long it takes to update?
Link to Post - Back to Top  IP: Logged
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #24 on Feb 5, 2013, 11:47am »


Feb 5, 2013, 10:17am, Lexapro wrote:
Great read, would like some sources and citations though.


CVAR/DVAR list for reference. compare to cod4 for instance.

Definitions are sourced in context.

cod using a listen server - duh

Engine being based off of idtech3 engine. I can't find an official statement but searches say that absolutely everywhere. Also listed in any quake family tree picture you may find. I did mention in context that CoD isn't exactly the same but is based off of the same networking model. I did also mention in the first paragraph that I am making the assumption that the core networking model hasn't changed. id software is also still cited in the credits.


Quake 3 networking model - sourced in context, also can check this for another account of basic networking.

Using UPD - duh, though there is a link to explanation of how it works is in context

Ping bars: cg_ScoresPing_Interval "100"

input prediction - duh. but there is a command cl_nopredict that turns it on and off

Hit detection is where only first major assumptions come in. Obviously there must be some sort of server side authentication going on simply because of how, no matter how many hackers flooded MW3, they still had to physically shoot you to kill you. Client side assumption comes from the fact that the game runs faster than the network (20/30). The fact that you can see killcams in which people straight up miss would show that the networking isn't accurate enough to utilize complete server side hit detection. Battlefield uses a similar system of CSHD authenticated on the server. BUT YOU ARE RIGHT in that I do not have an exact source for this so you can leave it at that. You'll find plenty on CoD4 using a client side hit detection model but I will be honest I didn't find any hard coded proof, maybe someone else has some. I'll mention this in that section because I shouldn't be stating it as fact.

Hitermarker needing to be authenticated by the server - tested at ~800 ping and locally.

Network rates (20/30): snaps 20, cl_maxpackets 30

Interpolation has to be used because the game runs incredibly fluidly (as in, people aren't warping 20 times a second), with the only alternative for that being predicting the future (not far fetched really, but no game does it accurately and typically only uses extrapolation to hide packet loss issues and keep the interpolation delay low). You receive snapshots every three frames. It would be incredibly noticeable, especially when slowing a recording down using fraps or whatever.

Connection Discrepancies - common knowledge just because of how latency even exists, but this mentions things on it along with his more detailed paper on lag compensation here, and of course there's a wiki for everything but im not a fan of wikis. The whole two sections just show how input prediction and latency cause people to be out of sync with each other.

Matchmaking/hosting stuff:

cl_maxPing 800 - highest ping to search for
sv_maxRate 25000 - preffered banwidth rate
starting search ping cap as 50 - party_msPerTier "50," also can be seen by searching for any game once.

badhost_maxDoISuckFrames 300 - game ends/host changes if host is bad for 300 network frames (snapshots)
badhost_maxHappyPingTime 400 - players are considered unhappy if over 400ms
badhost_minPercentClientsUnhappyToSuck 0.51 - 51% of clients need to be unhappy for the host to "suck"
badhost_minTotalClientsForHappyTest 3 - host wont change/end unless there are 3+clients in a game


Activision article sourced in context along with vond tweet.

Bandwith test info:
Code:
authServerName "cod4master.activision.com"
badhost_debug "0"
badhost_endGameIfISuck "1"
badhost_maxDoISuckFrames "300"
badhost_maxHappyPingTime "400"
badhost_minPercentClientsUnhappyToSuck "0.51"
badhost_minTotalClientsForHappyTest "3"
band_12players "384000"
band_18players "580000"
band_2players "64000"
band_4players "128000"
band_8players "256000"
bandwidthtest_announceinterval "200"
bandwidthtest_duration "500"
bandwidthtest_enable "1"
bandwidthtest_fudge "1"
bandwidthtest_ingame_enable "1"
bandwidthtest_ingame_fudge "1"
bandwidthtest_maxpacketsize "1000"
bandwidthtest_quota "0.5"
bandwidthtest_rounds "10"
bandwidthtest_scalar "2"
bandwidthtest_timeout "1500"



If i forgot something just say so.

« Last Edit: Apr 10, 2013, 1:56pm by Mousey »Link to Post - Back to Top  IP: Logged
[4fun]TheTJY
True Bro
member is offline

[avatar]

The casual gamer



Joined: Apr 2012
Gender: Male
Posts: 190
Location: Nordic countries
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #25 on Feb 5, 2013, 11:52am »

Errr I'm not sure if you have this in that huge post, but you could add one thing on that second picture of part 3.0. There was some video floating around this board that showed the broken playercamera. Some guy tested this on split-screen and called it local lag compensation, so you should mention that is not the case. Essentially, the guy who came out of cover from crouch or behind a wall could shoot first without being seen. It could explain some corner bullshit and getting killed by invisible snipers.
Link to Post - Back to Top  IP: Logged
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #26 on Feb 5, 2013, 11:59am »


Feb 5, 2013, 11:52am, [4fun]TheTJY wrote:
Errr I'm not sure if you have this in that huge post, but you could add one thing on that second picture of part 3.0. There was some video floating around this board that showed the broken playercamera. Some guy tested this on split-screen and called it local lag compensation, so you should mention that is not the case. Essentially, the guy who came out of cover from crouch or behind a wall could shoot first without being seen. It could explain some corner bulldoo-doo and getting killed by invisible snipers.


It's mentioned right in 2.4

That camera thing is a little wonky just because the delay you see is still plenty more than what you should expect on a local connection, but yeah calling it a broken camera is stupid.
Link to Post - Back to Top  IP: Logged
[4fun]TheTJY
True Bro
member is offline

[avatar]

The casual gamer



Joined: Apr 2012
Gender: Male
Posts: 190
Location: Nordic countries
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #27 on Feb 5, 2013, 12:04pm »

Foxtrotting hell, more technical mumbo-jumbo. Did you learn this on free-time or did you study this? Nicely made post BTW. The pictures really help me to understand some things.
Link to Post - Back to Top  IP: Logged
otisman666
True Bro
member is offline

[avatar]



Joined: Jan 2012
Gender: Male
Posts: 299
 Re: Networking, Lag Compensation, and Hit Detectio
« Reply #28 on Feb 5, 2013, 12:22pm »

Wow, even to a common finance guy like myself, this almost makes sense. Really nice write-up. Seriously, A+++

On the down side, I regret to inform you that I have a sneaky suspicions some of the Youtube heroes won't be sending you Christmas cards next year.
Link to Post - Back to Top  IP: Logged
Mousey
True Bro
member is offline

[avatar]

estrogen high



Joined: Dec 2010
Gender: Female
Posts: 9,980
Location: aroo
Posted using the ProBoards Mobile AppRe: Re: Networking, Lag Compensation, and Hit Dete
« Reply #29 on Feb 5, 2013, 1:29pm via the ProBoards Mobile App »


Feb 5, 2013, 12:04pm, [4fun]TheTJY wrote:
Foxtrotting hell, more technical mumbo-jumbo. Did you learn this on free-time or did you study this? Nicely made post BTW. The pictures really help me to understand some things.

free time. Hence why i added that little tidbit on the end in case someone more knowledgeable noticed any glaring errors. mean its really basic networking stuff. I just figure that since the forum is pretty technical that there might as well be a large thread on the subject.
Link to Post - Back to Top  IP: Logged
Page 1 of 6 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]

Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!
Terms of Service | Privacy Policy | Notice | FTC Disclosure | Report Abuse | Mobile