[3.1+] NullBot: an adaptive skirmish AI

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: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by NoQ »

v1.03

Changes:
  • Now all personalities work correctly (or at least i think so) on sea maps: attack ground enemies first, use don't use ground tanks or borgs against sea enemies, try to research hover as soon as possible when no ground enemies are present. They are still rather inferior to the Hover personality, but at least they work. Adaptation to VTOL-only maps is still unavailable.
Cyp
Evitcani
Evitcani
Posts: 784
Joined: 17 Jan 2010, 23:35

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by Cyp »

If you don't have enough power to build something, nothing happens until you have enough power, then the power is instantly spent, and production starts.

Visually, the power is subtracted before you have enough power (making the power bar show negative, even if it's positive internally), and a green bar is shown for the next item queued to be built. When the bar reaches 100%, it means you have enough power to start building.

Basically, if you're out of power, there is a green bar (on one factory or truck, only), but it's just informative, letting you know how much power you're missing before you can start building something.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by NoQ »

Cyp: This still doesn't explain how exactly did i manage to pay three times for one truck. But since v1.02 i don't care (:

P.S. Finally, there is an AI that works on 8c-Manhattan. Cause humans usually don't want to play this map (asymmetric, hover, weird teams), and AIs can't (:
Cyp
Evitcani
Evitcani
Posts: 784
Joined: 17 Jan 2010, 23:35

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by Cyp »

It's because it's a Rent-a-Truck, not a regular Truck, so you have to keep paying for it.
User avatar
effigy
Regular
Regular
Posts: 1217
Joined: 22 Jan 2010, 03:21

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by effigy »

I did a couple skirmishes vs. Nullbot 1.01 last night on Oriental Arrow (1v2). Once with scavengers on Hard, and once with no scavengers and Insane.

I'm wondering does he care about scavengers? It seems they are a major set back in his research, and in obtaining oil. I'm not sure if after 30 minutes there was an attempt, until I had claimed the scavenger oil.

Also, it could benefit him (since he doesn't power cheat?) if he made getting oil barrels a priority. On this particular map experience the two Nullbots have to split the same amount of oil as myself, though there always unclaimed pre-placed barrels untouched.

Nullbot is a "he" right? :lol2:
This is why some features aren't implemented: http://forums.wz2100.net/viewtopic.php?f=30&t=7490&view=unread#p87241
User avatar
JDW
Regular
Regular
Posts: 1669
Joined: 18 May 2010, 20:44

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by JDW »

effigy wrote:Nullbot is a "he" right? :lol2:
Hang on, lemme check........ yes, it's a boy! : :D
"Speak when you are angry and you will make the best speech you will ever regret."
-- Ambrose Bierce
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by aubergine »

Cyp wrote:It's because it's a Rent-a-Truck, not a regular Truck, so you have to keep paying for it.
Ah, a sort of hire-purchase scheme? Do you get discounts if you have a clean driving license? XD
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by aubergine »

effigy wrote:I did a couple skirmishes vs. Nullbot 1.01 last night on Oriental Arrow (1v2). Once with scavengers on Hard, and once with no scavengers and Insane.

I'm wondering does he care about scavengers? It seems they are a major set back in his research, and in obtaining oil. I'm not sure if after 30 minutes there was an attempt, until I had claimed the scavenger oil.

Also, it could benefit him (since he doesn't power cheat?) if he made getting oil barrels a priority. On this particular map experience the two Nullbots have to split the same amount of oil as myself, though there always unclaimed pre-placed barrels untouched.
There are two issues with the JS API that affect NullBot and other JS AIs (like Semperfi-JS):

1. Scavengers player ID is always > maxPlayers, this means that the AI can't actually see scavenger stuff until scavenger attacks it (and even then it still doesn't really "see" scavengers - the API throws an error if you try and list their units/buildings). So scavs are a big problem for AI's - they're like an invisible force on the map that keeps throwing a spanner in the works.

I raised a bug but I'm not sure Per understood my description of the problem properly and he fixed something different: http://developer.wz2100.net/ticket/3123

2. The C++ code in warzone is hard-coded to prevent AI players from picking up oil barrels or artefacts. So even if the AI sees one and tells a truck to pick it up, Warzone just ignores the request :(

viewtopic.php?f=35&t=8848&p=93519&hilit=pick#p93504
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by Per »

Hmm? All player checks since my fix should check against MAX_PLAYERS, not game.maxPlayers, so it should not prevent looking at scavengers anymore.
User avatar
effigy
Regular
Regular
Posts: 1217
Joined: 22 Jan 2010, 03:21

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by effigy »

Per wrote:Hmm? All player checks since my fix should check against MAX_PLAYERS, not game.maxPlayers, so it should not prevent looking at scavengers anymore.
I haven't played further than 3.1beta4. Should it be there?
This is why some features aren't implemented: http://forums.wz2100.net/viewtopic.php?f=30&t=7490&view=unread#p87241
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by aubergine »

Per wrote:Hmm? All player checks since my fix should check against MAX_PLAYERS, not game.maxPlayers, so it should not prevent looking at scavengers anymore.
Most AIs will do their iterations based on maxPlayers global - so if that's still not including the scavs then they won't be picking up scavs.

Also, there is usually a gap in player numbers between normal players and scavs, from memory it's something like:

2 player map: scavs are player 3 (normal players are player 0-1)

4 player map: scavs are player 7 (normal players are player 0-3)

Also, I'm not sure how things work on other map types - eg. a 3 player map, and 5-9 player maps. I assume 10 player maps can't have scavs?

Another thing... do scavs get listed in playerData and startPositions globals?

It would be great if playerData objects had a .playerType property which could be one of these values:

* PLAYER_SCAVENGER
* PLAYER_AI
* PLAYER_HUMAN
* PLAYER_NONE (slot empty)

It would be neat if there was a .name property too - for AI & scavs it would be the script filename (eg. nullbot_1.1.js or scavfact.js). For humans it could be the name they've used for their profile (eg. mine is Aubergine).

And could .difficulty be defined for human (based on medals) and scav players (always EASY?).
"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: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by NoQ »

Hmm? All player checks since my fix should check against MAX_PLAYERS, not game.maxPlayers, so it should not prevent looking at scavengers anymore.
I should have a closer look :D
I assume 10 player maps can't have scavs?
Yes they can, http://addons.wz2100.net/map/metacity (:
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by aubergine »

Are there details of what player IDs scavs use based on map player count anywhere?

Also, Nullbot seems to have an aversion to rebuilding HQ in certain circumstances:

Image

It seems that if it has 2 factories and 2 research labs, then if HQ is destroyed it won't build another one.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by aubergine »

Here's another scenario - I destroyed everything it had but 2 trucks and a research lab. The trucks just sit there doing nothing (I assume oiler group) despite having almost 3k oil left (I went in to debug mode to check).

Image

So I guess if your factories are destroyed it should use oiler trucks to build a new factory to try and revive itself. If you imagine larger maps where oiler trucks might be out in the field when the base gets destroyed, having them build a factory could bring the AI back in to the game for a short while at least.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Artofeel
Greenhorn
Posts: 7
Joined: 10 Feb 2012, 15:32
Location: Russia

Re: NullBot: an adaptive skirmish AI for Warzone 2100 v3.1+

Post by Artofeel »

aubergine wrote:The C++ code in warzone is hard-coded to prevent AI players from picking up oil barrels or artefacts. So even if the AI sees one and tells a truck to pick it up, Warzone just ignores the request :(
For my AI (I'm working on) I did this:

Code: Select all

initGetFeature(oilDrum, me, me);
_oilFeature = getFeature(me);
while ( _oilFeature != NULLOBJECT )
{
  if (numDroidsInArea(me,_oilFeature.x - 128, _oilFeature.y - 128, _oilFeature.x + 128, _oilFeature.y + 128) > 0 ) 
  {
    destroyFeature(_oilFeature);
    addPower(100,me);
  }
  _oilFeature = getFeature(me);
}
So, it's just check if there are droid around oil barrel, if so, then destroy the barrel and add power to the player.
And I need just send droid to oil barrel location. :)
Same thing with the artefacts, but need create array with researches and then just randomly "completeResearch"