lag compensation eliminates the need of players with high latencies to "lead shots" (a.k.a. "do ping calculations") to consistently hit enemies. this allows for significantly fairer gameplay for players with moderate (100ms - 300ms) latencies.
according to the documentation of cs2d 0118, lag compensation is supposed to be implemented. however, for unknown reasons, it does not work at all. therefore, i have created this script so that cs2d can have working lag compensation.
how it works -
1. store every player's position over the previous 25 frames in a buffer.
2. disable cs2d's hit detection for almost all weapons. (HEs are processed normally)
3. for every attack, calculate hits using locations from a previous frame (which is determined by latency) to determine whether a hit should count. (i.e. lag compensation)
by modifying this script, it is possible to do things such as larger/smaller hitboxes, "headshots" (higher damage if bullet hits a small head hitbox), circular "hitboxes," etc...
from what i know, for general usage such as in public servers, the script does not have any noticeable effects on performance. deathmatch with 32 bots locked to one tile using m249s and with mp_damagefactor set to 0 would be interesting to try sometime.
analysis of the effects of lag compensation:
----download:
version 0.6 (view online)<< latest stable
previous versions:
----servers with lag comp:
[Fl@me] Aim: 206.217.212.32:36963
[Fl@me] Mix: 206.217.212.32:36962 (password - match)
all Die Kebäbse servers
----changelog:
version 0.6
-fixed friendlyfire issues
-ping spikes smoothed out for the amount of time compensated.
-press f2 to get your current "smoothed" ping.
-press f3 to disable/enable lag compensation for yourself only. (if your own lag comp is disabled, hit sounds should work.)
-bomb explosions, slaps, etc... take effect now.
-lame attempt at organizing code
----todo list:
-[hard/impossible] get hit sounds to work somehow.
-[medium] single/double bullet bursts from glock/famas. though this sounds simple, i cannot think of any efficient method to doing it. if only there were player(id, "ammo")...
edited 26×, last 02.12.10 02:23:13 am