Antilag

From AQ2World Wiki
Revision as of 18:34, 9 October 2022 by BAron (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Anitlag was introduced in aq2-tng May 17, 2022, it compensates for client latency the same way most modern game does, eliminating the requirement to compensate for your ping by “leading” your shoots at enemies.

What does it do?

Like most competitive games, movement and shots are calculated on the server, since it tricky to trust the client with this (making it to easy to cheat). So when a player moves and shoots, it reports coordinates/velocity/direction to the server, if it seams reasonable the server accepts and replicates it. But this also delays everything with the players latency. For example, if you are aiming at a player running perpendicular to your view and you have 100 milliseconds of latency and the player is running at 500 units per second, then you'll need to aim 50 units in front of the target to hit the target with an instant hit weapon. Antilag uses measures to eliminate this requirement to lead your shots with x units depending on your lag and opponents velocity.

How does it work?

When you make a shot in the game and it gets reported to the server, the server will basically “rewind all server actions” by you latency, before checking if your shot was a hit or not, then report the result back to the clients as usual.

Where does it work?

It works on all servers with aq2-tng compiled from source after May 17, 2022 (it's enabled by default), there is no particular requirement for the clients since this all happens on the server.

Server Commands

Allows server operator to enable lag-compensation for aiming with hitscan weapons, useful for making high ping games more fair. Optionally, the server operator can enable interpolation along with antilag for aiming directly at player models to hit them. This has the side effect of being 'shot around corners', so the best use for this setting tends to be for matches where all players pings are very low.

sv_antilag [0/1] (default: "1") - Setting to "1" enables lag compensation functionality when firing hitscan weapons.
sv_antilag_interp [0/1] (default: "0") - Setting to "1" enables interpolation for hitscan weapons.  Requires sv_antilag "1"

Client Commands

serverinfo Show whether the server has antilag enabled or not
setu cl_antilag "0" Client command to opt out of antilag for your own shots. Was introduced to aq2-tng Aug 14, 2022 and thus you need at more recent version than that for it to work. You can run the command userinfo to check if it worked

When does it not work?

It does not work for misses (shots hitting the environment). These will still be affected by your latency.

See also

aq2-tng manual