BotGorge

ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
edited December 2011 in Modding
<div class="IPBDescription">there is lack of bots here ...</div>Hi all,

There was discussion about bots for NS2, therefore I would like to share with you Bot-Gorge.

It's simple right now and pretty stupid bot, but got implemented (somehow) the "follow the path" feature.
I uses the drifter's/Arc's/MAC's pathing.

EDIT - TODO:
- return from resource node back to (nearest) hive
- make gorge do mini cyst chain from hive to res point
- place hydras (randomly?)
- heal self, when damaged
- of course run away from marines :)

Here is code "lua/BotGorge.lua":
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->//=============================================================================
//
// lua/Bot_Gorge.lua
//
// Created by ZycaR
// Chunks of code are inspired/reused/copyied from other NS2 parts to speed up implementation
//
// This class is a gorge bot
//
//=============================================================================<!--c2--></div><!--ec2-->

for usage just add these lines into Bot.lua (similar to test bot):
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        if className == "gorge" then
            class = BotGorge
        end
...
Script.Load("lua/BotGorge.lua")<!--c2--></div><!--ec2-->
«1

Comments

  • 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
    Hopefully someone cleverer than me (ie: not an artist) can test this :) Good job!
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    edited November 2011
    Got it running (link <a href="http://youtu.be/nwmjsJ2_dWQ" target="_blank">here</a>):
    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/nwmjsJ2_dWQ"></param><embed src="http://www.youtube.com/v/nwmjsJ2_dWQ" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>

    Lua files can be downloaded from <a href="http://dl.dropbox.com/u/5490563/mod_gorgebot.zip" target="_blank">dropbox</a>.

    Installation instructions:
    - Download and extract the mod files to your \Steam\steamapps\common\natural selection 2 folder
    - Type "-game mod_gorgebot" in the launch options for NS2

    To get the gorge bot running type these commands into console
    - "cheats 1" (to activate cheats)
    - "addbot 1 2 gorge" (to add one gorge bot to the alien team)

    The addbot command has the syntax of "addbot [# of bots] [bot team] [bot class]" so if you wanted to add multiple bots to the alien team, you could type "addbot 2 2 gorge" to add two gorges, etc.

    Pretty cool, imo :) Good job ZycaR and keep it up!
  • aeroripperaeroripper Join Date: 2005-02-25 Member: 42471NS1 Playtester, Forum Moderators, Constellation
    A pretty good start. Hope you're able to expand it. Ideally gorges should belly slide away when marines get within a certain range of the gorge, or maybe spit at them if far enough away.
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    edited November 2011
    Wow ... thank you ScardyBob for a video! it very helps me see where are the path AI deficit (i.e. in xroads res tower) I should handle it by randomly strafing .. and re-calculating the path.

    The next step will be to make base class for AI path, and then I'll try to make simple mini-cyst placement stuff.
    The weekend is coming :)

    BTW: do anyone know, how to add orders buttons for commander (when he select the GorgeBOt player?)
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    edited November 2011
    <!--quoteo(post=1885523:date=Nov 18 2011, 11:41 AM:name=ZycaR)--><div class='quotetop'>QUOTE (ZycaR @ Nov 18 2011, 11:41 AM) <a href="index.php?act=findpost&pid=1885523"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Wow ... thank you ScardyBob for a video! it very helps me see where are the path AI deficit (i.e. in xroads res tower) I should handle it by randomly strafing .. and re-calculating the path.

    The next step will be to make base class for AI path, and then I'll try to make simple mini-cyst placement stuff.
    The weekend is coming :)

    BTW: do anyone know, how to add orders buttons for commander (when he select the GorgeBOt player?)<!--QuoteEnd--></div><!--QuoteEEnd-->
    No problem :) I'm just excited that someone is working on a functional player bot for NS2. I'd be happy to help test/record video of any future updates of the bot.

    Also, it'd likely be easier for other people wanting to use your mod if you released it in the way I showed above. Its pretty simple to do, just include any lua files that you've modified or updated in the zip file structure I set up. For example, once you update botgorge.lua, just overwrite the botgorge.lua in the zip file, rezip, and release.
  • PricePrice Join Date: 2003-09-27 Member: 21247Members
    edited November 2011
    very nice start!
    But why did you not create a skulk bot?
    It would be very good for unbalanced games.
    anyway good luck!

    Edit:
    Maybe you could use the whip code for attacking?
    The search code of finding a enemy could be taken from minimap?
    So if a teammate see a marine on his map/and view, the bot get alerted there is a enemy and he find a path to him?
    Also the alien commander could command the skulks like drifter and if the marine is in rage, the skulk attack him?
  • Electr0Electr0 Join Date: 2011-10-31 Member: 130337Members
    It's good someone is giving this a go, i was playing around with bots and they're so unless at the moment, i was trying to get them to attack each other in a simple open room map, both the marines and skulks just kept running in a straight line towards the enemy base, occasionally if you got in the way they would chase you, sometimes they would kill each other but mostly they would just run into the command station/hive and thats it, if a wall or object is in the way they can't find their way around.

    I was wondering if along with the gorge bot you could give the basic bots a bit more intelligence, just enough so they can make their way around a map towards the enemy, their main target being other bots and players, structures secondary, as it would make them a lot more fun to play around with.
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    edited November 2011
    today's version is just refactoring of existing code to be better maintained, and new functionality can be added later - faster.
    [change-list:]
    - bot targets are maintained by mixins (as I don't know LUA very well, I hope it's implemented correctly)
    - bot pathing (also re-factored into mixin), use the same path-points as drifter / arc, therefore don't run just straight towards target
    - to draw calculated path, use "dev 1" command in console (to prevent sticky lagging when lines are drawing)
    - into mod I included bottest map (use command "map bottest") it's small map to run faster on cheater machines :)

    <a href="http://dl.dropbox.com/u/50425358/mod_gorgebot2011_11_21.zip" target="_blank">mod_gorgebot 2011/11/21</a>

    EDIT: I do a short investigation how add the commands buttons to bot player (when alien commander select gorge)
    Unfortunately it's impossible to simply overwrite player's entity method GetTechButtons(), because it will overwrite method only on the server's side of code .. and commander (as it's players client side) will don't have buttons :( .. and it looks that UWE must add support for customized buttons it into client's installation.

    Therefore I'll aim to implement some heuristics for better path generation and ability to handle stucking and going around unexpected obstacles.
    Of course cyst placement is on top of implementation list :)
  • SkymanderXSkymanderX Green Marine - The Few, The Proud, The Green. Join Date: 2011-07-29 Member: 113006Members
  • PricePrice Join Date: 2003-09-27 Member: 21247Members
    yeah, very nice you still work on it.
    I have no idea about it, but can you not did a waypoint system (walk y,z,x)and safe it to a luafile for each map?
    so the bot just call the waypointsystem and move/jump/crouch and on?
    my english sucks i mean something like "ghost-pathing" you walk as a gorge through the map, save it and the gorge-bot can read the data.
    For example if hive at datacore under attack, he choose the shortest waypoint path to the hive and heal the hive, place hydras at (before marked good ) places.
    So like the rcbot works or other bots in other games.
    Maybe the bot can learn with that?
    the human-players play the game, the bot save in the lua file or txt file "how people dostuff"?
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    <!--quoteo(post=1886152:date=Nov 22 2011, 11:29 AM:name=Price)--><div class='quotetop'>QUOTE (Price @ Nov 22 2011, 11:29 AM) <a href="index.php?act=findpost&pid=1886152"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->yeah, very nice you still work on it.
    I have no idea about it, but can you not did a waypoint system (walk y,z,x)and safe it to a luafile for each map?
    so the bot just call the waypointsystem and move/jump/crouch and on?
    my english sucks i mean something like "ghost-pathing" you walk as a gorge through the map, save it and the gorge-bot can read the data.
    For example if hive at datacore under attack, he choose the shortest waypoint path to the hive and heal the hive, place hydras at (before marked good ) places.
    So like the rcbot works or other bots in other games.
    Maybe the bot can learn with that?
    the human-players play the game, the bot save in the lua file or txt file "how people dostuff"?<!--QuoteEnd--></div><!--QuoteEEnd-->
    yeah and more thinks coming:
    .. yesterday I reconsider the calculation of distance, not to do it by simple triangular distance between two points but use the "valid" path length,
    because i.e. sometimes the resource door behind the closed door isn't the nearest one :)

    .. today morning I was able to manage the parent cyst finding and tracking ... then gorge can do mini-cyst trail to nearest resource point.

    I don't build the waypoints or simmilar stuff. I'm using build-in function to get path between two points of interest (usually gorge model and target) .
    The returned path consist of waypoins (the path is and red line on the video, and waypoints are that blue lines on path)
    Also pathing works (as far as I know) on ray tracing from destination to source ... but as I sad it's UWE stuff - simmilar to Drifter, MAC or ARC.
  • Electr0Electr0 Join Date: 2011-10-31 Member: 130337Members
    edited November 2011
    Just wondering will you add some basic intelligence to the other bots or is this just for the gorge?

    I think it would be great if you could make the basic bot code work so they can find their way around and attack the enemy.
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    <!--quoteo(post=1886463:date=Nov 24 2011, 05:32 AM:name=Electr0)--><div class='quotetop'>QUOTE (Electr0 @ Nov 24 2011, 05:32 AM) <a href="index.php?act=findpost&pid=1886463"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Just wondering will you add some basic intelligence to the other bots or is this just for the gorge?<!--QuoteEnd--></div><!--QuoteEEnd-->Right now I'm working mostly on gorge bot. But as I'm looking into my code, there are mix-ins which can be easily implemented (aggregated) into other bots classes.

    The Khaa side classes of NS are so different that implementing more than one class for one bot will blob up the code very drastically. and unfortunately my LUA programming skills consist only of 2 days looking into NS2 LUA code .. sorry 2 and 1/2 because of today :)
  • BJHBnade_spammerBJHBnade_spammer Join Date: 2005-02-25 Member: 42431Members
    edited November 2011
    my question is is it possable to run this without using it as a game mode as i would like to run this with the overmind mod.

    or maby you can contact player and have him add it to his overmind mod.
  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    edited November 2011
    Taking a quick glance at the mod, you should be able to just copy its files into the GmOvrmind-directory without issue.
  • BJHBnade_spammerBJHBnade_spammer Join Date: 2005-02-25 Member: 42431Members
    dosent seam to follolw any path it will only go in a strait line to where it is ordered to go so im not sure if it is even working. can you get it to run without using the game mode and just copying or over writing game files. so it can be run directly.
  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    You can, just copy-paste everything into the "ns2"-directory. To revert this, you'll have to do an integrity check through Steam and may also have to manually delete some files BotGorge newly introduces.
  • SN.WolfSN.Wolf Join Date: 2010-03-29 Member: 71115Members
    Can this be used on a dedicated server without cheats on or client installations?
  • zexzex Join Date: 2009-10-07 Member: 68978Members
    would be sweet as a gamemode, I guess it makes the human and alien commanders gameplay more similar. More RTS-y than default.
  • BJHBnade_spammerBJHBnade_spammer Join Date: 2005-02-25 Member: 42431Members
    no it already is run as a game mode and i dont want to have to as i would rather have overmind running. does the gorge bot only follow orders and not move by its self? for me it just keeps spinning around in place and not move unless given a move order. and other than that that is all you can do is tell it to move.
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    sorry for that ... build 188 change something, I'm trying to fix it now.
  • WombatLOLWombatLOL Join Date: 2011-11-30 Member: 136042Members, Reinforced - Shadow
    This isn't dead is it? ;_;
  • PricePrice Join Date: 2003-09-27 Member: 21247Members
    i hope not.
    But give him time to fix!
    some people have a real life between gaming ^^
  • WombatLOLWombatLOL Join Date: 2011-11-30 Member: 136042Members, Reinforced - Shadow
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    hey sorry guys, It's not a dead, but I have really good news!!!

    ... my daughter was born, as Price says real life is now a little bit important ...
  • SN.WolfSN.Wolf Join Date: 2010-03-29 Member: 71115Members
    Congrats!!! Mine just turned 16 so trust me when I tell you this. Enjoy every minute of the cuteness because the evilness will follow soon enough...hahahaha!
  • PricePrice Join Date: 2003-09-27 Member: 21247Members
    Yeah, Congratulations!

    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->The little cute baby is crying all the time in the cradle. The mother take the little cutie on her arms and start to sing.
    After half hour her Husband said to her "please put the baby back in the cradle, that was way better".<!--QuoteEnd--></div><!--QuoteEEnd-->
  • WombatLOLWombatLOL Join Date: 2011-11-30 Member: 136042Members, Reinforced - Shadow
    Woah good to hear!!!!


    *cough* Now slave, build me a bot.

    /jk
  • pSyk0mAnpSyk0mAn Nerdish by Nature Germany Join Date: 2003-08-07 Member: 19166Members, NS2 Playtester, Squad Five Silver, NS2 Community Developer
    Congrats.

    Now you've gotta build a BotDad so you can continue BotGorge.
  • ZycaRZycaR Join Date: 2002-11-12 Member: 8263Members
    edited December 2011
    huray!!! ... it actually works again!

    Gorge finally finding parent cyst ! (where chain of mini-cysts can start)
    ... and what is more important, he building cysts to nearest resource tower :)

    It's still beta (as whole NS2) then sometimes can gorge hangs and of course, when he don't have resources, then he stops and wait for them :)


    <a href="http://dl.dropbox.com/u/50425358/mod_gorgebot2011_12_05.zip" target="_blank">mod_gorgebot2011_12_05</a>
Sign In or Register to comment.