Raised This Month: $12 Target: $400
 3% 

[L4D2] 200 IQ Bots: AI Tank Haymakers And More!


Post New Thread Reply   
 
Thread Tools Display Modes
Author
ConnerRia
Junior Member
Join Date: Mar 2018
Plugin ID:
6071
Plugin Version:
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    A collection of plugins to make bots smarter.
    Old 04-02-2018 , 01:04   [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #1

    200 IQ Bots

    Intended for L4D2.
    Untested on L4D. It should work as long as survivors are considered team 2 and not team 1.


    Summary

    This is a set of plugins I've made to improve the ai in the game. There are currently three but I may or may not make more in the future.

    With cvars tweaks and various bot improving plugins, survivor bots are usually *okay* in most situations. In some aspects they are even better than real players! However, the biggest issue with them is that the AI isnt equipped to deal with bosses (ie tanks and witches). The AI seem to have no conception that approaching a tank is a very bad idea, or that blocking a startled witch will make them the witch target. This is very problematic in Realism Expert, where both bosses are particularly dangerous. The following plugins seek to address this issue.

    Bot haymakers is a silly idea that materialized while I was watching a player destroy my team in versus mode with multiple haymakers. I thought to myself "hey wouldnt it be cool if the tanks in my Realism Hard Eight server could do that too?"


    Plugin #1: Bot Haymakers

    Does what it says on the tin. When punching, AI tanks will now do a rock throw in the same frame as well. All regular rock throws are not affected.


    Plugin #2: Fly You Fools

    A complement to the aforementioned plugin, survivor bots will now maintain a safe distance away from the tank instead of blindly following you like a bunch of idiots. Note that the ai isnt perfect and can still be cornered by the tank.

    A caveat is that bots still prioritise reviving incapped survivors over everything else. I cant seem to work around this.

    I had the intention of making this plugin regulate survivor bot healthkit and meds usage during tank fights before publishing it, but thats a fair bit of work and testing that im too lazy to do right now.


    Plugin #3: Dont Fuck With Her Man

    Similar to Fly You Fools but for witches. In Realism Expert, crowning witches is impossible. There are still many strategies to deal with witches, from molotoving them to hiding behind doors. However, it seems that no matter what you try, the survivor bots will fuck shit up by inadvertently blocking the witch's path and consequently getting killed.

    But no more! With this plugin, survivor bots will treat a startled witch with caution and retreat if she comes too close. Obviously, this means that if you fuck up, a survivor bot will not die in your place and YOU will die!


    Convars

    200IQBots_HaymakerChanceFactor
    //Default 1
    //Factors the chance of tanks doing haymakers on each punch by the value. A value of one means all AI tank punches are haymakers. A value of 2 means 50% of punches are haymakers, 4 means 25% of punches are haymakers, etc.

    200IQBots_WitchDangerRange
    // Default 500
    // The range by which survivors bots will detect the presence of witch and retreat.


    200IQBots_TankDangerRange
    // Default 800
    // The range by which survivors bots will detect the presence of tank and retreat.


    Recommended Mods

    Competitive Bots +: A set of cvar tweaks that improves survivor and si bots. The cvar tweaks are added to gamemodes.txt. If you have any other mod that modifies the aforementioned file, I recommend opening up the vpk and copypasting the cvars into your server.cfg. Of course, sm_cvar will have to be added to each line. Using Notepad++'s column editor, you can do that for every line at once.

    Shoot At It FFS by AtomicStryker and Merudo: My plugins are heavily based on this code.

    Max Intensity: Removes sv_cheat flag from the max intensity command. At this point, nobody really knows if force_max_intensity even does anything, but it is a good placebo. Note that "sb_force_max_intensity" has to be entered without the sm_cvar in front.

    Gear Transfer: One of the most popular L4D2 plugins. Not much has to be said, its extremely dope.

    Either Tank Damage Modifier or Modified Infected Damage.: Haymakers are pretty unfair - if the punch connects, the rock throw will most likely connect too, if it doesnt, you still have to dodge a rock in close quarters, which is pretty difficult. These plugins will allow you to regulate damage done by tanks. The latter plugin allows you to set rock damage differently from punch damage.


    Changelog
    2nd April 2018: Switched to Timocop's stock function for logic_script entity.
    3nd April 2018: I noticed a peculiar bug where setting all bot AI actually causes SI bots to spawn with tank once a survivor is incapped. Fly You Fools no longer resets bot AI.
    8nd April 2018: Plugin now resets survivor bot AI whenever a player gets incapped during a tank fight. Should not cause any bugs.
    Attached Files
    File Type: sp Get Plugin or Get Source (200IQBots_DontFuckWithHerMan.sp - 9247 views - 3.9 KB)
    File Type: sp Get Plugin or Get Source (200IQBots_BotHaymakers.sp - 7491 views - 1.7 KB)
    File Type: sp Get Plugin or Get Source (200IQBots_FlyYouFools.sp - 8866 views - 4.0 KB)
    __________________

    Last edited by ConnerRia; 04-08-2018 at 02:53.
    ConnerRia is offline
    Timocop
    AlliedModders Donor
    Join Date: Mar 2013
    Location: Germany
    Old 04-02-2018 , 08:06   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #2

    You should avoid all "script" cmds, they leak very badly and fill up ram because they create a new instance all the time. Use the logic_script entity instead, they wont leak.

    Heres my stock i made:
    PHP Code:
    /**
    * Runs a single line of vscript code.
    * NOTE: Dont use the "script" console command, it startes a new instance and leaks memory. Use this instead!
    *
    * @param sCode        The code to run.
    * @noreturn
    */
    stock L4D2_RunScript(const String:sCode[], any:...)
    {
        static 
    iScriptLogic INVALID_ENT_REFERENCE;
        if(
    iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic)) {
            
    iScriptLogic EntIndexToEntRef(CreateEntityByName("logic_script"));
            if(
    iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic))
                
    SetFailState("Could not create 'logic_script'");
            
            
    DispatchSpawn(iScriptLogic);
        }
        
        static 
    String:sBuffer[512];
        
    VFormat(sBuffersizeof(sBuffer), sCode2);
        
        
    SetVariantString(sBuffer);
        
    AcceptEntityInput(iScriptLogic"RunScriptCode");

    Timocop is offline
    ConnerRia
    Junior Member
    Join Date: Mar 2018
    Old 04-02-2018 , 09:25   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #3

    Quote:
    Originally Posted by Timocop View Post
    You should avoid all "script" cmds, they leak very badly and fill up ram because they create a new instance all the time. Use the logic_script entity instead, they wont leak.

    Heres my stock i made:
    PHP Code:
    /**
    * Runs a single line of vscript code.
    * NOTE: Dont use the "script" console command, it startes a new instance and leaks memory. Use this instead!
    *
    * @param sCode        The code to run.
    * @noreturn
    */
    stock L4D2_RunScript(const String:sCode[], any:...)
    {
        static 
    iScriptLogic INVALID_ENT_REFERENCE;
        if(
    iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic)) {
            
    iScriptLogic EntIndexToEntRef(CreateEntityByName("logic_script"));
            if(
    iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic))
                
    SetFailState("Could not create 'logic_script'");
            
            
    DispatchSpawn(iScriptLogic);
        }
        
        static 
    String:sBuffer[512];
        
    VFormat(sBuffersizeof(sBuffer), sCode2);
        
        
    SetVariantString(sBuffer);
        
    AcceptEntityInput(iScriptLogic"RunScriptCode");

    Thanks for pointing it out. Im a total amateur at this @.@ Fixed !
    __________________

    Last edited by ConnerRia; 04-02-2018 at 09:25.
    ConnerRia is offline
    MasterMind420
    BANNED
    Join Date: Nov 2010
    Old 04-02-2018 , 10:49   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #4

    Quote:
    Originally Posted by Timocop View Post
    You should avoid all "script" cmds, they leak very badly and fill up ram because they create a new instance all the time. Use the logic_script entity instead, they wont leak.

    Heres my stock i made:
    PHP Code:
    /**
    * Runs a single line of vscript code.
    * NOTE: Dont use the "script" console command, it startes a new instance and leaks memory. Use this instead!
    *
    * @param sCode        The code to run.
    * @noreturn
    */
    stock L4D2_RunScript(const String:sCode[], any:...)
    {
        static 
    iScriptLogic INVALID_ENT_REFERENCE;
        if(
    iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic)) {
            
    iScriptLogic EntIndexToEntRef(CreateEntityByName("logic_script"));
            if(
    iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic))
                
    SetFailState("Could not create 'logic_script'");
            
            
    DispatchSpawn(iScriptLogic);
        }
        
        static 
    String:sBuffer[512];
        
    VFormat(sBuffersizeof(sBuffer), sCode2);
        
        
    SetVariantString(sBuffer);
        
    AcceptEntityInput(iScriptLogic"RunScriptCode");

    This is very good to know, recently i've been working on some bot modification myself with my multiple weapon plugins. As of now they pickup 2 weapons(I plan on having them use them all, one of the biggest issues with melee though is that they act as if there still shooting so they'll swing from a distance constantly. I'm planning on working around this issue with script command to command them to move at there targets(It'll take some fudging but i can get it to work). I plan on making some human like sick bots. If a player goes idle there bot won't actually pickup any weapon so u can keep what u had(unless they run out of ammo), it works very well. I also hated the fact that bots would seem to get stuck not doing anything when swarmed by infected, especially if hit in the back. I have alleviated this also with script command. One thing I found with my testing is my server would crash using script command in this manner, because its constantly being called(I assume because of memory leaking). I worked around this issue by adding a timer of at least 0.5 to the script command itself to prevent it from firing constantly and it seems to work, no more crashing. However I can see this being very useful, thank u Timo
    MasterMind420 is offline
    mightmagix
    Junior Member
    Join Date: May 2011
    Location: KL
    Old 04-02-2018 , 12:32   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #5

    200 IQ?? That's quite a task. So far I've tried...

    Plugin #2:
    Bots working as intended, as well as determined reviving incapped teammates during tank fight.

    Plugin #3:
    A. Bots sneaked past sitting witch but will shoot if path blocked by those witch. Happened sometimes. Its worst since I have relentless_witch in Realism Expert.

    B. Will end up hit and anger moving witch. Tried with Hard Rain campaign.

    @MasterMind420:
    Looking forward to this bot modification you mentioned. I always rely on cvars to alter their behavior and as a result: mediocre.
    mightmagix is offline
    theproperson
    Member
    Join Date: Feb 2017
    Old 04-02-2018 , 13:42   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #6

    I'm really enjoying all 3 plugins. Less of a difference between human and bot players make the game feel a lot more intense and bring out way more entertaining fights.

    On an unrelated note, I'm curious about seeing if anyone could fill the final and biggest gap between human players. That is how reviving works. Bots can revive a player regardless of them taking damage or being stuck in a horde. For people who run increased sized hordes and harder to kill commons like me, that often results in being forced to leave someone behind because there are too many infected. If somehow players could revive each other like bots then left 4 dead 2 may finally become a perfect game lol.

    Last edited by theproperson; 04-02-2018 at 13:45. Reason: typo's
    theproperson is offline
    ConnerRia
    Junior Member
    Join Date: Mar 2018
    Old 04-03-2018 , 00:13   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #7

    Quote:
    Originally Posted by mightmagix View Post
    200 IQ?? That's quite a task. So far I've tried...

    Plugin #2:
    Bots working as intended, as well as determined reviving incapped teammates during tank fight.

    Plugin #3:
    A. Bots sneaked past sitting witch but will shoot if path blocked by those witch. Happened sometimes. Its worst since I have relentless_witch in Realism Expert.

    B. Will end up hit and anger moving witch. Tried with Hard Rain campaign.

    @MasterMind420:
    Looking forward to this bot modification you mentioned. I always rely on cvars to alter their behavior and as a result: mediocre.
    This only controls bot behaviour *after* the witch is startled. Its meant to prevent survivor bots from blocking the path of a startled witch.

    I think bots are already decent with unstartled witches in the base game.

    On a side note, since this thread is getting bumped, a new version of Fly You Fools has been uploaded! I noticed that resetting bot ai on survivor incap by tank causes SI to immediately spawn, so that feature has been removed.
    __________________
    ConnerRia is offline
    Visual77
    Veteran Member
    Join Date: Jan 2009
    Old 04-03-2018 , 14:23   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #8

    Quote:
    Originally Posted by ConnerRia View Post
    Untested on L4D. It should work as long as survivors are considered team 2 and not team 1.
    Tank = m_zombieClass 5 (L4D). For the haymaker plugin

    Last edited by Visual77; 04-03-2018 at 14:23.
    Visual77 is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: Chocolate Factory
    Old 04-04-2018 , 07:47   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #9

    Nice. Similar to one of my private plugins, but nice nonetheless.

    All it is missing is support for multiple tanks and/or witches spawning at the same time, whether be it either by plugin (i.e Multi-Tanks) or map's default behavior (i.e Swamp Fever finale).

    Also, the first plugin is incompatible with any Haymaker Exploit Blocker plugins. So to everyone else who want to make it work, remove those plugins.

    Last edited by cravenge; 04-04-2018 at 08:27.
    cravenge is offline
    Visual77
    Veteran Member
    Join Date: Jan 2009
    Old 04-04-2018 , 11:07   Re: [L4D2] 200 IQ Bots: AI Tank Haymakers And More!
    Reply With Quote #10

    Quote:
    Originally Posted by cravenge View Post
    Also, the first plugin is incompatible with any Haymaker Exploit Blocker plugins. So to everyone else who want to make it work, remove those plugins.
    A mistake in the SMAC module by not excluding bot AI.
    Visual77 is offline
    Reply


    Thread Tools
    Display Modes

    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 07:13.


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