[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!
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 »

Artofeel wrote:
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:

...
Unfortunately, I don't think that will work in true multiplayer mode.
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 »

Cyp wrote:Unfortunately, I don't think that will work in true multiplayer mode.
and why? there is some big difference between multiplayer and skirmish? :? (excluding number of human players)
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 »

Artofeel wrote:
Cyp wrote:Unfortunately, I don't think that will work in true multiplayer mode.
and why? there is some big difference between multiplayer and skirmish? :? (excluding number of human players)
Number of clients. Don't think there's any message for changing the power a player has, so if a client adds 100 power to a player, the other clients wouldn't see the power, and the game would go out of synch. If there's only one client, it doesn't matter much if the game goes out of synch, since there's no other clients to notice.

Try using DORDER_RECOVER in any version containing 8949148a9ddbf92ecc3fb2b4ddcd0e74d849be5c, such as v3.1_beta5 (you will need a time machine to travel to the future to download it, though).
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 »

It seems that if it has 2 factories and 2 research labs, then if HQ is destroyed it won't build another one.
I think he's simply afraid to rebuild because there are enemy (aka your) towers around.
it should use oiler trucks to build a new factory to try and revive itself.
Yeah, it should, will do.
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 - that's great news about DORDER_RECOVER in beta 5!! Can't wait! :D

I assume that AI scripts will need to issue that command to pick stuff up, and that stuff won't be picked up by AI droids simply by moving in to the tile while carrying out some other command? (Otherwise, after attacking an enemy AI base the human player won't get chance to pick up artefacts because AI droids going about their usual business will have picked them up).
"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 »

@NoQ how are you detecting when a map has lots of sea, and how do you detect which units are hovercraft?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
zany
Trained
Trained
Posts: 303
Joined: 20 Sep 2011, 07:04

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

Post by zany »

aubergine wrote: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.
what did you do to the gfx? that looks nothing like what it should?
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 »

I'm on an Apple Macbook heh. What should it look like?
"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 »

aubergine wrote:@NoQ how are you detecting when a map has lots of sea, and how do you detect which units are hovercraft?
1. By calling droidCanReach for initial trucks to enemy start locations at start of the game.
2. By calling droidCanReach for newly-built droids to enemy start locations.

This method is pretty bad, because humans are capable of relocating their bases to the island, which will not be detected, but i have no idea how to fix that, and anyway, it's better than nothing.
aubergine wrote:What should it look like?
+1.
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 »

An alternative might be to enumDroid() for each enemy and see if the droid .name includes the word "Hover" - if lots of their droids are hover, there is likely lots of water on the map.

I really wish there was a proper way for an AI to get real map information - eg. for each tile what is its terrain, elevation, lighting, and continent.

BTW, I've been doing some more digging in to the QtScript environment and it looks like it's not caught up with some of the more recent ECMA-262 additions such as deconstructors and iterators/generators which is making my progress on a long running iterator (discussed earlier in this topic somewhere) rather tedious :(
"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 »

An alternative might be to enumDroid() for each enemy and see if the droid .name includes the word "Hover" - if lots of their droids are hover, there is likely lots of water on the map.
Emm not really.
1. There are many pure-hover strategies on completely ground maps. For example, flamers make sense only hovers.
2. NullBot doesn't include the word "Hover" into the unit name even if it's hover. So in hover FFAs this method won't work.

The better way could be to check droidCanReach to all enemy factories :hmm: No idea how exactly.
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 »

Well, this will get you a list of all land droid factories in the game (I assume you'd want to check allies too):

Code: Select all

function enumFactories() {
  var factories = ["A0LightFactory","A0CyborgFactory"];
  var factoryList = [];
  var player = maxPlayers;
  while (-1<--player) {
    if (player == me) continue; // assume we can reach our own factories (:
    factories.forEach(function(factory) {
      factoryList = factoryList.concat(enumStruct(player,factory));
    });
  }
  return factoryList;
}
Then just iterate through factoryList (array of structure objects) doing a droidCanReach on each of them.
"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 »

No no no, the main problem is how to pick the droid necessary for the call.
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 »

Hrm, yes, considering that eventually all your trucks will be hovers...

Maybe you could do something on eventDroidBuilt() -- if you know the built droid isn't a hover/vtol then use that, and have a de-spam so it only does the enumFactories thing no more than once per 3 minutes?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
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 just had a nice 30 min skirmish vs. MC'bot 1.03... I was wondering does he also do nice MG research? I was surprised that once I got to his base he put up a lot of HMG Hardpoints (this screenshot is missing a few, KIA):
wz2100-20120312_001957-Sk-HighGround.jpg
You do not have the required permissions to view the files attached to this post.
This is why some features aren't implemented: http://forums.wz2100.net/viewtopic.php?f=30&t=7490&view=unread#p87241