Here I'll try to explain how antilag works to the best of my ability and try to answer any questions people might have. I will update/expand this post when I see the need for it and when I have the time.
Changes in antilag implementation
The version of antilag that was on the servers for the last six months had a lot of bugs and issues that have now been fixed in a new version. This new version has been in use since 29.4. on wargamez.dk, qw.intarweb.dk, troopers.fi and quakeworld.fi. Other servers might still have the old buggy antilag implementation.
So please do not confuse the past issues with the current ones.What is antilag?
Antilag is a server side feature that compensates for lag when players are shooting with instant hit weapons (SG, SGG, LG). Other weapons are not affected, movement or anything else is not affected.
Without antilag a hitbox is used that is not in the place where the attacker saw the enemy when he made a shot. This means that you need to predict your opponent's movement and aim some amount "ahead" of him depending on your ping.
When antilag is used the server notes how much the attacker's view of the enemy was lagged and uses an "old" hitbox. This means that regardless of the ping the attacker can aim directly at the enemy he sees on his screen.
The trade-off with antilag is that from other players point of view the attacker will be shooting to a location where the enemy previously was, not where he currently is.
The reason antilag is a good idea is that the trouble and change in how you need to play the game when you have to predict your opponents movement even a little bit is big. While the trouble and change in how you need to play the game when you see other player shoot to a location where the you or or other player previously was is much smaller.A picture is worth a thousand words
Here is a picture that tries to demonstrate how things look from different perspectives. There are three black boxes, they signify the position of the person getting shot at (victim) as seen by different computers when they get the knowledge about a shot being fired.
The bottom black box is the position of the victim on the attacker's screen when he makes the shot.
The middle black box is the position of the victim as the server sees it when attacker's shooting command reaches the server.
The top black box is the position of the victim as he himself sees it, when the server's message about a shot being fired reaches him.
The bottom gray box is where the attacker's client would draw the victim at if there would be no prediction of other players.
In this specific example the victim has 38 ms
ping and is moving to the right with the speed of 320 ups
(normal strafing speed). The attacker has 64 ms
Without antilag the hitbox used is the one in the middle.
With antilag the bottom black box is used instead.
In the old implementation of antilag (used up until 29.4., might still be on some servers) the bottom gray box was used.
The size of the boxes is 32 u * 56 u, the actual hitbox size in QW.
The letters signify different distances needed to create this picture:A:
The amount client predicts opponent movement. 13 ms with 13 ms ping and 20
ms with higher pings. Predicted time * Victim speed.
In this example: 0.02 s * 320 ups = 6.4 u.B:
Difference between where attacker saw the enemy on his screen when shooting and where server sees him when the command gets there. (Attacker ping - Predicted time) * Victim speed.
In this example: (0.064 s - 0.02 s) * 320 ups = 14.08 u.C:
The amount that the victim has predicted it's own position compared to the server once he gets the information about the shot. Victim ping / 2 * Victim speed.
In this example: 0.038 s / 2 * 320 ups = 6.08 u.
Given these formulas, you should be able to create a picture with any pings and any victim speed that you like. As an another example you can look at a reversed situation
where 38 ms player is firing at 64 ms player who is strafing to the right with the same speed of 320 ups.F.A.Q.Is hitting with 13 ms with antilag easier than without antilag?
No. If you create a picture like the one above for 13 ms, you will see that the bottom black box and the middle black box end up in the same place. With the old implementation of antilag it was easier to hit with antilag enabled, because the gray box is not at the same position as the middle black box even with 13 ms pings.If the enemy is in my crosshair will I always hit?
No. There are two things that might make you miss. Prediction of your own position and prediction of the enemy's position. Either of these can be wrong if something unexpected happens (you get hit by a rocket, but don't know it yet). Your own position is predicted by half of your ping, so by 32 ms with 64 ms ping. Opponent movement is always predicted by 20 ms, except if you have 13 ms ping which means that opponent movement is only predicted by that 13 ms.How does this affect knockback?
The time when you knocked or the amount you get knocked will NOT change because of antilag.
Direction of the knockback is the direction in which the shot was made. So let's have an example, like in the above picture a player is strafing to the right with 320 ups, his opponent has 64 ms and shoots him to the center of the hitbox with LG from 400 units away (LG length is 600 units). Now the difference between what happens with or without antilag can be seen on this picture
(bit whacky size, but I wanted to keep it in scale with the earlier picture). Top left red point is where the hit is made with antilag, top right is hit made without antilag and bottom point is where the shot is made from. B is the same value as in above example. A is the firing distance. Alpha is the angle difference, and it can be calculated as arcsin(B/A) * (180/pi). In this example it ends up being about 2.0 degrees and thus hardly noticeable. The value gets bigger when you increase attacker's ping, victim's movement speed or decrease the attack distance.Does this mean that I can get shot around a corner?
This depends on how you think about it. If you hold onto the notion that what the server sees is the "reality" of the game, then yes in that view you can be shot after you went behind the corner. This is quite on arbitrary way to think about it though. In fact the server's view on things is the least important, because none of the actual players involved see it. If you die "behind a corner" it means that on your opponents view when he was making the shot you weren't behind the corner.
The other part to think about is how big is the change. By looking at the example above you can see that with 64 ms ping the difference is 44 ms in time and 14 units in distance when strafing full speed. These are really small numbers and should be really hard to notice in practice.What about the shaft beam with cl_fakeshaft 0?
SVN version of EzQuake now has support for emulating "13 ms cl_fakeshaft 0" even with higher pings. This should allow people that prefer to base their aim on the shaft beam continue to do so, even on higher pings. The settings in question are:
cl_fakeshaft_extra_updates 0: This makes fakeshaft no longer update every frame, but instead just when a new beam is received from the server. In other words it becomes jumpy like with cl_fakeshaft 0 and allows you to count the numbers of shots made.
cl_fakeshaft 2: This settings is just like cl_fakeshaft 1, except that it doesn't fake the shaft to your current view, but to the view 13 ms ago. So now a valid cl_fakeshaft value is anything between 0 and 1 like before, plus 2 for this new settings.
So with cl_fakeshaft 2 and cl_fakeshaft_extra_updates 0 you should get the same experience with higher pings that you get with cl_fakeshaft 0 on 13 ms.
Test build for Windows is available here
It doesn't only contain this change, but all the other changes in the EzQuake development version. So keep that in mind. Bug reports are of course welcome.