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

[L4D2] Survivor Bot Controller v1.5


Post New Thread Reply   
 
Thread Tools Display Modes
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 12-08-2015 , 01:53   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #11

Bots get respawned every map change. They drop healthpacks, and respawn with health packs, leaving 2 extra on ground while, bots have 100 health and health packs on them.
__________________
Spirit_12 is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-08-2015 , 08:49   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #12

The framework was developed with other developers in mind - so that there would be as few restrictions as possible, placed on developers and server operators, when developing using the plugins' library. With that being said, a developer could use OnAllowSurvivorBotRegulation() and OnBlockSurvivorBotRegulation() to regulate this sort of thing. However, since it seems people just want to use the base plugin without adding onto it, I'm meeting halfway here, and have coded in a forced override when the map ends, preventing bot regulation, and after a new map loads and all connecting players have joined, bot regulation will be either re-enabled, or left disabled, if the last native used was OnBlockSurvivorBotRegulation()

However, I'd like to stress that outside of the basic functionality, I will defer things that aren't bugs, and may just be missing features to: if you'd like to see it - develop it using the natives provided, and if there are specific natives or forwards needed, please request them and I will do my best to add them.
__________________
L4D2 Loot RPG
Steam
jess is offline
DeathChaos25
Senior Member
Join Date: Jan 2014
Location: Puerto Rico
Old 12-08-2015 , 10:10   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #13

Quote:
Originally Posted by Sev View Post
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.

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.
These can actually be worked around with a little bit of outside the box thinking.

4C can be very easily worked around, when a player will first spawn in, we scan all current players, for T1s and T2s, and give the new player a weapon based on the most common weapon by other players (So say you have 2 T1s and 4 T2s, then new player will get a T2, or if 1 person has a T2 (admin used cheats) but nobody else has one (Dead Center map 1?) then new player will get no T1 or T2, but may get an extra pistol to compensate).

For 4D, just give the player a 2-3 second immunity to prevent an unlucky teleport (teleporting into ff, or into fire, etc) from screwing them over.

Off the top of my head, since this framework spawns a bot and assigns the player as idle to that bot, we could use bot_player_replace to detect when a player is fully ingame and in control of their character.
__________________
DeathChaos25 is offline
Sev
Veteran Member
Join Date: May 2010
Old 12-08-2015 , 16:49   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #14

To touch on the RPG element.

I've always been interested in adding an Resident Evil Outbreak type element to the game with the L4D1/L4D2 survivors.

For instance, in RE Outbreak, each survivor had strengths and weaknesses.

1. Kevin was more accurate with guns since he was a cop, but slower movement wise
2. Yoko could hold a much larger inventory, but she was weaker
3. Alyssa was a master of lockpicking, but weak cuz girl
4. Cindy could hold more health items, but again, weak
5. Mark was great with melee weapons, but slower movement wise
6. Jim was great at being a decoy/hiding in plain sight, but not much else
7. George could mix medical items for potent health items, but weak otherwise
8. David could make new weapons with his utility background

I'd love for such a similar element be brought to the L4D1 and L4D2 survivors

For instance

1. Rochelle could be faster than all the characters, but have tremendous gun recoil and take more damage
2. Zoey could be second fastest, also weak like Rochelle, but she would get the most accuracy with double pistols
3. Coach could be like Mark, he would be awesome with melee weapons, but slower
4. Bill would be slow because of age, but awesomely accurate with assault rifles cuz the Nam
5. Louis would be great/more accurate with T1 weaponry, but less accurate with the heavier weaponry
6. Francis would be able to fire shotguns faster than the other survivors, but move slower
7. Ellis would be great with sniper rifles, but fire other weapons slower
8. Nick would be accurate as hell with the Magnum and carry more items in his suit jacket, but slower with more items

Last edited by Sev; 12-08-2015 at 16:54.
Sev is offline
DeathChaos25
Senior Member
Join Date: Jan 2014
Location: Puerto Rico
Old 12-08-2015 , 17:56   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #15

A few questions about the framework since I have a few ideas I'll be working on.

1) How do I know which bot was spawned by OnJoinSurvivorTeam()? I want to manipulate some netprops before the player has control of their character, I know I can get this info from netprops, but it would probably be easier if you made it return an int with the index of the bot, making it as easy as;

PHP Code:
 new bot OnJoinSurvivorTeam(client
or
PHP Code:
 new bot OnJoinSurvivorTeam(0
instead of having to cycle through clients scanning for netprop

2) I forgot what the other questions where, but I'll post when/if I remember them.

Edit: Found a possibly unintended behavior with OnRegulateSurvivorBots();

if there are 4 survivors present, and you do the following;
PHP Code:
OnSetSurvivorRequirements(28);
    
OnRegulateSurvivorBots(); 
It will correctly remove 2 of the 4 bots leaving only 2, however, if you do the reverse;

PHP Code:
OnSetSurvivorRequirements(88);
    
OnRegulateSurvivorBots(); 
No bots are added whatsoever, meaning they have to be added manually.
__________________

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

When you use OnJoinSurvivorTeam(client) if client is 0, no player will be assigned to it. You can purposely pass that in order to create an army of bots, theoretically. I believe that if there's a 0.1 second delay between OnSetSurvivorRequirements(min,max) and OnRegulateSurvivorBots() it would resolve the issue. At least, that's my hope. I would request you try that, and if it doesn't work, then I can delve into the code and search for a solution. I believe it acts in a way similar to multi-threading in that, since it's natives, they can be called at the exact same time, theoretically, so without a cooldown between the two natives being used, they would both theoretically fire at the same time? Maybe? I'm not entirely sure... I wish there were some more advanced programmers around who could offer some insight into this. I think that's how it works, though. I suppose we'll know after a timer is thrown in there, at least.

What I can do is shoot off a forward, something like... OnBotCreateForwardClientID()which would broadcast the clientID of the bot. Just remember that after the bot is fully created, it's kicked, to make room for the survivor that's about to take it over, so the window of opportunity for whatever you'd like to do wouldn't be large. The other option is that I can create an array or trie to hold the client id's of created bots that aren't taken by players, and pass its entire contents through a forward, or on request via native.
__________________
L4D2 Loot RPG
Steam
jess is offline
DeathChaos25
Senior Member
Join Date: Jan 2014
Location: Puerto Rico
Old 12-08-2015 , 21:39   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #17

So, upon further testing, adding a 0.3 second delay seems to have worked, although it only spawns 1 bot instead of the amount of bots needed to fill the min requirement, although this can be easily worked through if I hook the player_spawn event, unless it is intended for all bots to spawn at once?

And as for bots, what I need specifically, is to store their m_survivorCharacter and playermodel, since sometimes players who take over these bots end up with a different character altogether for some reason.
__________________
DeathChaos25 is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-08-2015 , 21:54   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #18

You shouldn't be calling OnRegulateSurvivorBots() directly after OnSetSurvivorRequirements(2, 8)
As you can see from the code, it would be redundant. The only time it would be necessary is if your plugin calls OnBlockSurvivorBotRegulation() at which time, you could safely call OnRegulateSurvivorBots() without any kind of delay.
PHP Code:
public nativeOnSetSurvivorRequirements(Handle:pluginparams) {

    
hSurvivorRequirement GetNativeCell(1);
    
hSurvivorMaximum GetNativeCell(2);
    if (
bAllowSurvivorBotRegulationRegulateSurvivorBots();

I will also write some code to do the following:
Shoot a forward out called OnBotCreated which will send 3 pieces of data out:

1. Client ID of the player who will be replacing the bot.
2 & 3. The bot m_survivorCharacter & playermodel, collected prior to kicking the bot and giving control to the client.


Let me know if that will work for you.
__________________
L4D2 Loot RPG
Steam

Last edited by jess; 12-08-2015 at 21:57.
jess is offline
DeathChaos25
Senior Member
Join Date: Jan 2014
Location: Puerto Rico
Old 12-08-2015 , 22:11   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #19

Yes that data would be perfect.

And here's where OnRegulateSurvivorBots() has it's weird behavior.

My plugin never calls OnBlockSurvivorBotRegulation(), and I figured out some weird behavior.

Increasing the min amount seems to do nothing, you have to increase both min and max amount for regulation to spawn any extra bots, I'll do some further testing.
__________________
DeathChaos25 is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-08-2015 , 22:15   Re: [L4D2] Bot Controller (Framework)
Reply With Quote #20

What I was trying to say was... You should never call OnRegulateSurvivorBots() unless you've first called OnBlockSurvivorBotRegulation(), because the plugin will do it automatically unless it's told not to through that call. You're calling OnSetSurvivorRequirements and then immediately doing OnRegulateSurvivorBots, even though the plugin is already going to perform that function because you didn't tell it not to prior to that point. Disable its ability to, and everything will work as intended.

I've tested it extensively; I can do !survivors 0 4 and if i'm spectating, no bots. !survivors 1 4 will immediately spawn a bot, even if I'm spectating - the 0 4 method will spawn one for me if i do !joinsurv - so the function does, indeed, work correctly. Try out the new forward, and let me know.
__________________
L4D2 Loot RPG
Steam

Last edited by jess; 12-08-2015 at 22:17.
jess 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 12:28.


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