Page 1 of 2

bot improvements mod

Posted: Sun May 16, 2021 10:04 pm UTC
by freem
Hello.

I am now hosting a mod which targets bot's improvements. The goal is to have them as smart as possible, by harvesting the low hanging fruits first. The server is set with teams of 5 bots which are at skill level 7 (their skill range starts at 1 and ends at 9, so they're not at their best, but they're rather strong, for bots).
I intend to keep this post updated as I add elements on my TODO list or when I implement things. Feel free to comment on my ideas or to provide your own ideas, I'll try to implement everything I can to make bots as fun as possible to fight, and tools which don't just feed enemy's team if not explicitly asked for (by servers owners).
The behaviors should be affected by their individual botSkill value when it makes sense.

Currently, following changes are implemented:
  • human bots can buy light armors at stage 0 (they can not on vanilla)
  • human bots mix flamers and pulse rifles (they can not buy pulse rifle on vanilla)
  • human bots won't buy radars if that means that more than 75% of the team will have one
  • human bots run when their target is friendly. This means they will run when going to armory for equipment, when going to medistation for healing, and when trying to repair things
  • marauders jumps to flee faster
  • tyrants charge to flee faster
  • mantis and dragoons pounce to flee faster
  • rushScore is now calculated by considering the total credits bots (bot aliens and humans) have (including already owned evolutions), the maximum credits they can spend in current stage, and their skill: the more skilled they are, the less likely they will rush if that means they can't buy decent evolutions when they die.
  • they should be able to use grenades
  • bots decision to go to heal is no longer affine and depends on their skill. That mean that, if they're slightly hurt (say, at 95% health) but close to medistation, they will go there to heal before moving on.
  • human bots will equip (armors, backpacks, grenades) before going to repair stuff
  • human bots now defend their base instead of waiting for medistation to be free (range might be improved)
  • don't throw grenades or firebombs if close enough to reactor
  • Have a minimum health percentage to evolve for aliens (maybe sell stuff for humans until healed?).
  • Have bots evolve even at low health: limitation is based on healScore < 0.5, which depends on the skill.
  • Have bots do fast retreat at high skill only. (no fast retreat below skill 5)
  • if close enough to reactor, owning a luci and attacked, buy pulse rifle to repel invaders
Changes that are planned (but don't hold your breaths):

  • distances should not be about Euclidean distance, but about the navmesh's size between bot and target
  • bots should be able to place back critical buildings (spawns, RC/OM, armory, medistation, booster) in some conditions (this include being able to spawn as builder)
  • bots should defend builders instead of rushing or roaming when number of critical buildings is too low
  • they should be able to wallwalk and use jetpacks
  • roaming distance should depend on their status (skill, health, money, etc)
  • new actions: raid and defend. When rush, target enemy's critical buildings. When raid, target defenses. WHen roaming, just wander. When defending, stay close to base.
  • players of same team should be able to give them basic instructions (defend here, defend main base, roam, raid, rush, follow me)
  • bots should be able to reload depending on situation and skill level
  • bots should be able to play grouped
  • a good rush implies to not rush alone: require at least N% of team raiding to switch their action to rush.
  • don't fight acid tubes on melee, instead, move back out of range
  • move (if possible) when fighting buildings damn it!
  • jump over stairs, fences, etc (shortcuts in various maps)
  • ability to use covers from walls or friends
  • aliens able to target human buildings on heights
  • when a ranged attack is available, backpedal when retreating, except when reloading or really low hp (faster when moving forward)
  • Switch to blaster when target is too far to be reached with current weapon
  • Don't pursue for ages when main weapon is a CKit (and switched to blaster to defend)
  • Fix pain saw estimated range, when buildings are on walls or ceilings. I suspect this one is because the building's perception might, in practice, be "projected to ground".

Partially implemented:

  • humans bots should not queue at medistation.
    -> They queue, but fight back if enemy is close enough. This triggers a problem when wearing radars in vertical maps, though, which makes bots endlessly going to heal, change mind right before medistation, change mind when far enough of medistat, etc. This would be fixed by using navmesh-related distances instead of Euclidean Distances.
  • rewrite remaining score functions, which are used to take decisions, so that they use as little as possible hard-coded values, instead, base decisions on gameplay elements (equipment's price, game's age (better to attack buildings when game is old, since they're hard to rebuild then), etc).
    -> done: HealScore, which now enables opportunistic use of healing structures. I'm rather happy with the result.
    -> done: RushScore, which now considers the total amount of money the bot is worth, how skilled bot is, and maximum spendable money depending on server config and stage. I'm not happy with this, as the function is linear, and it does not really prevents aliens bots to constantly rush.
    -> TODO: EnemyPriority, which should probably be a mix between distance, a target defensive score (based upon armor and health) to favor easy kills?, a target offensive score to defend base, and other things. I am unsure about how exactly to build it.
  • bots should be able to refuel ammo (including adv goons), health, poison when close enough to armoury, medistation or booster
    -> done for healing, still have to implement resupply (reload ammo, get new clips, get poison, get grenades, get barbs)
  • when healing or resupplying, search enemies to attack
    -> half done: bots will stop their healing routine if enemy is close enough to the heal point, but won't try to fight from afar, which would allow them to effectively heal in the meantime.

Re: bot improvements mod

Posted: Mon May 17, 2021 6:14 pm UTC
by Gireen
A dumb thing bots do is they focus only on there current goal and ignore everything else. That makes it super easy to kill them if they flee or attack a building. At the moment its not possible to have a bot react to attacks and resume its task it the danger is over.
It might be good to have a state variable, that the behavior tree can act different depending on the current state.

Re: bot improvements mod

Posted: Tue May 18, 2021 2:47 pm UTC
by freem
Gireen wrote:A dumb thing bots do is they focus only on there current goal and ignore everything else. That makes it super easy to kill them if they flee or attack a building. At the moment its not possible to have a bot react to attacks and resume its task it the danger is over.
It might be good to have a state variable, that the behavior tree can act different depending on the current state.


Yes, I forgot to put related things to my TODO list, thanks!
The idea I have to work around that is to define several levels of targeting, namely:

  • objective (assist a teammate, raid a specific point, defend a specific point, go to some resupply point, etc)
  • immediate target, which is what they currently have

This should allow to implement backpedaling when retreating to go heal, and other sneaky tactics like trying to cut target's retreat path. For that, I'll also need to know target's direction, though, and basically, I need bots to be aware of more than just the closest instance of everything. Currently, you can't decide a bot's target in the BT for example.

Thanks, let me add this to TODO list.

Re: bot improvements mod

Posted: Thu Jun 17, 2021 10:04 am UTC
by freem
Implemented and deployed version 4, adding this:

[*] bots decision to go to heal is no longer affine and depends on their skill. That mean that, if they're slightly hurt (say, at 95% health) but close to medistation, they will go there to heal before moving on.
[*] human bots will equip (armors, backpacks, grenades) before going to repair stuff

Re: bot improvements mod

Posted: Sat Jun 19, 2021 3:34 pm UTC
by illwieckz
freem wrote:
  • human bots will equip (armors, backpacks, grenades) before going to repair stuff


For armors I can see the need, but for grenade, they may just waste the money if killed while repairing, right? Is there a way to do selective equipment?

Re: bot improvements mod

Posted: Sun Jun 20, 2021 7:21 pm UTC
by killing time
Just tried it a bit.

In the currently deployed version there is a bug causing missiles not to be spawned, meaning you can't throw grenades, and pulse rifles, flamers and rocketpods don't shoot. This was caused by a recently committed bug on master which was already fixed. You can fix the bug by either one of rebasing your code on master, or putting the 0.52.1 asset packages on your server.

A noticeable path-setting issue I saw (not necessarily a regression, just something I noticed) was that alien bots often rushed out on the path from the alien base to the human base when they had <50% health.

Re: bot improvements mod

Posted: Sat Jun 26, 2021 10:51 pm UTC
by freem
killing time wrote:Just tried it a bit.

In the currently deployed version there is a bug causing missiles not to be spawned, meaning you can't throw grenades, and pulse rifles, flamers and rocketpods don't shoot. This was caused by a recently committed bug on master which was already fixed. You can fix the bug by either one of rebasing your code on master, or putting the 0.52.1 asset packages on your server.


This has been recently fixed, by doing both :)
That bug made me mad for several days actually, I though that was my changes, and could not see the why... :)

killing time wrote:A noticeable path-setting issue I saw (not necessarily a regression, just something I noticed) was that alien bots often rushed out on the path from the alien base to the human base when they had <50% health.


Yes, I'm still working on the various heuristic functions. This is not really an easy thing: should take the time to heal if you're close enough to friend building for aliens, or medistat for humans (which then queue without fighting back!) and in fight try to run soon enough to reach heal spot or meet friends alive...
I believe the BotGetHealScore heuristic is a lot better than before, but I'm still failing to get the BotGetRushScore correct.
Part of the problem is that I use the notion of distance, but game only provides "ghost distance": ignore walls and gravity, straight line, instead of real path distance, function.

Re: bot improvements mod

Posted: Sun Jun 27, 2021 9:49 pm UTC
by freem
I did a little script to extract some basic stats on my server, currently only the win rates per map, but I intend to improve it to have average time of games per map for a specific winner and to filter out games where a human player actually played (not spectators though).
I intend to use those numbers to give some better evidence of what the things really change in pure bot games (still should run lower skill matches, though).

Here are the numbers it gives for iteration 0.52.1+2:

Code: Select all

     17  Aliens win.  antares
     19  Aliens win.  chasm
     20  Aliens win.  forlorn
      6  Aliens win.  parpax
     18  Aliens win.  perseus
     20  Aliens win.  plat23
     19  Aliens win.  station15
      7  Aliens win.  yocto
      2  Humans win.  antares
      1  Humans win.  chasm
     13  Humans win.  parpax
      1  Humans win.  perseus
     13  Humans win.  yocto


In short, human bots win 2/3 of games on parpax and yocto. For antares, chasm (modified layout so that armory is reachable), and perseus, they can win with luck, and they are unable to win on plat23 and station15.
Ideally, I would like to be able to replay the matches while being free to spec any bot, to understand why, but I'm not aware of such feature in daemon.

Anyway, next iteration 0.52.1+3 tries to give:

* human bots now defend their base instead of waiting for medistation to be free (range might be improved)
* don't throw grenades or firebombs if close enough to reactor
* if close enough to reactor, owning a luci and attacked, buy pulse rifle to repel invaders

It will also provide a patch to prevent players from disconnecting when trying to play with "lowest graphical presets" and will be uploaded this evening.

Known regressions:

* radar users get stuck for no apparent reason, endlessly roaming near medistat on yocto
* battlesuit users trying to walk and run at same time when retreating, making them slower than when walking

They're likely caused by the code to make bots defend their base instead of healing.

Re: bot improvements mod

Posted: Thu Jul 01, 2021 8:15 am UTC
by freem
Okay, got iteration 0.52.1+3's results, they're are not human friendly:

Code: Select all

     16  Aliens win.  antares
     17  Aliens win.  chasm
     18  Aliens win.  forlorn
      2  Aliens win.  parpax
     18  Aliens win.  perseus
     18  Aliens win.  plat23
     17  Aliens win.  station15
     12  Aliens win.  yocto
      2  Humans win.  antares
      1  Humans win.  chasm
     17  Humans win.  parpax
      6  Humans win.  yocto


I'm uploading a patch to prevent humans equipped with a radar to be stuck between medistation and potential targets in yocto. The problem only happened there because it's the only map in which both teams start on a different "level layer", and distances are Euclidean, so aliens roaming around were always triggering the "must defend" path before humans reached medistat.
As been fixed by adding a "isVisible" contraint, but I think it's still suboptimal.
The bsuit regression is also still around, and is likely to be a good cause for human defeats too. I'm still uploading next iteration to see what it says in practice.

Note that my result stat script has been improved, and is less likely to be polluted by games in which real players played (spectating does not count, but playing, even only 1s, does)

Re: bot improvements mod

Posted: Thu Jul 01, 2021 9:55 pm UTC
by killing time
Suggestion: Have a minimum health percentage to evolve. If you evolve with low health and get in a fight right away, then you will probably end up wasting your evos. If you don't get in a fight, then evolving at that time did not benefit you.

Something I've talked about before, but was not mentioned in this thread - human bots sometimes won't fire at aliens in plain sight. This can happen if humans are on the ledge in the karith elevator room and aliens are on the other ledge. (I think you said it happens because there must be a mesh path to an enemy?)

When playing today, the human bots seemed kind of cowardly sometimes. As a mantis, I did around 30-40 damage to a human bot with light armour close to its base and it fled back in.

I feel like the bots' aiming skill with Painsaw might be too high compared to their skills in other areas.