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

[L4D2] Survivor Bot Controller v1.5


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-06-2015 , 23:09   [L4D2] Survivor Bot Controller v1.5
Reply With Quote #1

FRAMEWORK: Bot Controller primarily acts as a framework; It's created with basic function in mind, that to generally replicate several of the desired features of a plugin such as Bebop or Super Versus. Currently, natives are implemented to provide other plugins access to build on top of the framework. Designing the plugin in this way allows me to update the framework with new features, bug fixes, and other updates, without damaging the development of plugins built to use the framework. Think of Bot Controller as the tree trunk, and the plugins that use it are like branches. The trunk might change and evolve, but the branches will always be compatible.

BOT CONTROLLER CONFIG: The Bot Controller Framework doesn't actually have its own config. Instead, I've written a separate plugin which optionally provides a config and creates custom CVars to accompany it. This design decision was made to provide the plugin in an accessible way to server operators without stepping on the toes of developers. It is accompanied by a self-generated config in /cfg/sourcemod/bc_config.cfg
This feature was requested by mcgill

VERSION HISTORY: From v1.1.3 and forward, I'll be including a revision history.
PHP Code:
v1.5 01 13 2016
-    OnAnyClientLoaded(clientforward added.
-    
sm_assign_teams added.
      - 
Defaulted to "1" and "0" disablesbut another plugin would have to handle team assignments if this is the case.
      
By default, if the infected limit is 1players will be assigned survivorOtherwisethe team with the least playersotherwise a random team.

v1.4.4 12 14 2015
-    Survivors should now be able to go idle without their bot being removed from the server.
-    
Patched an improper order of operations.
-    
Survivor Bots will be removed if there are more than the required Survivor playerswhen a player goes idle.
     +    If 
a player is moved to spectator through the "Take A Break" menu option go_away_from_keyboardthe player can still press their PRIMARY ATTACK button to rejoineven though the prompts will not be visible.
     +    
Players who join the Spectator team in any other method will need to use the jointeam option to re-enter the game.



v1.4.3 12 13 2015
-    Patched an array out of bounds error.



v1.4.2 12 12 2015

-    Bot Controller Config updated to version dev-c.
     +    
Requested by Acid_Monk
           
-    sm_tank_health              The base health for tanks0 to ignore CVar.
           -    
sm_tank_health_modifier     The health (per survivorto give the tank0 to ignore CVar.
           -    
sm_preserve_teams           If 1we dont allow teams to jumble when a map changes.
           -    
sm_extrameds                Players who join survivors BEFORE the round begins will receive a medkit if set to 1.
-    Corrected a bug where bots were not properly regulatedwhen allowedwhen a player left the game.



v1.4.1 12 11 2015
-    Added a new forward, while amending the name of another to match the naming convention used for Forwards.
     +    
OnBotCreatedFwd renamed from OnBotCreated.
     +    
OnFirstClientLoadedFwd added.
-    
Bot Controller Config is officially releasedrequires v1.4 or greater of the framework.
     -    
Requested by mcgill
     
-    Adds CVars to many important functionsallowing non-developer server-operators the ability
          to manipulate the framework
.
          
A config will be generated located at    /cfg/sourcemod/bc_config.cfg

          sm_survivor_limit      
default: 4        Maximum survivor players.
          
sm_infected_limit      default: 4        Maximum infectedplayers.
          
sm_survivor_minimum    default: 4        Minimum survivors required (bots make difference).
          
sm_reserveslots        default: 2        Number of reserve slots.
          
sm_playerslots         default: 8        Number of playable slots (should be survivorlimit infectedlimit speclimit).
          
sm_reserveslots_delay  default: 30       Timer delay to kick player for reservationfor instant kick.



 
v1.3.2 12 10 2015
-    new native forward as requested by DeathChaos25.
     +    
OnRequestSurvivorBotRegulation() native added.
     +    
OnRequestSurvivorBotRegulationFwd() forward added.



v1.3.1 12 10 2015
-    Reserve Slot Management Integration


 
v1.2.1
-    native OnSlotManagement added to the library.
-    
Added a LogError() to the OnRegulateSurvivorBots() native. If the native is calledbut self-regulation is enabledOnBlockSurvivorBotRegulation() has never been calledso the plugin calls OnRegulateSurvivorBots() on its ownwhich could potentially cause issues - if this event occursit will simply ignore the request and log the error.
-    
Added additional comments in the code for developersEven a request, *hint* *hint*



v1.1.3
-    forward OnBotCreated added to the library
BOT CONTROLLER LIBRARY: Below is a list of all of the current natives and forwards included in this framework - If you're a developer and have requests for this section, please post your request, and I'll see if it can be done.
PHP Code:
/*
 *  Calling this native will force the plugin to regulate the survivor bots based
 *  on whatever the current survivor minimum and maximum requirements are.
 *  
 */
native OnRegulateSurvivorBots();

/*
 *  Forces the player to attempt to join the survivor team - or create bots. See params.
 *
 * @param client        If set to 0, will create a bot but not assign a player to it.
 *                      Will do nothing if the survivor limit has been reached.
 *
 */
native OnJoinSurvivorTeam(client);

/*
 *  Sets the Survivor Minimum and Maximum requirements. OnRegulateSurvivorBots() will not
 *  be called if BotRegulation override is enabled.
 *
 *  @param min          The minimum number of survivors that MUST exist. Humans + Bots.
 *  @param max          The maximum number of survivors that CAN exist.
 *
 */
native OnSetSurvivorRequirements(minmax);

/*
 *  Will block BotControl core from running any Survivor Bot Restriction Regulation functions.
 *  If the function is blocked, the OnRegulateSurvivorBots() native must be called for these
 *  functions to be performed.
 *
 */
native OnBlockSurvivorBotRegulation();

/*
 *
 *  Will allow BotControl core to run all Survivor Bot Restriction Regulation functions.
 *  This is the default setting. Don't forget to call this OnPluginEnd() if your plugin
 *  blocks the functionality!!!
 *
 */
native OnAllowSurvivorBotRegulation();

/*
 *
 *  Allows the creation of a custom number of survivor bots.
 *  Important:  Disable SurvivorBotRegulation by the core plugin before using this native.
 *
 *  @param count        The number of Survivor Bots to create.
 *
 */
native OnCreateSurvivorBots(count);

/*
 *
 *  Allows the destruction of a custom number of survivor bots.
 *  Important:  This will not remove bots that are tied to idle players.
 *
 *  @param count        The number of Survivor Bots to destroy.
 *
 */
native OnDestroySurvivorBots(count);

/*
 *
 *    Allows the setting and management of both infected and survivor team limits.
 *
 *    @param survivorLimit    Must be a value greater than 0 or will be ignored.
 *    @param infectedLimit    Must be a value greater or equal to 0 or will be ignored.
 *
 */
native OnSlotManagement(survivorLimitinfectedLimit);

/*
 *
 *    Adjusts the values, permanently, of reserve slots.
 *
 *    @param reserveslots        The number of non-playable (unless under special circumstances) slots on the server.
 *    @param maximumslots        The number of maximum always-playable slots on the server. Make sure maxplayers is reserveslots + maximumslots.
 *    @param kickdelay        The time in seconds (int) until the player is removed (if there are reserve slots available for the connecting player)
 *                            otherwise the player receives no notice and is removed immediately for the connecting player.
 *
 */
native OnReserveSlotManagement(reserveslotsmaximumslotskickdelay);

/*
 *
 *    Enables reserve slots management on the server. Note, this DOES NOT set the reserve slots, the maximum slots, and the kick delay.
 *    You MUST call OnReserveSlotManagement native (above) and set the values before enabling this (or all hell will break loose)
 *
 */
native OnAllowReserveSlots();

/*
 *
 *    The opposite of enabling.
 *
 */
native OnBlockReserveSlots();

/*
 *
 *    Provides plugins more detailed / selective options for WHICH survivor bots to remove.
 *    Hope to find a way to add more than a static number of options.
 *
 *    @param count        The plugin will kick UP TO this amount of bots (if applicable)
 *    @param reqs            1 - Only one condition must pass on a bot to remove it. 2 - All received conditions must pass to remove the bot.
 *    @param param1        Currently, the native supports UP TO 3 UNIQUE params. Your options are, for example:
 *
 *                        ".mdl" in a param will check the param string against the bot survivor model.
 *                        "!dead" as a param will require bots to be not dead.
 *                        "dead" as a param will require bots to be dead.
 *                        *NOTE* -> You could use 3 different models as your params, if for example, you wanted to remove bots of all those
 *                                  models. However, for that to work, reqs would have to be set to 1.
 *
 *                        I'd really love to add more, or, if possible, IF GetNativeArray will allow me to pass an ADT Array...
 *                        !-- IMPORTANT --!
 *                        Because this native is expected to be used under special circumstances, it DOES NOT adjust the survivor bot minimum
 *                        requirement after kicking bots in this way, in the assumption that an author will do something with the forward that
 *                        immediately follows, OnDestroySurvivorBotsFwd.
 *
 */
native OnDestroySurvivorBotsEx(countreqsString:param1[], String:param2[], String:param3[]);

/*
 *
 *    The only purpose of this native is to request whether Bot Regulation is enabled or disabled on the core plugin.
 *    Will shoot off the OnRequestSurvivorBotRegulationFwd forward.
 *
 */
native OnRequestSurvivorBotRegulation();

/*
 *
 *    When a new bot is created, sends out information about the bot and new client.
 *    Requested by DeathChaos25
 *
 *    @Param client        The Client ID of the player who will be taking ownership of the bot.
 *    @Param cnetp        The net prop ID of the bot.
 *    @Param cmodel        The character model of the bot.
 *
 */
forward OnBotCreatedFwd(clientcnetpString:cmodel[]);

/*
 *
 *    After all eligible bots have been removed, this forward fires, notifying plugins of the number
 *    of bots that were removed - it's possible the number may differ from the value the plugin that
 *    triggered this forward requested be removed.
 *
 *    @Param count        The number of survivor bots that were kicked through OnDestroySurvivorBotsEx native.
 *
 */
forward OnDestroySurvivorBotsFwd(count);

/*
 *
 *    This forward is called when OnRequestSurvivorBotRegulation native is called. It will notify any listening
 *    plugins on whether or not Bot Regulation is automated through the plugin or not.
 *
 *    @Bool IsEnabled        0 for disabled, 1 for enabled.
 *
 */
forward OnRequestSurvivorBotRegulationFwd(bool:IsEnabled);

/*
 *
 *    This forward is called when the first client loads into the game.
 *
 */
forward OnFirstClientLoadedFwd(); 
Attached Files
File Type: zip survivor bot controller v1.4.4.zip (38.3 KB, 308 views)
File Type: zip survivor bot controller v1.5.zip (40.7 KB, 477 views)

Last edited by jess; 01-13-2016 at 17:25. Reason: SBC v1.5
jess is offline
Sev
Veteran Member
Join Date: May 2010
Old 12-07-2015 , 15:29   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #2

I've always found bebop style plugins completely unreliable as they always have one of the following bugs of one kind or another, depending on the plugin.

1. Too many bots on map change (common)
2. Kicking existing bots and replacing them with dead bots that need rescue on player join (rare, but fucking annoying since you take existing bots and replace them with a dead player)
3. The idle bug, when someone goes idle, all open bots have the idle
4. Depending on preference, new player joins...
4A. Is stuck at the beginning saferoom
4B. Has to be rescued
4C. Auto spawns in, teleported to the survivors, but with only a pistol and no T1
4D. See above, so that player takes damage if they don't have a temporary god mode for them, like 5-10 seconds

Point being...I've never seen anyone perfect the bebop style of bot controlling. Superversus is fine, but it lacks the retroactive features that a perfect bebop would have.

I'll be interested to see where this goes.

Last edited by Sev; 12-07-2015 at 15:30.
Sev is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-07-2015 , 15:43   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #3

Hello!


The plugin defaults to 4 survivors required, 4 survivors maximum. In the test plugin I attached, you can use !survivors <minimum required> <maximum allowed> to adjust this value. If you set !survivors 0 4, no survivors will be forced into existence - but 4 survivors can still exist. So, for example, if you're on the survivor team, and you type !survivors 0 4, if there are any bots in-game, it'll remove them - 0 survivors must exist, and 4 can exist. You exist. If you go and type !spec , you'll move to spec, and it'll remove the bot. However, if you're just "idle," the bot will remain - and no random player will be assigned to it, nor will it ever be removed as long as you're still idle. However, if you say !survivors 1 4 and then say !spec , you'll move to spec, and since 1 survivor is required, the bot will remain in the game.

You can do things like !survivors 4 20 if you want there to only be survivor bots if there are less than 4 humans on the survivor team, but allow a maximum of 20 players. Or, if you prefer the super versus method, !survivors 20 20. The plugin will remember the settings until unloaded/reloaded/etc., and only initially sets them OnPluginStart, so it doesn't conflict with any plugins using the natives to control that sort of stuff.

Let me generally go through your list and I'll let you know if the current version of the framework supports it.

1. Too many bots on map change - Thankfully, the number of survivors that exist will always be the same from the end of the map to the start of the next map. There may be bots while waiting on the survivors to connect to them, though, but the restrictions will adhere to the survivor limits.

2. Kicking existing bots... - Bots are either created en mass like in Super Versus or as-needed, like in Bebop. Healthy bots are never removed in order to punish a player, but dead bots are created if the player joins mid-round. Could I spawn them alive? Sure, but plugins can use the framework to do that, themselves, and I left it out because it could be exploited by players.

3. The Idle Bug... - The great news is if you go idle, your bot will still be there when you get back, even if it's dead... Guaranteed!

4. Depending on preference... - Of the server operator! This is a framework plugin, so whatever a server operator or plugin developer wants the result to be, can be made to happen! Yay!

Instead of creating a hard-coded plugin with a specific feature list, it was built as a framework so if someone wants a feature, they can add it. But I think the plugin does a solid job emulating the two ways of bot handling without any features added on through the natives. I don't, myself, plan on creating plugins that use this framework, but I will continue to expand on it for other authors, if there's interest in using it!

!-- Windows Signatures may be out-of-date. I use a linux server for development. --!

Last edited by jess; 12-07-2015 at 16:14.
jess is offline
Sev
Veteran Member
Join Date: May 2010
Old 12-07-2015 , 15:52   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #4

Great info jess.

Will test it out myself.
Sev is offline
Sev
Veteran Member
Join Date: May 2010
Old 12-07-2015 , 17:52   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #5

Tested.

No errors. Really like what I see. Seems fluent.

Only recommendations would be if you have no plans on having the new joiner join as a dead bot and instead in spec. I would add in an instant hint message for that client telling them to type !joinsurv so they can join the game, unless you plan to change this in the future.

I also noticed an influx of medkits on the next map, I assume that's because of how it works, it probably doesn't delete the meds, etc. Not that big a deal since the extra meds aren't too bad a thing.
Sev is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-07-2015 , 18:19   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #6

I spent a solid few hours developing and testing to make sure it wasn't just a theory.
The reason functionality like joining dead/alive or as spectator/survivor isn't implemented is just because a plugin could, using the natives, essentially control and regulate that stuff. Including the extra medkits. It's left that way on purpose so plugin authors have complete flexibility over what the plugin can and cannot do.

The RPG plugin that I'm working on, which is only currently on the development server (it'll receive its own thread when its framework is complete) will also be based on a similar structure to both the Bot Controller and Ready Up Reloaded framework. My goal is to provide people with these kinds of plugins that are normally only found on private servers, and of quality programming, something I think all too often is ignored in private plugins, and we see it when popular servers are constantly crashing or having other issues!
jess is offline
Sev
Veteran Member
Join Date: May 2010
Old 12-07-2015 , 18:25   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #7

Makes sense.

Thanks for the info.
Sev is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-07-2015 , 18:40   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #8

If any developers find themselves needing a native or forward that isn't present, let me know what you're looking for, and I'll implement it into the framework.
__________________
L4D2 Loot RPG
Steam
jess is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 12-07-2015 , 20:40   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #9

I'm yet to give it a test, but from skimming through the code. It should work like a charm.

First test results.
  • You want to remove the downtown.inc from the botcontroller file. Don't think this plugin is dependent on Left4Downtown extension.
  • OnJoinSurvivorTeam should check, if the client is already on survivor team or not. It kicks a bot, if you are already on survivor team upon using "survivors" command. Leaving only 3 survivors and so forth. Depending on how many times you use the command.
  • There is a warning with the dev branches of Sourcemod.

Code:
warning 234: symbol "FCVAR_PLUGIN" is marked as deprecated: No  logic using this flag ever existed in a released game. It only ever  appeared in the first hl2sdk.
Maybe its better to remove it altogether, based on the explanation?
__________________

Last edited by Spirit_12; 12-07-2015 at 20:56.
Spirit_12 is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-07-2015 , 23:20   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #10

I've made and uploaded v1.1.1, which corrects the issues you've pointed out. Furthermore, a player should no longer be able to rejoin the survivor team while they're idle and connected to a bot, already.
__________________
L4D2 Loot RPG
Steam
jess 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 11:48.


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