Official NS2 bot

1235

Comments

  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    edited November 2012
    Alright, I've done a major overhaul of the navigation system now.. from my first tests they're a lot better at reaching their target, they're not getting stuck anymore finally :)

    Now it's time to make them properly attack targets in sight :)

    <a href="https://github.com/Borsty/NS2Bot" target="_blank">https://github.com/Borsty/NS2Bot</a>
  • MaxunitMaxunit Join Date: 2005-02-01 Member: 39414Members, Reinforced - Shadow
    Yep, noticed that as well. They build everything else fine tho, in 99% of the case.
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    edited November 2012
    Ok I've found the problem that was causing this, Vector:GetLength() and Vector:GetLengthXZ() are two completly different things and should not be mixed :V
    Pushed the bugfix already :)

    <i>Note: to get rid of message spam in console, set dev back to 0 once bots have been added</i>
  • SeidrSeidr Join Date: 2012-11-18 Member: 172261Members
  • SeidrSeidr Join Date: 2012-11-18 Member: 172261Members
    edited November 2012
    Just tried out the newest build - had to change line 515 in Bot_Jeffco.lua from

    if (not Shared.GetDevMode() && self.stateName ~= name) then

    to

    if (not Shared.GetDevMode() and self.stateName ~= name) then

    ..in order for it to work :)

    Odd, because as far as I know && is the equivalent to the and operator..

    On the plus side, the bots are behaving a lot better now!
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    edited November 2012
    <!--quoteo(post=2028111:date=Nov 18 2012, 09:23 PM:name=Seidr)--><div class='quotetop'>QUOTE (Seidr @ Nov 18 2012, 09:23 PM) <a href="index.php?act=findpost&pid=2028111"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Just tried out the newest build - had to change line 515 in Bot_Jeffco.lua from

    On the plus side, the bots are behaving a lot better now!<!--QuoteEnd--></div><!--QuoteEEnd-->

    Oh crap, that's what you get for unchecked last changes before commiting... And Lua not being your main programming language haha :D
    And thanks!

    I'm refactoring the movement stuff away from the bot AI right now, so we have a solid bot base class where we can build AIs on. Continuing on this might get a little complicated with a thrown together 1000+ lines script :)

    <b>edit</b>
    I changed the repo's file structure to a NS2 mod. Doesn't ###### up ye' ns2 game if you want to play online :)
  • SeidrSeidr Join Date: 2012-11-18 Member: 172261Members
    AI has always interested me as a subject, and being a professional programmer (in a multitude of different languages, so picking up LUA wouldn't be an issue) that loves to blast through little projects, I'll keep the bot in my mind for research / development next week - if I get time!
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    It's coming along nicely :)

    I'm laying out some documentation what I plan on doing (like state trees for each class, yes.. I plan on having one AI for each class). I'll push the changes once verified it's working. I'll also create a new thread for the bot.

    So long, looky here.. the bots can have a chat now :)
    <img src="https://dl.dropbox.com/u/9618970/ns2bot_chat.jpg" border="0" class="linked-image" />
  • MaxunitMaxunit Join Date: 2005-02-01 Member: 39414Members, Reinforced - Shadow
    edited November 2012
    Hey, nice progress there.

    What kind of "Bot Chatter" Engine do you use? Usually there are a few out there. Or is it self-made?
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    <!--quoteo(post=2029272:date=Nov 19 2012, 11:12 PM:name=Maxunit)--><div class='quotetop'>QUOTE (Maxunit @ Nov 19 2012, 11:12 PM) <a href="index.php?act=findpost&pid=2029272"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->What kind of "Bot Chatter" Engine do you use? Usually there are a few out there. Or is it self-made?<!--QuoteEnd--></div><!--QuoteEEnd-->

    It's a pretty simple "detect words others have said" + "don't always react" + "lookup list of reactions" thing.. it's there to have an example for others to write a proper one :)
  • MaxunitMaxunit Join Date: 2005-02-01 Member: 39414Members, Reinforced - Shadow
    Ah yea, the usual "Bot Chatter" variation you see in the old Bots for GoldSrc games/mods like SvenCoop etc pp.
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    edited November 2012
    Alright, I've pushed one of the first larger updates. Still a little edgy but at least it works (in my quick tests)
    It's a lot nicer to edit/extend now. Checkout Bot_Base, Bot_AiUser and ai/BotAI_Marine for how it's done now

    Alien (Skulks) are still on the old codebase (and throwing lua errors when attacking) but that's just until I (or someone else) moved it over to the new system.

    The Marine AI file has some stuff I want to make more generic and put it in the base class (like the tasks system)

    If you're adventurous you can give them a go ;)

    <b>Changelog:</b>

    Massive code refactoring and overhaul
    <ul><li>Reworked most of the bot code, the Marine is almost done (for now), the alien is still the old codebase (and throws some lua errors)</li><li>There's still a lot to do, but this commit should show everyone what's going on :)</li><li>Marines have already become much better players. They actually shoot enemies on sight now :D</li></ul>

    <b>Update 22th Nov 2012</b>

    Further Marine improvements
    <ul><li>Bot's turn on flashlight in areas that are out of power</li><li>Attack behaviour reworked (untested against structures yet)</li><li>Added OnSpawn and OnDeath callbacks to BotAI</li><li>Bug: Aliens are still getting stuck when they try to attack something, not on my priority list right now since it'll be just a copy pasta from the marine AI once it's done</li></ul>
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    edited November 2012
    Commit 22th Nov. 2012

    <b>AttackState improvements</b>

    <ul><li>Marines are way more confident during attack move</li><li>Aliens can attack now (and are deadly as you'd imagine)</li><li>Bots detect when something has been killed</li><li>Using entity Id's now to store targets, gets rid of "Entity no longer exists" error</li><li>Several little improvements</li></ul>

    They're actually in a playable state now, might put a demo video up later :)
  • PMonkeyPMonkey Join Date: 2012-10-09 Member: 161932Members
    Great stuff.

    Roles seem to have reversed now. It was once the Marines that stayed in the base, while Aliens would "hunt".
    Now my Aliens stay by the Hive while the Marines to out. This was on Tram, not sure if the pathing is different for each map?
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    <!--quoteo(post=2032496:date=Nov 22 2012, 10:27 PM:name=PMonkey)--><div class='quotetop'>QUOTE (PMonkey @ Nov 22 2012, 10:27 PM) <a href="index.php?act=findpost&pid=2032496"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Great stuff.

    Roles seem to have reversed now. It was once the Marines that stayed in the base, while Aliens would "hunt".
    Now my Aliens stay by the Hive while the Marines to out. This was on Tram, not sure if the pathing is different for each map?<!--QuoteEnd--></div><!--QuoteEEnd-->

    I'm looking into this now.. wasn't before I uploaded the update heh..
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    It shall be fixed now

    <b>Quick fixes</b>

    <ul><li>Fixed Alien random walk</li><li>Added death chat</li><li>Pathfinding now takes a more distant first navpoint instead of start, fixes marines running in circles when given an order</li></ul>
  • white_jaguarwhite_jaguar Join Date: 2010-04-17 Member: 71439Members, Reinforced - Shadow, WC 2013 - Gold
    Looking really good! :)

    So I did notice a few things (while playing as a marine commander on summit):
    <ul><li>Alien bots freeze up when attempting to attack arcs as the arcs deployed. (I was able to walk right up and blast them with no retaliation)</li><li>When giving a bot a move order for a target a few rooms away, it appears that it either ignores the order or can't find its way to the target.</li><li>A few times when I sent a bot to guard a room with a power source, the alien skulk and my bot would make contact (ie: be side by side) near the power souce and both would just sit there. When I gave my bot a move order, then they both unfroze and my bot would get killed because it was moving instead of attacking.</li><li>When selecting a group of soldiers and giving them an order, only one of the bots follows the order, instead of the whole group...? (Maybe I had a building selected as well, but I was pretty sure I only had the soldiers selected)</li><li>When trying to select a bot, it can be a little difficult with them running around in circles all the time. Is there a way to make them "pace" between points and stop before moving to the next point instead of spinning around in circles around my command chair?</li><li>Also noticed that the skulk AI seems to be a little dumb at the moment, as it runs in predictable paths all the time. (Though I believe that is something you're already planning on changing with the unit specific AIs)</li></ul>
    All in all, this is a great start to an official AI mod! Thanks for the work you're putting into this Borsty, it's really appreciated! :)
  • joemama57joemama57 Join Date: 2012-11-27 Member: 173460Members
    Hey guys, great work on the bots. I can see them getting better and better very soon!

    One question

    Is there a way to add more then 10 bots?

    Keep the updates coming!!
  • dissectiondissection Join Date: 2012-11-14 Member: 170914Members
    edited December 2012
    thx borsty.

    This should have been a thing to be in the game before final release i think. Its so vital for understanding the game without the embarrassment with other players. Actually this could encourage a lot of players to stay in the game who otherwise might be intimidated by it too much.

    is that in a state where i can use it to practice some basic commander gameplay? And do they have difficulty settings yet, so i wont have to encounter 100% perfect aim?
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    edited December 2012
    @white_jaguar Thanks for those points, will look into them when I find the time :)
    @joemama57 I don't know why it wouldn't work with more than 10 bots.. I'll have a look myself soon
    @dissection Yeah they are in a state to practice commander gameplay (at least the marine side), they're a little stupid sometimes still but they'll get the job done :)

    There's no difficulty setting right now, marine AI doesn't have a perfect aim, skulk AI will mow you down when it got up to you (and recognizes you as a target :p)

    I've got quite a lot to do at the moment so please don't be sad when there aren't any updates for some time. It's still open to everyone to fork the git repository, make changes, publish or send me pull requests. This is still an open source thingy :)

    <b>Edit</b>
    Ok, I increased the bot limit to 32 (I have the bad feeling we'll run into performance issues there) and fixed a little bug regarding bot chatter.
  • nankuranankura Join Date: 2009-06-22 Member: 67896Members
    edited December 2012
    borsty great work on the bots, id love to see you implement odenbot into this project so both sides have an AI commander

    I really hope your still actively working on this project, you have great potentiol to turn this into an extremely intelligent bot AI system

    also i followed your instructions to the letter, everything in my common/natural selection 2 folder is properly setup, i have a seperate folder in there named ns2bot as stated to run it as a mode

    i went into steam launch propertys and set -game ns2bot

    and when i loadup any map using the create a server tool, the addbot commands dont do anything, i tried addbot 5 and addbot marines, so im curious what im doing wrong here

    though i did notice my natural selection 2 is the deluxe edition and has a different file structure than what the game_setup.xml is pointed to, i have alot of lua folders all over the place

    my folder structure looks a little like this

    builds
    core
    deluxe edition
    explore
    lua_test
    ns2
    ns2bot
    redist
    utils

    i tried moving ns2bot to the ns2 folder. still didnt want to work
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    <!--quoteo(post=2039440:date=Dec 3 2012, 10:41 PM:name=nankura)--><div class='quotetop'>QUOTE (nankura @ Dec 3 2012, 10:41 PM) <a href="index.php?act=findpost&pid=2039440"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->also i followed your instructions to the letter, everything in my common/natural selection 2 folder is properly setup, i have a seperate folder in there named ns2bot as stated to run it as a mode

    i went into steam launch propertys and set -game ns2bot

    and when i loadup any map using the create a server tool, the addbot commands dont do anything, i tried addbot 5 and addbot marines, so im curious what im doing wrong here<!--QuoteEnd--></div><!--QuoteEEnd-->
    Don't forget to enable developer mode when running a local game (dev 1 in console)
    After that you can use addbot, addbots n, setbots n, removebot, removebots n
  • nankuranankura Join Date: 2009-06-22 Member: 67896Members
    edited December 2012
    all is working

    ive noticed you have Marine commander and alien commander AI Scripts, and im wondering has AI commanding been implemented and how do i activate it

    If not, i suggest looking into odenbot and adding AI commanders, i know you have prioritys, been not having to be commander myself personally would allow me to test the AI more thoroughly and watch there movements closely

    another note: there is alot of different attempts and posts of bots in this thread, and people submitting there work, if u guys all joined forces to make a bot, im sure u could push out a pretty amazing bot pretty quickly
  • XanthusXanthus Join Date: 2012-11-15 Member: 171510Members
    Fantastic work! I'm not great at programming so I probably won't be able to do anything, but I'll take a look and see if there is possibly anything I can help with.
  • joemama57joemama57 Join Date: 2012-11-27 Member: 173460Members
    Thx for increasing the limit !! Like you said, there are some stability issues. For instance, it crashed after about 3 or 4 min of gameplay with about 20 something bots..not sure exactly what caused it but it seemed to happen after i was commanding a large number of bots at once. Great work tho!! Thx
  • nankuranankura Join Date: 2009-06-22 Member: 67896Members
    no reply for a while, any word on progress?
  • BorstyBorsty Join Date: 2009-11-24 Member: 69500Members
    <!--quoteo(post=2047964:date=Dec 19 2012, 11:17 AM:name=nankura)--><div class='quotetop'>QUOTE (nankura @ Dec 19 2012, 11:17 AM) <a href="index.php?act=findpost&pid=2047964"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->no reply for a while, any word on progress?<!--QuoteEnd--></div><!--QuoteEEnd-->

    Working on my thesis, not much time :)
    But I'll come back with updates when it's time ^^
  • bonoryebonorye Join Date: 2002-11-10 Member: 7998Members
    A quick shout out to you guys working on this, THANK YOU. Your work is much appreciated.
  • THE KILLER1220THE KILLER1220 Join Date: 2013-01-03 Member: 177245Members
    ERROR-couldnt find the folder ns2 was installed in
    please help i dont know how to fix it
  • OwnkruidOwnkruid Join Date: 2013-01-02 Member: 177090Members
    Does this run on a dedicated server? If so, how? Thanks!
Sign In or Register to comment.