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

[L4D2] Bot SI skeet/level damage consistency fix (v1.0.9, 2013-07-17)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Tabun
Junior Member
Join Date: Sep 2011
Plugin ID:
3633
Plugin Version:
1.0.9
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Replicates skeet mechanics on AI hunters; negates damage nerf on charging AI chargers; blocks AI scratching-while-stumbling
    Old 04-27-2013 , 10:19   [L4D2] Bot SI skeet/level damage consistency fix (v1.0.9, 2013-07-17)
    Reply With Quote #1

    What does it do?
    • Replicate skeet mechanics on AI hunters.
    • Negate the damage nerf on charging AI chargers.
    • Negate damage by scratches from stumbling AI SI.
    Okay, so you may have noticed that AI hunters are 'harder to skeet' and that it is practically impossible to level AI chargers. First it made me believe I was, apparently, really bad at leveling and skeeting; then I just got annoyed at the difference between AI/human SI. The times that I really hate it is when someone sends in an AI charger/hunter before getting tank, and I forget / don't think about it.

    Regardless of whether it's annoying, it's just dumb and inconsistent that there is an unintuitive difference at all between two otherwise generally undistinguishable events. It's also definitely intentional, which is weird. It's also dumb that AI can scratch while stumbling, but that's probably unintentional.

    So I wrote a 'fix' that simply makes hunters and chargers take damage in the same way that human hunters would. The fix also negates any damage done by stumbling SI.

    Further information: http://www.l4dnation.com/confogl-and...e-shenanigans/

    CVars
    Code:
           sm_aidmgfix_enable: add bitflags: 1 - skeet damage fix; 2 - charger charging fix; 4 - stumble-scratch fix (7 enables all fixes).
    Changelog
    Code:
            1.0.9
               - used CanadaRox's SDK method for detecting staggering (should be safer)
            1.0.8
                - fixed bug where clients with maxclient index would be ignored
            1.0.7
                - reset original way of dealing extra skeet damage to reward killer.
            1.0.6
                - (dcx2) Removed ground-tracking timer for hunter skeet, switched to m_isAttemptingToPounce
                - (dcx2) Removed handles from global variables, since they are unused after OnPluginStart
                - (dcx2) Switched hunter skeeting to SetEntityHealth() for increased compatibility with damage tracking plugins (ie l4d2_assist)
            1.0.5
                - dcx2: added & changed cvars, small fix to charger buff calc
    
            1.0.4 
                - Used dcx2's much better IN_ATTACK2 method of blocking stumble-scratching.
    
            1.0.3
                - Made it so that only scratch-damage is negated on stumbling.
    
            1.0.2
                - Fixed incorrect bracketing that caused error spam. (Re-fixed because oops)
    
            1.0.0
                - Blocked AI scratches-while-stumbling from doing any damage.
                - Replaced clunky charger tracking with simple netprop check.
            
            0.0.5 and older
                - Small fix for chargers getting 1 damage for 0-damage events.
                - simulates human-charger damage behavior while charging for AI chargers.
                - simulates human-hunter skeet behavior for AI hunters.

    Dependencies
    Requires SDKHooks 2.0+.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_ai_damagefix.sp - 1643 views - 8.3 KB)
    File Type: txt staggersolver.txt (221 Bytes, 2174 views)
    File Type: smx l4d2_ai_damagefix.smx (5.9 KB, 1994 views)

    Last edited by Tabun; 07-16-2013 at 21:37.
    Tabun is offline
    grasscid
    Junior Member
    Join Date: Jul 2012
    Old 04-29-2013 , 00:39   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.0, 2013-04-27)
    Reply With Quote #2

    Great plugin. It's a small change, but it's nice to have it.
    grasscid is offline
    RavenDan29
    Veteran Member
    Join Date: Sep 2009
    Old 05-04-2013 , 09:33   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.0, 2013-04-27)
    Reply With Quote #3

    please add .smx file as get plugin is failing to compile
    __________________

    Last edited by RavenDan29; 05-04-2013 at 09:33.
    RavenDan29 is offline
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 05-06-2013 , 16:15   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.0, 2013-04-27)
    Reply With Quote #4

    Hi Tabun, thank you for this plugin, and for the explanation behind the inconsistent game mechanics. It is reminiscent of the head shot damage inconsistencies that I've found myself. I was not even aware of the hunter/charger AI problem, although the stumble-scratch was known. I hope that I can offer some of my own experience and that it may prove useful for you.

    The hunter inconsistency is easy to see by tweaking cvars. It was surprising, and very difficult to explain to someone that "yeah, I know you can kill an AI hunter in the air, but that doesn't mean you skeeted it".

    I noticed that you used RoundToFloor damage to the hunter. I don't have as much experience with damage to SI, but I know that commons do keep track of "fractional" damage. That is, if you consistently shoot a common with a bullet that does 0.2 damage, you will eventually kill it (250 bullets later). However, if you shoot a Survivor with a bullet that does 0.2, I don't think you can ever hurt the Survivor, because Survivor-on-Survivor damage gets rounded down. However, if a common hits a Survivor on Easy in the back, the Survivor will take no damage...but if he gets hit in the back again, he takes one damage. So it seems Survivors also have some measure of fractional damage. I would be interested to hear any experience you have with SI taking damage.

    The charger inconsistency explains why we could never level a charge. However, we still failed to level a charger. We used the damage assistance plugin to see how much damage we were doing (via player_hurt event). We did see damage of about 370 and sometimes 460 (or something close to those values). Is this because we just fail at melee head shots? I suppose we should have disabled the plugin and tried again to observe for 120/150 damage.

    I also noticed you use OnTakeDamage to block the stumble-scratch damage. I think that in this case, you still hear the scratch sound as if you got scratched (the damage indicator does not appear on the HUD, however). You may want to consider using the SDKHook TraceAttack instead; I use that in UndoFF to block the "recoil" that a Survivor feels when he gets shot by a bot. Blocking TraceAttack can make it like the attack never even happened.

    Another option is to use OnPlayerRunCmd and if an SI is stumbling, buttons &= ~IN_ATTACK2. I think this last option may actually be the best; in addition to stopping the damage and the sounds and indicators, it would prevent the SI's model from even displaying the scratch animation.

    EDIT:

    Upon further consideration, I would like to request a way to make the charger buff consistent in the other direction. By that I mean, a cvar to configure whether human charger gets damage/3 while charging, instead of AI charger gets damage*3. I ask because it seems like AI chargers are almost too easy to kill now. Maybe make the cvar a float and it will be a uniform "charge buff", and you can make it 1.5 or 0.5 or 999 or whatever tickles your fancy, and it would apply equally to human and AI chargers alike.

    Also, you mentioned that you couldn't trust m_isLunging at one point? I think that might be because the hunter has two jumping animations, but only one of them can land a pin. In the other jumping animation he's standing straight up.

    EDIT2:

    If the charger hits a wall, he stumbles and this plugin causes his splash damage of 2 to be blocked. I have a feeling it would also block spitter acid if the spitter is stumbling, too.

    EDIT3:

    I modified your plugin to use OnPlayerRunCmd to block scratches. I am attaching the source so you can see the changes. I'm not going to put up an smx because this is your plugin and I'm not trying to take it over.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_ai_damagefix.sp - 1417 views - 8.3 KB)
    __________________

    Last edited by dcx2; 05-10-2013 at 10:24.
    dcx2 is offline
    Tabun
    Junior Member
    Join Date: Sep 2011
    Old 05-13-2013 , 08:47   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.3, 2013-04-27)
    Reply With Quote #5

    Thanks dcx2, I'll have a look at this when I get a chance.

    About fractional damage on SI, not sure. I'd tested pellet damage on hunters a lot, and since the values never added up unless I'd round to floor, I never gave it a second thought. I'm pretty sure there's no fractional damage on a single shot's worth of pellets, but maybe between shots.

    Yes, it is true that stumbling spitters didn't have their spit do damage. That is fixed with v.1.0.3 (that I made without having checked this thread in ages ). I think it fixes stumble damage (the 2 points) too, but if that reports as being done by inflictor == attacker, then it'll be negated. I could just check for the damage amount and let it slide if 2.0...

    It is also true that my solution for the stumble-scratch is pretty ugly. I'd assumed the onplayerruncmd approach wouldn't work because of fakeclients, but if that works, sweet. I'll see about incorporating your approach into the plugin!

    As for leveling chargers, you can still only do it with a head-hit:
    A hit on the stomach (1.25 modifier) would do 0.65 * 600 * 1.25 = 487, a hit on any other part (1 modifier) would do 390. It may be that head-hits are not entirely consistent between AI and human chargers because of the effects of lag, etc. I've managed to level plenty of chargers with the plugin, so it's definitely possible though.

    Thanks for the feedback & improvements.

    Btw, I'm not going to make a version/cvar to make human chargers behave like SI bots. The 1/3-damage thing is pretty silly and there are better ways to make the game versus AI harder. Unlevelable human chargers would be a pretty bad idea too, imo. If you really want it, you can easily make a version that does that, so I'll leave that up to you. :]

    Last edited by Tabun; 05-13-2013 at 08:53.
    Tabun is offline
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 05-13-2013 , 10:49   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.3, 2013-04-27)
    Reply With Quote #6

    FWIW, I use the ~IN_ATTACK2 method with success (my server is running the script I attached above). You can block fake clients, I used to block survivor bots from taking pills or using health kits by ~IN_ATTACK.

    I understand your fear about making human chargers unlevelable (although I do not share it, since I don't play versus against humans, which perhaps explains why I never noticed human chargers were different, and I'm mostly interested in this plugin for modifying the behavior of AI infected in campaign mode) The reason I bring up the AI charger thing is that it's really pathetically easy to kill Chargers now, especially in campaign since this mod will affect all chargers and there's no enable cvar so that I can enable some features only in versus and some features only in campaign.

    It used to be that standing down a charger who was running at you would instill fear because 7/10 times he gets to you before you kill him. Now he's barely half-way to me and he's toast...the difference is too dramatic, almost comical. I guess the purpose of the buff is to give the AI charger a chance to actually get *to* you before dying, since he has a tendency to charge from so far away. A human charger would be smart enough to charge from up close so he wouldn't get mowed down on his way in.

    That's why I was hoping for a configurable buff, so that you or I or anyone could use whatever buff value they like, 1 would be no buff, 3 would be normal AI behavior (1/3 damage), 2 would be what I use, etc. I think with a buff of 2 (i.e. 1/2 damage) that you can still level a charger.

    Another idea would be to make the buff only apply to bullet damage, so that melee can still level regardless. I like this approach because it balances the "stupid AI charger charges from a mile away" problem with the "you should be able to level an AI charger" problem. Another idea is that the problem mainly stems from the easy head shots, so perhaps it could be further narrowed to buffing only against bullets to the head while charging. You could explain this by saying the Charger has his head down and the top of his head would take less damage from a bullet.

    I mean, it's easy for me to fix myself, but making it a configurable float cvar would help everyone, modder or not. However, if I go through the trouble of adding cvars, would it be okay to just add my version to this thread, or would you prefer I made a new thread for it?
    __________________

    Last edited by dcx2; 05-13-2013 at 13:34.
    dcx2 is offline
    Tabun
    Junior Member
    Join Date: Sep 2011
    Old 05-19-2013 , 16:10   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.3, 2013-04-27)
    Reply With Quote #7

    I understand your point about the chargers, but I disagree on using this plugin as a means to change them. The purpose of this plugin is fairly singular: remove inconsistencies between human and AI special infected. While I agree this could be read the other way (removing the possibility to skeet human hunters, level human chargers, and allowing human SI to scratch while stumbling), I don't think that's the best approach.

    If you want to make AI infected scary again, I'd suggest writing a plugin with a different purpose (one which I've considered writing, but never did because I'm more interested in versus / confogl):
    A plugin that improves campaign play by fixing all the silly things about AI SI in it.

    Timing would be the first: it makes no sense that an AI 'team' of special infected do not attack together. Campaign mode would be a lot harder and more interesting if there was even the slightest semblance of teamwork between the SI at all. Not even 3k health chargers are scary if they come at the survivors without any support whatsoever.
    Second would be the behaviour of all the special infected. Standing around making noise for a convenient period of time before striking (I'm looking at you, smoker); running away when hurt a little bit, instead of attacking (hunters); refusing to go for deathcharges at all, et cetera.
    I'm sure there's other things that'd make campaign more interesting.
    Instead of better behaviour and actual gameplay, Valve decided to make harder difficulties harder by just upping the damage done -- I've always found that approach despicable. There's nothing scary about an Expert tank if it behaves as idiotically and predictably as an Easy tank.

    A plugin / config that'd do this would be much better suited for modifications to charger mechanics than this match-mode oriented one! :]

    I'll incorporate your buttons-method soon though.

    Last edited by Tabun; 05-19-2013 at 16:11.
    Tabun is offline
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 05-20-2013 , 22:53   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.3, 2013-04-27)
    Reply With Quote #8

    Quote:
    Originally Posted by Tabun View Post
    Second would be the behaviour of all the special infected. Standing around making noise for a convenient period of time before striking (I'm looking at you, smoker); running away when hurt a little bit, instead of attacking (hunters)
    FYI, smoker_tongue_delay and hunter_committed_attack_range are the cvars you are looking for. There was a thread on SPUF a while back by a guy named Wendigo who found a bunch of good cvars. You will probably also want boomer_vomit_delay too. These are basically Wheatley cores attached to the infected AI.

    I understand that you're a versus player, and I don't want to get into a discussion about versus vs campaign. I like expert campaign (despicable is such a harsh word...), and I like the stumble-scratch blocking, but this plugin nerfs campaign chargers pretty badly. Not only is it all or nothing, but to get nothing you need to unload it! Enable cvars for each feature, or a single cvar of bit flags which enables individual features, would go a long way toward making this easier for others to use.

    For what it's worth, I wasn't asking for all of those other things. I mean, you can set the hunter skeet cvar to whatever you want and it applies to both humans and infected already, so that already works. I'm not even sure you can activate human scratching while stumbling, maybe there's a net prop you can whack but that requires some experimentation.
    __________________
    dcx2 is offline
    Tabun
    Junior Member
    Join Date: Sep 2011
    Old 05-24-2013 , 08:17   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.3, 2013-04-27)
    Reply With Quote #9

    Don't get me wrong, I wasn't calling campaign players despicable -- I was referring to the easy-out configuration solution that was chosen to create the four difficulty settings. They could've done way more interesting things with that than just scaling damage/health a bit. Neither am I interested in the vs-vs-coop debate -- I just know what I like and don't mind others playing what they like. :]

    I'll reconsider the cvars. I'm just used to (trying to) keep plugins as lean and mean as possible, since they're mostly confogl addons.

    Last edited by Tabun; 05-24-2013 at 08:18.
    Tabun is offline
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 05-24-2013 , 18:22   Re: [L4D2] Bot SI skeet/level damage consistency fix (v1.0.3, 2013-04-27)
    Reply With Quote #10

    I think the damage scaling (and there is more to campaign difficulty than just damage scaling) dramatically changes how the game play works at every level. There are things you can do on other difficulties that are simply impossible on expert coop, like dropping a molly on your feet to escape a horde when you got boomed. For the utter simplicity involved in merely increasing damage (a lean and mean change, you might say), the style of play must change drastically.

    If your concern is time, I can easily add a bit flag enable cvar to your plugin (and by that I mean, publish the version of your plugin that I modified to have a bit flag enable cvar). It will spare you the effort and it is still lean and mean, I promise.

    EDIT:

    I updated your plugin. You'll want to take a look. I've done four things.

    1) added cvar l4d2_dmgaifix_enable. It is a bit flag, 1 = skeet AI hunters, 2 = debuff AI chargers, 4 = block stumble scratch, 7 = all features. Default is 7. I verified that all the cvar bit flags work correctly. It is also cached for better performance.

    2) I cached z_pounce_damage_interrupt cvar and its changes. This will give a minor performance benefit during OnTakeDamage. Also, if for any reason the cvar doesn't exist, FindConVar would cause an error and in an SDKHook an error will crash the server instead of printing the stack trace to the console. Caching the cvar ensures FindConVar only ever executes in a OnPluginStart, which will print a stack trace to the console if the cvar cannot be found.

    3) I removed SDKUnhook in OnClientDisconnect. It isn't necessary, the SDKHooks extension will unhook everything when an entity is destroyed.

    4) I noticed that the Charger debuff calculation was a little off. I double checked with player_hurt to see how much damage was actually being done. I believe the true calculation is

    RoundToFloor(RoundToFloor(damage) / 3 - 1)

    A sniper shot to the arm of a Charger does 90*1.25=112.5 damage. Six sniper shots to the arm will kill a Charger with 672 damage. If fractional damage was stored it would have dealt 675 damage instead. So the engine turns 112.5 into 112 every time. The previous debuff, damage*3+1, would turn a sniper shot to the arm into 338.5 damage. The engine would then turn that into 338/3-1 = 111, instead of 112. The new debuff is

    damage = (damage - FloatFraction(damage) + 1.0) * 3.0;

    (112.5 - 0.5 + 1) * 3 = 339. 339 / 3 - 1 = 112.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_ai_damagefix1041.sp - 1286 views - 9.9 KB)
    __________________

    Last edited by dcx2; 05-25-2013 at 01:05.
    dcx2 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 00:35.


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