Sign in to follow this  
Slothman

[REL] SlothBot an AI fighting Bot for MTA

Recommended Posts

for up to date info, click here to skip ahead to the newer info

-----------------------------------------------------------------

OLDER PREVIEW HERE

SBtest :SlothBot AI bot for Deathmatching

I've been experimenting with AI and making a dm bot for a while, not as a main project but something to do when I'm bored. The reason I'm releasing it like this is because it's not quite completed yet, but most of the bot behaviour for combat is already scripted and I'm looking for feedback/suggestions/help.

The bot works off a path system that tells it which directions it can move, but its not so stiff that it stays on rails all the time. I compiled it because I would prefer people don't try to adapt this script in its unfinished form, as it wouldnt result in a very good game as it is.

Consider this a "demo", its fun enough to spawn in the army base and fight some semi-intelligent bots, but its really just a glimpse of the potential.

INSTRUCTIONS:

1: move the SBtest dir into your mta server resources directory

2: start the resource ("start SBtest" in server console)

3: join the server

4: spawn bots using the following command:

spawnbot SKIN WEAPONID AMMO

eg: "spawnbot 287 27 99" in the client console (without the quotes) will create a bot using the army skin with a combat shotgun that has 99 shells

5: fight the bots

6: let me know what you think!!! I'm looking for feedback on what features people want added, where the bots might be made more intelligent, not challenging enough? too challenging? does the whole thing suck and i should give up? what sort of gamemode would you like to see use this? any questions or comments at all really.

-------features i hope to implement in the "real" release---------

-editor addon so mappers can make bot paths for their own maps

-team mode where a bot will listen to a players instructions and follow the player around

-more advanced path instructions (so the path tells the bot if theres a spot it needs to jump/sprint/duck)

-some sort of method to allow gamemode developers to plug the bot into their game easily

If any *EXPERIENCED* scripters who have a gamemode that might benifit from this script, feel free to contact me in the MTA forum (http://forum.mtasa.com) or irc (gtanet.com/#mta)

Special thanks to the usual people, the MTA devs, the MTA QA team, erorr404 for help with the path node script, EvgeniZ for the rigorous "testing", and everyone else who helped me get unstuck when my brain shuts off.

Share this post


Link to post

not entirely sure what you mean exactly, if you talking about setting up colshapes to effectively "fill in" where bots are allowed to go, it could work, especially on wide open areas. letting them pick random spots within a certain field and checking to see if it could make a path would certainly make movement more dynamic.

the drawback is having them semi-randomly wander around marked off areas usually leads to congestion within wider areas, and a sort of funneling effect, not to mention less purposeful movement.

overall the way its done right now isnt too far off . bots check line of sight to their target (either hte next pathway point or a player) to see if theres anything in the way, but they also know if somethings stopped them from moving. the paths branch out (obviously) so its not just 1 constant loop they run through. one of the benefits of using paths is that it would be much much simpler for a bot to pick out a route to get to a specific destination (something i hope to acheive)

both systems could be implemented, i could create colshapes as virtual barriers to prevent peds from stupidly walking off cliffs, but rely on the paths for when more specific navigation is needed.

Share this post


Link to post

Frankly, I do think there's something wrong with the current system. I kind of had these flaws when (granted, quite shortly) tested this:

(Note: these are just problems I've encountered. Even though it might at times sound like it, I did not aim to say your resource was deep shit. It just needs some work)

  • Pathfinding

At first, I created the fightbot and it appeared somewhere in Area 51. Not very interesting info as it would be for any person, but still. Anyway, when I walked up the stairs from my spawnpoint, I noticed the blip of the ped on the radar. It was moving - away from me... D: Eventually it got caught up in a corner trying to jump itself out of it. Or... It looked like it at least... Eventually it had the idea to jump TOWARDS me for a change. With several other peds I've experienced quite the same. Once a ped got locked up between a stair and a wall and tried to jump on the stair.

  • Shooting

Well, he's in front of me, he shoots aaaand... Nothing really. It looked like it shot itself, except that it didn't lose any health. It was kinda weird. I decided to retry this several times, including walking, jumping, me walking on a platform above him etc. It actually killed me once actually, when I was on that platform. Except for that it only really hit me at about a 1 meter distance, at which you can just hit someone with your gun. And believe me, it's not like I gave the ped a shit weapon to fire from a very long range! An AK-47 with 99 bullets isn't quite like that.

  • Overall behaviour

While shooting, the ped is actually slowly walking towards you. Not really the ideal way of deathmatch, is it? Also, when it runs out of bullets, it kinda keeps on trying to shoot. Standing there like he's holding a toy gun pretending it's shooting.

  • Script

To be very honest, in this state it isn't really possible for people trying to find a problem with your script to actually find it and help you fixing it.

For extra suggestions:

  • Make the peds capable of taking cover (either scripted or mapped. Might be an extreme challenge though)
  • Get them to pickup guns
  • Make them sneak behind you and stealth-kill you with a knife
  • Get them point their finger towards someone, say "HAAX" and throw a monitor? D:
  • Get MTA devs to fix something what appears to be a problem with setPedAimTarget which causes the peds to turn in the wrong way while aiming.

Share this post


Link to post

the bots dont know where you are automatically, so it might move any direction it wants untill it sees you. as far as it getting stuck, i think i know the location your talking about, i had thought i had created a path for all the trickiest spots, but it turns out theres a few snags that i still need to path out. the bots are smart enough that they would have gotten out of the corner on its own after a bit of time.

The shooting is done with max ped stats and a very small delay. as far as my testing went the accuracy was pretty good, someone complained it was too accurate. this is why i wanted to get this script out there, to see how a bot fares against different players with different machines/servers, and yes the bot doesnt yet know what to do when its out of ammo, nor is there weapon switching yet.

thanks for trying it out and letting me know what needs adressing. i know a bot will never be as challenging as a real player to fight, but with some help like this we can at least shoot for smarter tan an npc.

Share this post


Link to post

Progress is being made on this script, Bots are now capable of attacking eachother, they can decide who to attack based on teams, and their fighting styles are tweaked for improvement. at this stage in development the bots are ready to be plugged into a gamemode with only a few minor tweaks.

things that need doing still that i was hoping for help with:

* a bot path editor - something to simplify the process of laying out the path nodes for bots.

* a gui for teammates to tell their team's bots what to do (i was hoping for something sorta swat4 style)

* a gamemode to plug the bots into, could be team based or pure dm, anything that requires fighting.

anyone willing to help or wanting to take advantage of the bots for their gamemode/server, contact me here or irc and not only will i provide the ai code, but i'll help integrate it into your game. think about it, your gamemode could be the first mta gamemode to have bots!

Share this post


Link to post

This sounds really good - I hope someone takes you up on your offer!

You could write some code that would automatically generate paths for bots based on scanning the environment with processLineOfSight. This is effectively what Counter-Strike etc do. You'd run it once and store the result, rather than doing it in real-time.

Share this post


Link to post

once everything else is handled, then i might consider an auto-path method. the most practical way i could forsee is to actually have players movements watched and recorded, so the more you play a map, the more the bots learn it.

Share this post


Link to post

sorta old post, but its amazing work sloth :)

I honestly wonder what you can't do with the ped system :D

anyway, I am going to go try it.

Share this post


Link to post

Just tried it, and it was pretty awesome! Some bugs, but well done.

Share this post


Link to post

lots of those bugs you mentioned have already been taken care of, Just to let everyone know i am still working on improving the ai, and anyone looking to add a unique feature to their gamemode should post here or contact me on irc.

Share this post


Link to post

lots of those bugs you mentioned have already been taken care of, Just to let everyone know i am still working on improving the ai, and anyone looking to add a unique feature to their gamemode should post here or contact me on irc.

Share this post


Link to post

what the hell is ur text encoding!?!?!?!i see few lua words, but all other is just lamely encoded

Share this post


Link to post

it was all compiled to prevent people from using the half done script. I am now currently working on a more complete and better working ai that i will probably release uncompiled. if your interested in using the script for a gamemode, lemme know, as its getting close to a releaseable state

Share this post


Link to post

just i want learn something new from scripts, anyway how u can compile they that way?

Share this post


Link to post

W00t, there is a public server that uses a new and vastly improved bot script!

you'll see it in the server browser called eXo-Clan.info||Control Points + AI Bots Server

or connect manually with mta2.exo-clan.info:22003

It uses a brand new gamemode created by Dragon based on a well known and enjoyed team fortress gamemode, where the goal is to take over all the control points. But don't worry, you won't be going it alone, To assist you in this endevor you are provided with a squad of 3 bots (scrpted by yours truly) that will fight by our side and obey every order (with a fancy control gui activated with the default B button)

Join the server, try it out, if all goes according to plan you should see a full release of the Slothbot that anyone can use to add a whole new level of play to their gamemodes!

please post commenst questions, ideas etc, let us know how you like it!

***********************************************************************

As far as the bot itself goes, the script will feature a full set of functions and event to easily integrate into almost any gamemode. theres alrady a super awesome edf to plt out pathpoints for bots, written by none other than Gamesnert (who managed to far surpass anything i could concieve of, let alone accomplish)

the bot has several different methods of operating that it will automatically switch between on its own, or can be forced into by the gamemode.

hunting: goes around the path points looking for enemies to kill or teammates to follow

guarding: the bot will plant its feet right where its told to guard and shoot any enemies coming close, if the bot somehow gets moved,it'll go right back and resume.

chasing: when a bot sees enemies it'll keep after them while shooting.

following: the bot will tag along with a teammate (bot or player) and provide assistance while remaining close

waiting: the bot will stay where it is untill it either sees an enemy to chase or a bot to follow.

I'm currently working on a wiki page to show all the different functions and events the bot currenty supports, so all you gamemode scripters will soon be able to add bots :)

Share this post


Link to post

The server was awful, becouse there was a hacker and we couldn't do anything about it... even we couldn't /votekick.

But the script is excellent! When it gets released i am sure that i will use it.

Share this post


Link to post

definitly, this is just a test phase, with a script this complex i really want to test it thoroughly.

Share this post


Link to post
definitly, this is just a test phase, with a script this complex i really want to test it thoroughly.

Sweet, I can't wait for it!

Share this post


Link to post

RELEASE!!

DOWNLOAD HERE

MORE INFO HERE

This is a resource designed to allow scripts or gamemodes to insert a ped into the game that roughly simulates combat with a real player. gamemodes can implement the bots as opponents to actual players or as teammates. There are currently a few compatible gamemodes ready for release (more info on that soon) but I figured I'd let people get started making your own gamemodes compatable :D

Features

Teamplay: The bot is capable of identifying friend from foe

Map Navigation: When the bot is placed in a map that has suitable pathways marked out (see below on how to do that) the bot will navigate the map, seeking out enemies. Without pathways, a bot can still think for itself, but wont move around as profficiently.

Aggressiveness: Bots will attack any ped, player or bot thats not on it's team.

Cooperation: Bots can automatically team up with teammates (either player or bot) by meeting up with them and sticking together

Advanced movement: If theres obstacles blocking a bot's path, the bot will attempt to get around or over it instead of just walking into a wall for eternity

Multiple modes of playing:

* "hunting" - travel pathways untill finding an enemy or teammate

* "waiting" - stand still untill an enemy of teammate comes into view

* "guarding" - the bot will attack any enemy that comes within sight, but not move from its spawn position

* "following" - the bot will follow a player or bot while attacking enemies

* "chasing" - the bot will attack an anemy bot or player

Gamemode/Script integration: This script provides several functions and events to allow other resources to see and control what the bot's are doing, and even take control of certain behaviour.

EDF for map path creation: Integrated into the map editor, map designers can easily place paths for bots to follow along in their maps. this greatly increased the bots ability to simulate true playing.

Share this post


Link to post

i'm not sure ..but i think i've seen this script on dragon's testing server and it was freaking awesome .. these bots/peds are so intelligent that i first thought they were real players :D

EDF for map path creation: Integrated into the map editor, map designers can easily place paths for bots to follow along in their maps. this greatly increased the bots ability to simulate true playing.

this is nice .. i'm gonna check out the edf later and see if i can make some of my maps compatible with this script :)

please keep up the great work slothman. :]

Share this post


Link to post

Wow!

This is great!

I'll take it for some DM and Freeroam (as bodyguards :P) gamemodes.

Three questions:

Is it okay if I don't make any waypoints, but follow the player?

Will your peds, in follow player action, get into vehicle after the player enters the vehicle?

How to make them show nametags and set their names like in Exo server?

Now change your topic to [REL] and put some screenshots and examples by using this script.

Share this post


Link to post

1: yes, with no waypoints the bots will default to "wait" mode where they will start following teammates when they see them or sart attacking enemies

2: they dont currently enter or exit cars, but thats definitly a feature worth adding. the issue right now is that bots cant get in or out of cars naturally, id probably have to warp them in and out similar to the way arrested players are in my legalsystem script.

3: thats actually part of the gamemode in that server (whish is written by dragon), which will hopefully be released soon. the bots dont naturally have tags or even names, but its clearly possible ot add that stuff.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.