Raised This Month: $32 Target: $400
 8% 

[L4D & L4D2] Tank Rock Lag Compensation


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Luckylock
Junior Member
Join Date: Jan 2019
Plugin ID:
6494
Plugin Version:
1.10
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Lag compensation for tank rocks + custom damage & range values
    Old 04-03-2019 , 03:13   [L4D & L4D2] Tank Rock Lag Compensation
    Reply With Quote #1

    This plugin provides lag compensation as well as cvars for weapon
    damage & range values on tank rocks.
    • Download Links

      Source
      Compiled

    • Gamedata

      rock_lagcomp.txt

    • Dependencies

      smlib

    • Lag compensation for tank rocks

      The lag compensation is done by keeping track of the position vector history
      of the tank rock(s) for each previous n frames (defined by MAX_HISTORY_FRAMES).
      When a survivor fires his weapon, the client frame is calculated by this formula:

      Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation

      Once the frame number that the client is running at is known, the plugin
      draws an abstract sphere about the size of the rock at the origin vector
      of the rock at client frame time. A line-sphere intersection is then calculated
      to detect collision. At that point, the weapon damages and ranges come into play.

    • Weapon Damage

      For a given weapon damage, the damage is equal to the range at which one bullet
      will kill the rock. For example, a damage of 200 for a gun will kill a rock
      in one bullet at or below the range of 200 units. Damage is scaled based on
      distance with this formula:

      Final Damage = Damage / Distance

    • Weapon Range

      The weapon range is set to prevent all damages above a certain range. For
      example, a range of 2000 on a gun category will mean that this type of gun
      will do no damage to the rock above 2000 units.

    • Note about the reason for the custom hitbox, damage and range values

      Since other methods have been tried by other people (without success),
      I felt the best way to approach this was with an abstract hitbox that does not
      actually exist in the game. This plugin essentially buffs the survivors, so the
      balance needs to be considered and because of the way this plugin is
      implemented (hitscan) we can't just grab the vanilla gun damage values.

    • Cvars (cvar name - default value)

      Here is the list of available cvars.

      • sm_rock_print - 0
        Toggle printing of rock damage and range values.

      • sm_rock_hitbox - 1
        Toggle for rock custom hitbox. (needed for this plugin to work)

      • sm_rock_lagcomp - 1
        Toggle for lag compensation.

      • sm_rock_godframes - 1.7
        Godframe time for rock (in seconds)

      • sm_rock_godframes_render - 1
        Toggles render of godframe visual feedback

      • sm_rock_hitbox_radius - 30
        Rock hitbox radius (in game units)

      • sm_rock_damage_pistol - 75
      • sm_rock_damage_magnum - 1000
      • sm_rock_damage_shotgun - 600
      • sm_rock_damage_smg - 75
      • sm_rock_damage_rifle - 200
      • sm_rock_damage_melee - 1000
      • sm_rock_damage_sniper - 10000
      • sm_rock_damage_minigun - 300

      • sm_rock_range_min_all - 1
      • sm_rock_range_max_all - 2000
      • sm_rock_range_pistol - 2000
      • sm_rock_range_magnum - 2000
      • sm_rock_range_shotgun - 1000
      • sm_rock_range_smg - 2000
      • sm_rock_range_rifle - 2000
      • sm_rock_range_melee - 200
      • sm_rock_range_sniper - 10000
      • sm_rock_range_minigun - 2000

    Last edited by Luckylock; 04-04-2019 at 17:47.
    Luckylock is offline
    dustinandband
    Senior Member
    Join Date: May 2015
    Old 04-03-2019 , 15:58   Re: [L4D2] Tank Rock Lag Compensation
    Reply With Quote #2

    Sick. Maybe in the future you could make a video showcasing the difference with / without the plugin.
    dustinandband is offline
    Luckylock
    Junior Member
    Join Date: Jan 2019
    Old 04-03-2019 , 22:04   Re: [L4D2] Tank Rock Lag Compensation
    Reply With Quote #3

    Quote:
    Originally Posted by dustinandband View Post
    Sick. Maybe in the future you could make a video showcasing the difference with / without the plugin.
    Sure, here you go: https://youtu.be/Pa9WcpbSug0
    Luckylock is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Cat
    Old 04-03-2019 , 23:24   Re: [L4D2] Tank Rock Lag Compensation
    Reply With Quote #4

    Nice job it works very well thanks
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D
    Lux is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Cat
    Old 04-04-2019 , 00:58   Re: [L4D2] Tank Rock Lag Compensation
    Reply With Quote #5

    Hello again, i made some changes and made a pull request for support l4d1 linux and windows.

    https://github.com/LuckyServ/sourcemod-plugins/pull/2

    Branch is here with l4d1 & windowns support.

    Gamedata:
    https://github.com/LuxLuma/sourcemod...ck_lagcomp.txt

    Source:
    https://github.com/LuxLuma/sourcemod...ock_lagcomp.sp

    Binary:
    https://github.com/LuxLuma/sourcemod...ck_lagcomp.smx
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D

    Last edited by Lux; 07-14-2019 at 05:40.
    Lux is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 04-04-2019 , 10:27   Re: [L4D2] Tank Rock Lag Compensation
    Reply With Quote #6

    wow, very nice idea and realization, Luckylock !

    Lux, thanks for backporting.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    V1SoR
    Member
    Join Date: Jan 2011
    Old 04-21-2019 , 09:31   Re: [L4D & L4D2] Tank Rock Lag Compensation
    Reply With Quote #7

    Avoid using OnGameFrame(). Use SDKHook w/ EntityThink() on each rock.

    No clamping on client's cl_interp is being done. Sanitize it, it can be exploited with negative values and binds if used outside of typical confogl environment.
    V1SoR is offline
    Luckylock
    Junior Member
    Join Date: Jan 2019
    Old 04-25-2019 , 00:10   Re: [L4D & L4D2] Tank Rock Lag Compensation
    Reply With Quote #8

    Updated: Added clamping to avoid potential exploit.

    Using game frame is necessary for lag compensation to work properly, I'm not sure how the EntityThink works, could you explain it?

    Last edited by Luckylock; 04-25-2019 at 00:11.
    Luckylock is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Cat
    Old 04-25-2019 , 01:09   Re: [L4D & L4D2] Tank Rock Lag Compensation
    Reply With Quote #9

    Quote:
    Originally Posted by Luckylock View Post
    Updated: Added clamping to avoid potential exploit.

    Using game frame is necessary for lag compensation to work properly, I'm not sure how the EntityThink works, could you explain it?
    OnGameFrame() is at the start of the server frame static.

    Think is dynamic but usually most entities call it everyframe and is mid gameframe, it don't really matter if you use OnThink or OnGameFrame because both actions are before the rock has even moved or done anything if i recall correctly.

    Visor probs mean a ThinkPost hook if that works on the rock.
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D
    Lux is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 06-09-2019 , 14:03   Re: [L4D & L4D2] Tank Rock Lag Compensation
    Reply With Quote #10

    Very useful in l4d competitive versus
    Help high ping players to easily shoot the tank rock

    Thanks for your great work !
    __________________
    HarryPotter is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 10:59.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode