Official NS2 bot

FlayraFlayra Game Director, Unknown Worlds EntertainmentSan Francisco Join Date: 2002-01-22 Member: 3Super Administrators, NS2 Developer, Subnautica Developer
<div class="IPBDescription">Are you up for writing one?</div>Hey everyone,

One of the things I really want to get into NS2 v1.0 is a basic bot, which players can use primarily for learning how to command. Right now there's no shame-free way to learn to command, and this will be exacerbated in NS2 now that both teams need a commander. As you guys know, we are a very small team and I don't know if we're going to have the resources to devote to a bot like this. However, a community member named Clamatius wrote <a href="http://whichbot.sourceforge.net/" target="_blank">WhichBot for NS1</a> which became widely played and was really awesome....which brings me to why I'm posting here.

I think someone in our community should write a bot that we could ship officially with the game.

We've already got basic bot support in the game and of course we are already shipping all the NS2 source code, as it's all Lua. If you look in Bot.lua, Bot_Player.lua and BotTest.lua, you can see how we've got very simple bots running around so far. There you'll see code for having bots ask for orders, medpacks, ammo and perform basic movement. You can test this out by turning on developer mode (dev 1 in the console) and then typing "addbots x y" where x is the number of bots and y is the team (1 is marines, 2 is aliens).

We really would need our bot to act like a very basic player in every way. A player should be able to add around 11 bots to the server and they would fill out both teams equally, and take up any roles that are needed. Ie, they would do a very basic job commanding if your team needed a commander. They would build nearby structures if they are marines. One would evolve to a gorge and build cysts if your team didn't have any. They would explore the map looking for the enemy. They would use voice comms and ask for orders. They would often follow orders (but not always and not exactly), like real players. All this would add up to a way that players could get a basic feel for the game and comfort with the tech tree and the commander role, without being embarrassed online.

We have pathfinding support ready to use (PathingMixin.lua) and everything you should need to be able to write a bot that fits this description. I'm not sure how much work it would be, but getting something very basic doesn't seem like a gargantuan task to me. I would be extremely pumped if we could find a promising programmer here that wanted to take this project on, and then work with them to completion. I'm sure we can figure out an arrangement that would work for both of us, but the important thing is that we see you make some progress on your own first. I'll be checking this forum regularly to see if anyone makes any good progress, and then we can take it from there.

Anyone game?
«13456

Comments

  • ZekZek Join Date: 2002-11-10 Member: 7962Members, NS1 Playtester, Constellation, Reinforced - Shadow
    For what it's worth bots could also help a ton for populating servers, which was always a big problem in NS1 where the game isn't fun at all without at least a few players on each team. Being able to configure a minimum player count for a server below which bots will fill gaps on the teams would make all the difference.
  • SN.WolfSN.Wolf Join Date: 2010-03-29 Member: 71115Members
    Are you wanting a bot to do commander role also? RCBOT was always my first choice running with the comai.amxx to do that job but the upgrades where already in place from round start. The pathing mesh is already in so that cuts a big chunk of time out of a bot program. Might pitch this at <a href="http://www.bots-united.com/" target="_blank">http://www.bots-united.com/</a> , some very talented group there.
  • McGlaspieMcGlaspie www.team156.com Join Date: 2010-07-26 Member: 73044Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Onos, WC 2013 - Gold, Subnautica Playtester
    edited December 2011
    SN.Wolf raises and interesting point. Charlie, it would probably help if we had a specific list of things the bots should be able to do, or at least roles they should be able to perform.

    I've been looking into this in my free time (what little there is), and am quite interested in this. I can't say I'll be able to actually produce anything. My plan was to use the original Reaper Bot from Quake 1 days and inspiration on how to tackle the design. Considering any NS2 bots will need to have an extremely good understand of their surroundings and tactical aspects of the game, this won't be an easy task.
  • ZeikkoZeikko Join Date: 2007-12-16 Member: 63179Members, Squad Five Blue, NS2 Map Tester
    I was encouraged by the effort you spent on explaining how to get started and here's what I have after two hours of tinkering: <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/58voe5PreIM"></param><embed src="http://www.youtube.com/v/58voe5PreIM" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>
    It's no way working but i thought it was funny enough to take a video to post it. Looks like the bot has had little bit too much coffee or some other substances. :D
    The pathfinding seems to work well but i have no idea why the speed is off and why is it turning around all the time. Well I guess it's time to delve deeper.
  • jeffcojeffco Join Date: 2011-02-14 Member: 81785Members
    Here is a simple marine bot that uses the pathing system and builds unbuild structures. But unfortunately, I am not sure if I have enough time on my hands to add more features...
  • ZeikkoZeikko Join Date: 2007-12-16 Member: 63179Members, Squad Five Blue, NS2 Map Tester
    <!--quoteo(post=1891469:date=Dec 24 2011, 01:20 AM:name=jeffco)--><div class='quotetop'>QUOTE (jeffco @ Dec 24 2011, 01:20 AM) <a href="index.php?act=findpost&pid=1891469"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Here is a simple marine bot that uses the pathing system and builds unbuild structures. But unfortunately, I am not sure if I have enough time on my hands to add more features...<!--QuoteEnd--></div><!--QuoteEEnd-->
    Thanks mate! I will look into it!
  • Evil_bOb1Evil_bOb1 Join Date: 2002-07-13 Member: 938Members, Squad Five Blue
    Lol Zeikko! Charlie wants a basic bot, not a pro-player bot. That bot has clearly mastered bunny-hopping and is completely aware of his environment spinning like a radar sweep :p
  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    <!--quoteo(post=1891468:date=Dec 23 2011, 09:21 PM:name=Zeikko)--><div class='quotetop'>QUOTE (Zeikko @ Dec 23 2011, 09:21 PM) <a href="index.php?act=findpost&pid=1891468"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I was encouraged by the effort you spent on explaining how to get started and here's what I have after two hours of tinkering:
    It's no way working but i thought it was funny enough to take a video to post it. Looks like the bot has had little bit too much coffee or some other substances. :D
    The pathfinding seems to work well but i have no idea why the speed is off and why is it turning around all the time. Well I guess it's time to delve deeper.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Either you just found a way to exploit the current movement-system, or you're allowing the bot to move faster than other clients. Bots run on the Server-VM, which means they can do whatever they like pretty much, without being corrected (eg. warped back).

    What I guess Flayra is asking for is a very rudimentary bot, that can perform basic tasks (like for a gorge to heal nearby structures\teammates; try and fix broken DI and drop the occasional hydra here and there). I'm thinking the community will put out a superior bot in due time most likely (I might have a go it myself at some point), but I speculate the devs values having at least some kind of mechanic in there to ship with the retail-version, no matter how simple, so as to not be completely dependant on a third-party to provide it.

    I still think a combat-mode is a better way to bridge the gap between a low and high player-count.
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    you move bot by moving his origin? or use standard input system to simulate the forward key pressing?
    The moving of origin is wrong, thats how the drifters move, and it doesn't give you feeling of "player"..

    Please look at my gorgebot, where I simulate the movement "by move command to the forward" .. in same way as player bot do.
    BTW: Regarding the spinning ... looks like you don't subtract the base yaw and base pitch from "player" object's orientation. (that's already fsolved in gorge bot too... :))
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    2 Charlie:
    Is there a chance to modify path-finding procedures input arguments ... to allow put/modify there maximum height differences between two waypoints (for skulk wall / vent climbing waypoints)
  • ZeikkoZeikko Join Date: 2007-12-16 Member: 63179Members, Squad Five Blue, NS2 Map Tester
    <!--quoteo(post=1891473:date=Dec 24 2011, 03:48 AM:name=Evil_bOb1)--><div class='quotetop'>QUOTE (Evil_bOb1 @ Dec 24 2011, 03:48 AM) <a href="index.php?act=findpost&pid=1891473"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Lol Zeikko! Charlie wants a basic bot, not a pro-player bot. That bot has clearly mastered bunny-hopping and is completely aware of his environment spinning like a radar sweep :p<!--QuoteEnd--></div><!--QuoteEEnd-->
    I assure that all these "features" were unintended. :P

    <!--quoteo(post=1891503:date=Dec 24 2011, 01:16 PM:name=ZycaR)--><div class='quotetop'>QUOTE (ZycaR @ Dec 24 2011, 01:16 PM) <a href="index.php?act=findpost&pid=1891503"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->you move bot by moving his origin? or use standard input system to simulate the forward key pressing?
    The moving of origin is wrong, thats how the drifters move, and it doesn't give you feeling of "player"..

    Please look at my gorgebot, where I simulate the movement "by move command to the forward" .. in same way as player bot do.
    BTW: Regarding the spinning ... looks like you don't subtract the base yaw and base pitch from "player" object's orientation. (that's already fsolved in gorge bot too... :))<!--QuoteEnd--></div><!--QuoteEEnd-->
    Yes I moved the bot by setting the origin just like drifters and MACs. I figured out the the movementand yaw & pitch bugs from your and Jeffco's code. Thanks!
  • jeffcojeffco Join Date: 2011-02-14 Member: 81785Members
    Well... i accidentally added some more features like basic alien support and auto attacking to my bot.

    happy x-mas or whatever!
  • ZeikkoZeikko Join Date: 2007-12-16 Member: 63179Members, Squad Five Blue, NS2 Map Tester
    <!--quoteo(post=1891539:date=Dec 24 2011, 08:23 PM:name=jeffco)--><div class='quotetop'>QUOTE (jeffco @ Dec 24 2011, 08:23 PM) <a href="index.php?act=findpost&pid=1891539"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Well... i accidentally added some more features like basic alien support and auto attacking to my bot.

    happy x-mas or whatever!<!--QuoteEnd--></div><!--QuoteEEnd-->
    I also spent some time extending your script with auto attack, independent movement, knife fighting and some other stuff.

    Here's a video of a test session I had. It didn't lag like that when playing without Fraps but I guess bad scripting from my part plays a part in the lag too.
    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/ZI1gE4-9A74"></param><embed src="http://www.youtube.com/v/ZI1gE4-9A74" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    lol ... game actually already contains "auto" order system. The orders for build / attack nearby structures is automatically generated.
    I can use it!

    2 Zeikko: did your bots recalculate path, when is blocked ? (just curious)
  • ZeikkoZeikko Join Date: 2007-12-16 Member: 63179Members, Squad Five Blue, NS2 Map Tester
    <!--quoteo(post=1891612:date=Dec 25 2011, 05:28 PM:name=ZycaR)--><div class='quotetop'>QUOTE (ZycaR @ Dec 25 2011, 05:28 PM) <a href="index.php?act=findpost&pid=1891612"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->lol ... game actually already contains "auto" order system. The orders for build / attack nearby structures is automatically generated.
    I can use it!

    2 Zeikko: did your bots recalculate path, when is blocked ? (just curious)<!--QuoteEnd--></div><!--QuoteEEnd-->
    No it doesn't. In the video they get stuck in crossroads for example. This kind of recalculation would be a great feature for all bots, MACs and drifters.
  • ObraxisObraxis Subnautica Animator & Generalist, NS2 Person Join Date: 2004-07-24 Member: 30071Super Administrators, Forum Admins, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Silver, WC 2013 - Supporter, Subnautica Developer, Pistachionauts
    Hey guys, this is GREAT work so far. Keep it up! I would love to see a community effort on the Bot :)
  • jeffcojeffco Join Date: 2011-02-14 Member: 81785Members
    Version 0.2 - Added random walking and various bugfixes

    Now it starts getting complicated. It would be cool use bots to populate a server and to remove them automatically when normal player join the game. Therefore, a bot should know how to build an infantry portal since marines cannot spawn otherwise. I have no idea how to add such a feature...
  • SN.WolfSN.Wolf Join Date: 2010-03-29 Member: 71115Members
    <!--quoteo(post=1891701:date=Dec 26 2011, 07:24 AM:name=jeffco)--><div class='quotetop'>QUOTE (jeffco @ Dec 26 2011, 07:24 AM) <a href="index.php?act=findpost&pid=1891701"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Version 0.2 - Added random walking and various bugfixes

    Now it starts getting complicated. It would be cool use bots to populate a server and to remove them automatically when normal player join the game. Therefore, a bot should know how to build an infantry portal since marines cannot spawn otherwise. I have no idea how to add such a feature...<!--QuoteEnd--></div><!--QuoteEEnd-->

    The bot would have to have an impulse to build the Infantry Portal much like the impulse to attack enemy target and would have to be set by the mapper and allowed by game configs to be set to true on servers using bots. However the impulses would need to be set in priority

    1. Attack/Defend
    2. Build/Repair
  • KoruyoKoruyo AUT Join Date: 2009-06-06 Member: 67724Members, Reinforced - Shadow
    Awesome stuff guys!

    The "bhop pro bots" oh lol - made my day :B
  • BJHBnade_spammerBJHBnade_spammer Join Date: 2005-02-25 Member: 42431Members
    lol too bad they have a sortive aim bot accuracy. them being like that makes the marine bots too power full
  • HarimauHarimau Join Date: 2007-12-24 Member: 63250Members
    ^
    Adding artificial reaction time, target prioritisation, non-omniscient (limited; only sees what is in the player's view) awareness with short-term memory (so it doesn't lose targets immediately), and non-omniscient (estimated) target movement prediction - to simulate player behaviour; is it possible? Practical?
  • BJHBnade_spammerBJHBnade_spammer Join Date: 2005-02-25 Member: 42431Members
    edited December 2011
    other games do it i dont see why not.
    just make it so they can only shoot what is in there line of sight for one and stop them from spazzing out and doing 360s all the time
    a simple scripted ai is all we really need. not anything like the bigger budget games

    although im sure people will want to make them some what challenging
  • SN.WolfSN.Wolf Join Date: 2010-03-29 Member: 71115Members
    RCbot and Witchbot where simple bots, The key to balancing was a combination of how well the maps where waypointed and what plugins where used. RCbot was a bit more complex as each bot had it's own config (fav. map,skill....) and these bots along side hivemind work very good. especially with combat mode.

    Maybe the rcbot would be a better bot to look at as far as AI intelligence, Particularly the hal.brn and how they work with the .RCR and .rld files.

    Example of one of my RCBOT Profiles (Bot with top kills Overall)

    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->name="Super Wolf Bot"
    favmod=2
    favteam=1
    favmap="ns_nothing"
    skill=98
    spray="tent"
    gorge_percent=24
    lerk_percent=20
    fade_percent=14
    onos_percent=19
    numgames=0
    hal_pretrain_file="common_hal.trn"               [i](Random Phrases Entered by bot to text chat during game)[/i] I often see people arguing with bots in my servers.
    hal_aux_file="common_hal.aux"                    [i] (Controls General Chatter Triggered by key words typed in by players)[/i]
    hal_ban_file="common_hal.ban"                        [i](A filter for chatter to ignore key words for triggers, EX: Profane or abusive words)[/i]
    hal_swap_file="common_hal.swp"<!--c2--></div><!--ec2-->

    Also map specific configs (changing cvars and balance for each map on server)

    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--># you can change HL cvars
    # change time limit
    mp_timelimit 90
    # you can change other bot things
    rcbot config max_path_revs 100
    rcbot config chatting 1
    # you can add some bots.
    # add 3 bots
    #team 1
    #rcbot addbot 0
    #team 2
    rcbot addbot 2
    #auto-team
    #rcbot addbot<!--c2--></div><!--ec2-->

    I know this bot is for NS1 but it worked so well for a number of source based game mods and it may be something to look into for ideas.
  • BJHBnade_spammerBJHBnade_spammer Join Date: 2005-02-25 Member: 42431Members
    edited December 2011
    i agree about rc_bot i used it for every game i ever played that was a half life mod. waypointing for it was always fun.

    but since we no longer have to waypoint as the maps already have the waypoint system implemented (except for walls, ladders and possibly vents) how hard would it be to convert something like rc_bot over to ns2
  • JibrailJibrail Join Date: 2009-04-16 Member: 67200Members
    good stuff guys am loving this kind of community effort, keep it up!
  • vizioNzvizioNz InversionNS2.com Join Date: 2003-12-21 Member: 24595Members, Constellation, NS2 Playtester
    <a href="http://unknownworlds.com/forums/index.php?showtopic=115772" target="_blank">http://unknownworlds.com/forums/index.php?showtopic=115772</a>
  • ZeikkoZeikko Join Date: 2007-12-16 Member: 63179Members, Squad Five Blue, NS2 Map Tester
    So here's a video of a test i did with the bots i wrote yesterday.
    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/djahFGgMICc"></param><embed src="http://www.youtube.com/v/djahFGgMICc" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>
    In the beginning you see marines obeying orders, moving, building stuff, etc. That code is mostly written by Jeffco. Later you will see me joining to the alien side and trying fighting against the marines as a skulk. Most of the attack, aim, targeting, following and "ambushing" stuff is written by me and UWE.

    <a href="http://zeikko.fi/ns2/Bot_Zbot.lua" target="_blank">You can see the code here.</a>
  • SN.WolfSN.Wolf Join Date: 2010-03-29 Member: 71115Members
    edited December 2011
    A great start, seems they have a fear of breaking away from the squad to follow orders individually? They also seemed to be unable to react to sound and only attacked if in LOS or to counter an attack. Every bot I ever used was able to detect sounds with a configurable radius (not seeing this in code), is this something that can be done? You guys are really hammering this out and it's looking great!! I hope the bots will be configurable for skill levels, Either predetermined or by server configs,bot specific preferably as it adds a lot of element when you fear one bot more than another. In my server, when "super wolf bot" was sporting HA with HMG it was time to stick together and the regulars knew this!

    EDIT: Witchbot----> <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[../engine]
                    # radius within which sounds can be heard from the sound source location
                    hearing_radius=1200.0<!--c2--></div><!--ec2-->
  • HarimauHarimau Join Date: 2007-12-24 Member: 63250Members
    edited December 2011
    Shouldn't it also be a function of intensity? Actually, local intensity... which would be a function of the distance AND the source intensity... actual sound intensity as a function of distance from source necessarily already exists in the engine, but intensity might not be measurable and actual intensity could just be a hard-implementation... If you could get it in though, it would be more realistic. Otherwise, hearing radius is a fairly reasonable, and practical, estimation.
  • BJHBnade_spammerBJHBnade_spammer Join Date: 2005-02-25 Member: 42431Members
    ok so what thread is the correct ns2 bot one or are they separate for a reason?
Sign In or Register to comment.