NullBotSW: A heavily modified NullBot AI for Contingency

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
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

NullBotSW: A heavily modified NullBot AI for Contingency

Post by Shadow Wolf TJC » 17 Jan 2013, 02:51

I've decided to put development of ShadowBot on hold for now until I'm more familiar with how an AI's scripting works, and to help me with understanding such, I've decided to work on improving NullBot (developed by NoQ) for Contingency, which is perhaps the most well-developed Warzone 2100 AI around.

For now, the AI is still in beta, since I still plan on adding new features to make it even better.
nullbotsw-contingency-v0.4.wz
(72.95 KiB) Downloaded 417 times
Image
Note: This AI is only usable for Contingency. Attempting to use it for vanilla Warzone 2100, or for any other mod, will likely result in the AI not working.

Features:
- Uses the most up-to-date info from Contingency
- More aggressive than NullBot 2.0
- Makes more use of artillery structures than NullBot 2.0
- Uses EMPs to support attack forces
- Builds factories in remote locations
- Rebuilds elsewhere if main base is sacked
- More efficient with resource management than NullBot 2.0
- More unpredictable than NullBot 2.0
- More modular and moddable than NullBot 2.0

Planned features:
- Addition of Flamer/Laser personality. (So far, only the Machinegun, Cannon, and Rocket personalities are finished.)
- Replacement of Turtle personality with Artillery personality that relies extensively on artillery weapons (both mobile and fixed).
- Having NullBotSW build specialized harassers instead of assigning generic attack units the role.
Last edited by Shadow Wolf TJC on 19 Feb 2013, 00:46, edited 3 times in total.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

ADMIRALLORDHOOD
Rookie
Rookie
Posts: 24
Joined: 04 Oct 2012, 22:36

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by ADMIRALLORDHOOD » 18 Jan 2013, 00:35

Nice. I would also like to see them use VTOLs and cyborgs less and focus more on tanks and defense. That would make it much better.

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by Shadow Wolf TJC » 19 Jan 2013, 06:47

Here's a video that I recently uploaded featuring the current NullBotSW in action (on Contingency): www.youtube.com/watch?v=vhdFWjSGLOQ
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

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

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by NoQ » 19 Jan 2013, 07:48

Are you sure you know what you are doing with repair facilities? Unlike, for example, sensors, two repair facilities at one spot are actually double effective. Only on a very large and wide map will a good player prefer to place five single repair facilities; even in NTW games people who actually use repair (like me) place all five repair facilities together, resulting in 5x repair speed of a single army.

Also, when NullBot chooses a spot for a repair facility, it tries to place it in the "hottest" spots, that is, close to the action, which is good; same applies to defensive structures: derricks that are often attacked will be protected first, whenever such information is available.

P.S. most important things in the match were, i think, increased harass (it's very important on a wide map like that) and probably proper use of early cyborgs (though the first thing was enough). I don't think the build order change had any effect. None of the AIs had a sensible build order for this sort of map, and even if they did, they lack code to make proper use of it.

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by Shadow Wolf TJC » 19 Jan 2013, 08:26

NoQ wrote:Are you sure you know what you are doing with repair facilities? Unlike, for example, sensors, two repair facilities at one spot are actually double effective. Only on a very large and wide map will a good player prefer to place five single repair facilities; even in NTW games people who actually use repair (like me) place all five repair facilities together, resulting in 5x repair speed of a single army.
From my observations, NullBot doesn't actually seem to retreat its units when they're badly damaged. If it does, then it seems to order them back into the fray. (I'm planning on adding some scripting that would address this issue.)

Besides, bunching up all those Repair Facilities around open oils seems foolish, as they're defenseless without nearby defenses to protect them. (Have you heard of the phrase "don't put all your eggs in one basket"?) It also seems unnecessary in Contingency given how most of the units there have so little HP. It would make more sense to bunch them up closer to the main base though, as chances are that that's where you'd want to make your last stand if things went south for you.
NoQ wrote:Also, when NullBot chooses a spot for a repair facility, it tries to place it in the "hottest" spots, that is, close to the action, which is good; same applies to defensive structures: derricks that are often attacked will be protected first, whenever such information is available.
The same thing is true for NullBotSW, though it also has a small chance of placing them in a "colder" spot, where the Oil Derrick was never rebuilt. Sometimes, the hottest derrick isn't always the best place to put your artillery structures or repair facilities.
NoQ wrote:P.S. most important things in the match were, i think, increased harass (it's very important on a wide map like that) and probably proper use of early cyborgs (though the first thing was enough). I don't think the build order change had any effect. None of the AIs had a sensible build order for this sort of map, and even if they did, they lack code to make proper use of it.
It seemed to me as if hunting for enemy derricks early game was the way to go, since doing so could put your forces at an economical advantage early on, even if the opponent could've easily repelled the early rush, and take the fight to your doorstep, but by that time, you could've used the additional power to amass a large enough force to repel said counterattack, and push back to the enemy.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

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

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by NoQ » 19 Jan 2013, 09:18

From my observations, NullBot doesn't actually seem to retreat its units when they're badly damaged. If it does, then it seems to order them back into the fray.
Never seen anything like that. If there's a reason why he doesn't send a unit to repair instantly, it's because eventAttacked is being throttled on 3.1 (and looping though all army is too CPU-ineffective).
It also seems unnecessary in Contingency given how most of the units there have so little HP.
That's probably why NullBot has no time to send a unit for repair on 3.1, hence your observation.
they're defenseless without nearby defenses
Repair facilities are always surrounded with units, no need for more protection. If they aren't, then they aren't useful anyway, destroying them will only make NullBot stronger.
Have you heard of the phrase "don't put all your eggs in one basket"?
That's not about eggs, it's rather about plutonium. Put many atoms close to each other and it'll kaboom. Put them uniformly and it's as if they don't exist. Increased repair speed is an unproportionally great benefit, proved by hardcore multiplayer matches. Besides, they are pretty cheap.

Just compare these two cases: 1) enemy attacks every 5 minutes, it takes 2 minutes to repair your army, 2) enemy attacks every 5 minutes, it takes 10 minutes to repair your army.
that's where you'd want to make your last stand if things went south for you.
There's no point in improving your last stand. If you need to care about your last stand, you are already dead.

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

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by NoQ » 21 Jan 2013, 04:24

A little digest of the latest changes in NullBot base git, that you need to consider merging:
One more thing. After applying your "don't build power generator too early" patch i'm observing that some rare AI instances don't do things at all before the PEACE_TIME runs out. The reason of the problem is some troubles with safeDest() API function, that i couldn't yet formalize as a bug; it just marks the whole base as unsafe and the AI is scared to start with his build order; that's what was causing the bug in the first place. Ways of workaround include 1. no longer rely on safeDest(), which leads to looping through all enemy droids and structures many times every time we want to build a structure, even an oil derrick, 2. don't check safety at all during build order, which results in degraded behaviour with improved scavenger AIs like the one in USM, that actually attack you very early in the game. I think i'll choose 2.

Yet one more thing: in 3.1.0 there's a bug that causes groupSize(group) == enumGroup(group) + 1, please watch out.

User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by aubergine » 21 Jan 2013, 07:46

Is that groupsize bug specific to 3.1.0 or was in in RC3 and earlier too?

BTW: For iterating arrays, I highly recommend this approach: Array.forEach() (don't worry about the extra function required, it gets optimised heavily by compiler, resulting in overall faster code execution)
Last edited by aubergine on 21 Jan 2013, 07:52, edited 2 times in total.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

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

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by NoQ » 21 Jan 2013, 07:50

It appeared after dirty-fixing the transporter bug for 3.1.
It wasn't present in RC3 (as the dirty-fix wasn't applied yet).
It is already fixed for future 3.1 releases and never affected master (the fix on master wasn't dirty).
I highly recommend this approach: Array.forEach()
I'm using it for the newer code.

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

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by NoQ » 23 Jan 2013, 16:03

NoQ wrote:The reason of the problem is some troubles with safeDest() API function, that i couldn't yet formalize as a bug; it just marks the whole base as unsafe and the AI is scared to start with his build order; that's what was causing the bug in the first place.
I proudly announce that i was wrong. The real reason is https://sourceforge.net/p/nullbot2100/c ... f9ea13057/ :lol2: :stressed: :augh: :oops:

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by Shadow Wolf TJC » 02 Feb 2013, 22:35

I'm proud to announce that NullBotSW version 0.2 is out, with the following changes:
- Cannon personality finished.
- Now uses EMPs in attack forces.
- Now uses cross-line weapons whenever available, though won't necessarily pursue research into them.
- Added support for modifying how often NullBotSW will build tanks and VTOLs of different sizes.
- Now adapts artillery structure choices to enemy unit mixes.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by Shadow Wolf TJC » 12 Feb 2013, 11:35

Version 0.3 of NullBotSW is out, with the following changes:
- Machinegun personality is finished.
- Added sortByDistance() function in an effort to cut down on the need for trucks to move vast distances to go where they're needed, as well as to allow for NullBotSW to more effectively build artillery closer to the front lines.
- Now considers how many derricks and generators it has before deciding whether or not to build a proxy factory.
- Now has builderGroup trucks secure all nearby derricks once they're finished setting up the main base structures (such as factories, research labs, power generators, and HQ).
- HARD and INSANE AIs will no longer bother to recall all of their forces back to the main base if it comes under attack, since its forces often seem to be too far away to make a difference. (Besides, it's programmed to rebuild elsewhere in case of such an event.)
- NullBotSW should now be able to hold its own against the Ultimate Scavenger AI, especially the Attack Choppers that it uses.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by aubergine » 12 Feb 2013, 12:23

What's a proxy factory?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by Shadow Wolf TJC » 12 Feb 2013, 12:39

I call factories that I place outside of my main base proximity factories, or proxy factories for short.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: NullBotSW: A heavily modified NullBot AI for Contingency

Post by Shadow Wolf TJC » 19 Feb 2013, 01:14

Version 0.4 is out, with alot of changes made to it (although no new personalities were added, sadly):

- VTOLs were split into anti-personnel, anti-tank, anti-structure, and anti-air roles, and should now act based on what they're designed for. NullBotSW will, for example, have its anti-air VTOLs patrol the main base to intercept enemy VTOLs, send its anti-structure VTOLs after enemy structures, and send its anti-personnel and anti-tank VTOLs after any nearby enemy droids.
- Now creates hotspot objects to mark danger zones. NullBotSW will not build any structures near those hotspots, and may even demolish any partially-built structures there in an effort to salvage some power.
- Will now attempt to research exotic technologies such as Rocketstorms or Jet-Assisted Cannons if they become available for immediate research, or if it has nothing else to research.
- Will now attempt to research rush for hovers if playing on a hover-only map. (Should have hover propulsion researched in about 14 minutes.)
- Now uses blacklists to ensure that it won't research what it doesn't need. For example, if NullBotSW needs to switch exclusively to hovers, then it won't make any effort to pursue research into Cyborg Factories, Half-Tracked Propulsion, or Tracked Propulsion (unless necessary for pursuit of technologies that it does need).
- HARD and INSANE AIs will now try to keep their harassers away from enemy starting positions. This should allow them to keep their early-game harassers alive much longer since chances are that the opponent is building up its forces within its main base.
- May now build artillery, repair facilities, sensor towers, and proxy factories near allied derricks. Sometimes, NullBotSW will even build them near an ally's main base.

Finally, NullBotSW's anti-stuck mechanism was modified so that it would not only order its combat units to a particular location, but also every other unit that it controls. From my observations, it seemed as if NullBotSW (and presumably NullBot 2.0, which NullBotSW is based off of) was getting its forces stuck in the main base itself, as trucks were trying to go one way, while combat units were trying to go another way. While I don't quite yet understand how NullBot manages to identify whether or not it has forces that are stuck (I'd like to know how that works by the way), I did have a solution in mind, and so far, it seems to work fine for me.

I'd appreciate some feedback on how NullBotSW's various features work for you guys, on issues that need to be worked out for NullBotSW, or on suggestions for new features to implement for NullBotSW. :)
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

Post Reply