[3.2+] NullBot 3 ‘Reloaded’

Did you create a mod, map, music, or a tool? Present them here and earn feedback!
Note: addon requests do not belong here.
Note, everything uploaded to this forum, MUST have a license!
User avatar
NoQ
Special
Special
Posts: 6225
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by NoQ » 13 Feb 2017, 08:04

I originally spent quite a bit of time tweaking Nexus AI, and after that JS was an awesome delight - in a few days i had an even stronger AI written from scratch. Even if the original high-level design of NullBot was nothing but a Nexus rip-off, the new language was still terrifically helpful. Nowadays i'd definitely prefer Python, but compared to WZScript, even Javascript is a fantastic thing to have.

User avatar
Tzeentch
Trained
Trained
Posts: 242
Joined: 14 Oct 2012, 14:24

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by Tzeentch » 14 Feb 2017, 00:23

Cool, I'll try it out sometime.

What is your next challenge? Can you make an A.I. that plays more unpredictably, in a random way?
More or less grey

User avatar
NoQ
Special
Special
Posts: 6225
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by NoQ » 15 Feb 2017, 10:58

I cannot advance significantly further without using better design patterns in order to simplify logic. In this department, i believe the way to go is to start using decision trees, decisions taking multiple game frames if necessary for smooth performance; a well-designed support library is needed for that.

Generally, playing in a random way is essentially playing worse, because there are relatively few good strategies in the game for now (personalities already cover them mostly). NullBot3 is already much more surprising than the original NullBot because adaptation methods produce non-trivial results (for example sometimes it decides to spam mortars against offensive armies, because they fit just right against the tank:cyborg ratio he sees).

It would be great to make it attack from different corners or even from multiple directions at once (a tactic humans often underestimate - yes you engage with weaker army, but you do a lot of damage to the enemy base with your other half, so as long as you have enough defensive advantage to survive an all-in, not even necessarily an overally stronger army, it's well worth it, not to mention the possibility of surrounding and slashing droids that retreat to repair), but that'd require terrain analysis, which i've little idea how to implement. Having terrain analysis would open up a huge bunch of possibilities such as auto-detecting choke points, engaging in combat on them in concave formations.

Forgon
Code contributor
Code contributor
Posts: 289
Joined: 07 Dec 2016, 22:23

A few thoughts

Post by Forgon » 08 Mar 2017, 19:55

Seizing oil
  • If a construction unit aims for an oil derrick yet comes second, the designated unit should target the closest alternative. If none exists, a defensive structure may be built to conquer it, but as soon as there is a new one and no other construction unit is closer, building should be halted in its favour. I consider the lack of all this Nullbot's greatest weakness.
  • Combat engineers should be sent to capture oil for their speed.
  • If oil barrels are only accessible through water, Hovers should be built to seize them. This should pay off in almost every case given the poor adaption to geography and consequent underuse of Hovers. Alternatively, the behaviour could be triggered by a threshold of additional power to be gained though that is too fishy for me.
    power.png
    All oil derricks are taken, 6 Hover trucks are available and power is lacking -- still no effort to seize the oil barrels.
    power.png (585.11 KiB) Viewed 2994 times
  • Own structures blocking oil derricks from being rebuilt (e.g. on Sk-Rush) should be demolished temporarily.
  • With construction units to spare, those could build defensive structures next to enemy derricks proactively
Combat
  • Attacking units should not bypass enemy oil derricks along their path, but always destroy them before advancing.
  • Pursuit ought to last longer, e.g. right to the end of a base.
  • Repair closer to the front, either by units or facilities ahead of the base would reduce downtime in the army.
  • Some units, such as sensors or trucks should plan their routes around known enemy locations.
  • Any estimation of combat outcomes would be great. Sometimes very few units charge into many.
  • Sensors and Commanders could scout and lead units, especially artillery.
Trucks
  • Fewer trucks should be made and they should hunt power resources all the time instead of idling in large groups or trying to construct buildings with too little power available. Once their production limit is reached, efforts to make more must not block factories!
    idling.png
    Idling can become much worse than in this picture. Also notice the many factories despite a power shortage and how useless 2 sensors are next to each other.
    idling.png (773.86 KiB) Viewed 2994 times
Buildings
  • There should only be so many factories as can realistically keep producing.
  • Defensive structures should guard the entry, not the inside or backside of a base.
    buildings.png
    Turtle AI shows to the extreme how poorly buildings are placed. All the effort will do very little in defense of his base.
    buildings.png (715.43 KiB) Viewed 2994 times
  • Sensor Towers should not be built so close that their ranges overlap.
Orientation
  • If there was an easy way to teach a bot how to read a map and understand its geography, devs would have found it :|
Coordination
  • Trucks should not be used to seize derricks in an allied base but handed over so that he can rebuild.

User avatar
NoQ
Special
Special
Posts: 6225
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: A few thoughts

Post by NoQ » 11 Mar 2017, 12:14

Forgon wrote:Seizing oil
  • If a construction unit aims for an oil derrick yet comes second, the designated unit should target the closest alternative.
Yep, i guess it's a good idea.
Forgon wrote:
  • If none exists, a defensive structure may be built to conquer it
This, however, is highly situational.

(1) In most cases i, as a human, would prefer adding two machinegun viper wheel tanks to my army to building a machinegun tower near a derrick. I could use these two tanks to either destroy multiple undefended derricks, or scare the enemy army away in direct confrontation and gain control of more territory, hence more economy. The only case where machinegun towers are viable are remote derricks on large maps - diverting army to which is more costly. But determining this situation requires terrain analysis.

(2) I believe this is one of the features that's good in AI vs. AI matches, but i'd rarely use this trick against humans on tasteful maps.

(3) This is a feature that i feel annoying rather than delightful for new players.

For these three reasons, i'm holding this back until terrain analysis.
Forgon wrote:
  • , but as soon as there is a new one and no other construction unit is closer, building should be halted in its favour. I consider the lack of all this Nullbot's greatest weakness.
  • Combat engineers should be sent to capture oil for their speed.
The time window when combat engineers are available and hover trucks aren't is very slow. Also, oil gets actively captured only at game start, and in only few setups you have engineers but not hovers available at start.
Forgon wrote:
  • If oil barrels are only accessible through water, Hovers should be built to seize them. This should pay off in almost every case given the poor adaption to geography and consequent underuse of Hovers. Alternatively, the behaviour could be triggered by a threshold of additional power to be gained though that is too fishy for me.
I didn't try to adapt NullBot to all possible crazy maps. Having large amounts of oil barrels pre-placed is just one of the things that makes the map crazy, by which i mean skewing the strategies you use dramatically. I believe it's generally a good idea to let NullBot adapt to such maps, but not at the cost of the code complexity, so i delay this stuff until i manage to deal with code complexity.
Forgon wrote:
  • Own structures blocking oil derricks from being rebuilt (e.g. on Sk-Rush) should be demolished temporarily.
Yep, agreed.
Forgon wrote:
  • With construction units to spare, those could build defensive structures next to enemy derricks proactively
Again, only if derricks are remote. Otherwise it's a waste. Also, it's much better to build said structures not next to the derrick, but at a shooting distance in a terrain-defended position (especially stuff like mortars).
Forgon wrote: Combat
  • Attacking units should not bypass enemy oil derricks along their path, but always destroy them before advancing.
That should already be the default behavior, i don't see wouldn't this happen. Moreover, most units will fire-on-move even on move-command.
Forgon wrote:
  • Pursuit ought to last longer, e.g. right to the end of a base.
What do you mean by pursuit? NullBot attacks as long as it has large army, and retreats when it thinks it doesn't have enough army to engage. There's no notion of pursuit, it doesn't care if he follows anybody or just attacks the base. You might be referring to the droid's default micro-AI behavior that NullBot doesn't control.

In any case, i don't understand the point of pursuit (eg. the "bring back the pursuit secondary order" debate), because you shouldn't ever let your single units split away from your army and go to enemy bases alone, that'd be weird.
Forgon wrote:
  • Repair closer to the front, either by units or facilities ahead of the base would reduce downtime in the army.
Yep. Support for repair droids would also be great in general.
Forgon wrote:
  • Some units, such as sensors or trucks should plan their routes around known enemy locations.
Yeah, and it requires making a custom pathfinding implementation (as part of terrain analysis).
Forgon wrote:
  • Any estimation of combat outcomes would be great. Sometimes very few units charge into many.
This shouldn't happen unless they're trying to rejoin the army. I agree that'd be a good feature - ideally a good AI shouldn't engage in combat at all unless he's sure he's winning.
Forgon wrote:
  • Sensors and Commanders could scout and lead units, especially artillery.
Commanders should never be in the front lines. They're too expensive. NullBot doesn't use them though.

Sensors are moving around freely though, it already works that way.
Forgon wrote: Trucks
  • Fewer trucks should be made
Many strong competitive players prefer starting the game with three factories before all other buildings, constantly producing trucks. This helps building the game faster and capturing the oil faster and eventually pays off.
Forgon wrote:
  • and they should hunt power resources all the time instead of idling in large groups or trying to construct buildings with too little power available. Once their production limit is reached, efforts to make more must not block factories!
Agreed. I already tried to avoid blocking factories as much as i could.
Forgon wrote: Buildings
  • There should only be so many factories as can realistically keep producing.
NullBot builds more than 2-3 factories only when it sees all of them occupied. It should already work that way. However, the game changes (production times of different units changes, more classes of factories appear, modules appear), so the estimates skew around, which makes things difficult.
Forgon wrote:
  • Defensive structures should guard the entry, not the inside or backside of a base.
Yep, needs terrain analysis.
Forgon wrote:
  • Sensor Towers should not be built so close that their ranges overlap.
Should already work that way, strange.
Forgon wrote:
Orientation
  • If there was an easy way to teach a bot how to read a map and understand its geography, devs would have found it :|
Coordination
  • Trucks should not be used to seize derricks in an allied base but handed over so that he can rebuild.
I don't know how to rigorously define "allied base". If the player is so slow that NullBot can capture his oil before him, then he probably should do so. You can make NullBot give your trucks by saying "!nb truck" in chat. Your own base, however, may not be the safest place to bring trucks, because it was recently destroyed; it's better if he just gives you a truck in a safe location, and you decide what to do with it.

Forgon
Code contributor
Code contributor
Posts: 289
Joined: 07 Dec 2016, 22:23

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by Forgon » 23 Mar 2019, 21:12

My old criticism still applies.

The greatest weakness of the bot is that it is too skittish:
Countless times I saw it retreat when it had an army in front of an undefended
enemy base, which it could have conquered easily.
Players can easily chase it away with a token force to buy more time.
While this behavior may be desirable against underwhelming human players,
at least on the "Ultimate" difficulty level it should attack more aggressively.

Also, Nullbot should not fight with Bunker Busters, since it builds too many and
never uses them effectively.

User avatar
NoQ
Special
Special
Posts: 6225
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by NoQ » 27 Mar 2019, 16:39

Forgon wrote:
23 Mar 2019, 21:12
Also, Nullbot should not fight with Bunker Busters, since it builds too many and
never uses them effectively.
Could you try increasing the anti-structure value at [1] (the third element of the roles array for bunker busters) above 1.0? Like, see what value makes the behavior sensible and commit the difference. I hope values above 1.0 do actually work correctly.
Forgon wrote:
23 Mar 2019, 21:12
The greatest weakness of the bot is that it is too skittish:
Countless times I saw it retreat when it had an army in front of an undefended
enemy base, which it could have conquered easily.
Players can easily chase it away with a token force to buy more time.
While this behavior may be desirable against underwhelming human players,
at least on the "Ultimate" difficulty level it should attack more aggressively.
I made this mistake so many times as a human that i'm actually proud i made it that far in bypassing your other criticism :) Hmm, unfortunately, i don't think there are easy numbers to tweak here; you can tweak the minimum group size at which the AI considers engaging in combat rather than retreating ([2] [3] and personality-specific stats) but it doesn't take nearby enemy counts into account at all (or the game's power levels - i wanted to make a separate personality for high-oil games instead but never got to it).

xannkriegor
New user
Posts: 3
Joined: 09 Oct 2019, 12:42

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by xannkriegor » 09 Oct 2019, 21:18

From my experience with default nullbot on hard so far:

1. It doesn't research nearly fast enough (or the wrong things)
2. Doesn't build the strongest army compositions.
Like, whats the point of mass mortar + some cyborgs? It just gets overrun by rocket/cannon spam. Multiple times the one bot that amassed cannon tanks overwhelmed all other bots.
3. It doesn't amass enough units
4. The bots fight more between each other and seldom attack the player in both 4man FFA and 3man FFA.

User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 816
Joined: 26 Sep 2016, 19:56

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by Berserk Cyborg » 10 Oct 2019, 22:50

xannkriegor wrote:
09 Oct 2019, 21:18
1. It doesn't research nearly fast enough (or the wrong things)
One of NullBots main issues is slow money spending which notably makes it lunch for bots that are super aggressive early game. NullBot could benefit from tighter power checks too.

xannkriegor wrote:
09 Oct 2019, 21:18
2. Doesn't build the strongest army compositions.
Like, whats the point of mass mortar + some cyborgs? It just gets overrun by rocket/cannon spam. Multiple times the one bot that amassed cannon tanks overwhelmed all other bots.
NullBot does some data analysis to (hopefully) choose the right weapon combination to fight a specific player. NullBot currently makes use of 5 data sets, called personalities, that define a bunch of data. One of those things are a series of weapons to choose from to use throughout the whole match that should serve specific roles. Sometimes it works, other times not (like Bunker Buster or Ripple Rocket spam if the enemy has a few walls or defenses). Weapon adaption appears hard to do, also.

Mortar + cyborgs might have been used to help counter a player using some combination of defenses/cyborgs and rockets/cannon.
xannkriegor wrote:
09 Oct 2019, 21:18
3. It doesn't amass enough units
Of all bots, I'd think it does this the best. It's the only one with any grouping code AFAIK. Thus giving it a more human like quality. NullBot could be more brave since I agree with past observations that its biggest weakness is its skittish nature in battles.
xannkriegor wrote:
09 Oct 2019, 21:18
4. The bots fight more between each other and seldom attack the player in both 4man FFA and 3man FFA.
Not sure how NullBot chooses targets. In my experience NullBot always seems to single me out when I'm playing on maps like Rush or Melting.

xannkriegor
New user
Posts: 3
Joined: 09 Oct 2019, 12:42

Re: [3.2+] NullBot 3 ‘Reloaded’

Post by xannkriegor » 11 Oct 2019, 13:11

Berserk Cyborg wrote:
10 Oct 2019, 22:50
Sometimes it works, other times not (like Bunker Buster or Ripple Rocket spam if the enemy has a few walls or defenses). Weapon adaption appears hard to do, also.

Mortar + cyborgs might have been used to help counter a player using some combination of defenses/cyborgs and rockets/cannon.
xannkriegor wrote:
09 Oct 2019, 21:18
3. It doesn't amass enough units
Of all bots, I'd think it does this the best. It's the only one with any grouping code AFAIK. Thus giving it a more human like quality. NullBot could be more brave since I agree with past observations that its biggest weakness is its skittish nature in battles.

Not sure how NullBot chooses targets. In my experience NullBot always seems to single me out when I'm playing on maps like Rush or Melting.
Not sure either, but for me it's the exact opposite. Out of the ~2 dozen skirmishes on Rush, they always ignored me and only fought between each other. I guess they choose targets based on enemies aggression, I play more passive for the first 5-10 minutes.
The only 2 occasions I got attacked was because one bot had eradicated the others after 25 minutes.

So these would be my suggestions, assuming anybody still has interest to work on it:
1. it should apply the "retreat at low health" logic to it's units and not instantly reverse whole army when some damage was taken
2. it should follow proven research paths more aggressively so it would beat you mid to late with better upgrades and weapons if your research didn't keep up
3. the mortar path has to go, it is completely useless from my observations thus far
4. try a comeback if they lost a fight (amass more units before attacking again, instead of building another factory)

Post Reply