PlayerBots - Custom AI for test players

Hi this is my first module (more a modification of PlayerScriptsLoader) i’m sharing with the community. It’s a module that allows test players whose id is less than -1 will be controlled by basic AI.

I’m releasing this so people can give feedback and what other types of AI behaviors they want to be implemented (Through you can always edit the code yourself for your own game).

Just do note, this is mostly made for Studio in mind but you could also use it to test out how let’s say pvp would work inside of studio directly.

There currently 3 AI modules, each have their unique behavior:

  • SimpleWander
    Which basically makes the bot wander to a random point on the map (if pathfinding is enabled, it will also calculate a possible path before moving)
  • SimpleFollow
    Makes the bot follow the player with user id of -1, that’s it.
  • SearchAndDestroy
    Makes the bot seek out the nearest target (can be NPC or Player)

Installation:
Roblox Freemodel

As of now, you can simply require() the model with the assetId using Studio’s Command Bar
Just make sure to remove the previous versions

Configuration
You can find configuration module within the model itself.

Known Bugs

  • SearchAndDestroy seems to not work, looking into it. (Fixed)

Latest Updates
1.0.1
* Fixed an issue with Search and Destroy behavior. Special thanks to @Juicy_Fruit on DevForums!
* Changed how FOV and targetting is handled
* Improved SearchAndDestroy behavior module’s codebase

32 Likes

Sounds like a cool idea! Is it possible to randomly equip tools and activate them via Tool:Activate() and Tool:Deactivate()? It would be a good feature to have for tool integrity checking.

Pretty sure i had the idea of bots equipping a tool if there is one in Backpack and simulate a click using Activate(), i’ve have no idea why it doesn’t work correctly. Will take a look sometime

videos or gifs to quickly showcase the module?

i dont have OBS, besides i came to realize this won’t be useful for Live Games since you can’t create a bot.

Also i lost motivation since idk what i’d do next so i prob come back to this when i know what i’ll add

1 Like

very good resource to tap into.

as for the search and destroy bug, the issue is due to this line in util.FindNearestTarget:

if target:IsA("Humanoid") and target.RootPart then

since its checking all humanoids, including itself, it will always think it is next to a target (that being itself)

this made it work:

if target:IsA("Humanoid") and target.RootPart and target~=my_target.Humanoid then
1 Like

Thanks, i didn’t realize that lol

I will fix that in the next update

Hi,

Looks very good but not sure what you mean by use on “the player’s UserID is less than -1”? when I setup on a new place it just controls my player.

Thanks

when you use studio’s test functionality (where you can play as multiple players) the players (except player 1) will become bots.

I know you wanted feedback so just wanted to say that I can’t stress enough how effective and easy to use this module is–to learn from and to apply it to actual npcs, it helped jumpstart my development on a ai gun bot system

while its no where near done, I got a lot done since the last 24 hours from 0 knowledge of AI.

3 Likes

This video is what inspired me to use this module for my own AI gun system. I would love to achieve the end result as well as you did it :smiley: