AI strategy should be based off map parameters

Discussions about AI types, units, tactics & strategy.

AI strategy should be based off map parameters

Postby MIH-XTC » 06 Feb 2015, 20:43

I think the only way to design decent AI behavior is based on characteristics of the map. How feasible would it be to write code to extract characteristics of the map? An AI profile would then be picked (not generated arbitrarily) based on those characteristics. I'm thinking the following would need to be extracted from the maps:

# of starting oils in base
# of remaining oils outside the bases
# of players
size of map (# of tiles)
# of tiles needed to reach furthest oil in the middle. (how many tiles it takes to reach the middle oil using the shortest path)
# of tiles needed to reach opponents base

For example, consider a map that has 32 total oils with 4 players, each of which starts off with 4 oils in their base. That means there are 16 oils outside of the bases with 4 potentially going to each player. The AI would need to know which 4 oils outside of his/her base are the closest and out of those 4, which one is the furthest away and how many tiles it is away. This information would dictate which AI profile to choose and actually this is the same information that human players essentially use but they probably don't realize it.

If it is possible to extract this information from a map, there is no doubt that I could generate static base building and research order sequences that would beat most human players in a fair 1v1 game. The AI profile would also never make any defence and strictly build units of my choice.

How difficult would it be to write code to extract this information from a map?
MIH-XTC
Trained
Trained
 
Posts: 125
Joined: 31 Jan 2014, 07:06

Re: AI strategy should be based off map parameters

Postby Per » 07 Feb 2015, 01:58

You should be able to figure out these with the existing javascript API, I think, except for the shortest path, which is not yet supported.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3518
Joined: 03 Aug 2006, 19:39

Re: AI strategy should be based off map parameters

Postby NoQ » 07 Feb 2015, 11:01

If it is possible to extract this information from a map, there is no doubt that I could generate static base building and research order sequences that would beat most human players in a fair 1v1 game.

Haha. Tactical analysis would be a lot harder. Even on a fixed map with hardcoded hand-picked research path and build order, the AI would still loose his first battle 1:2.

upd: didn't have time to write a sensible post, so the above sounds like crap, sorry >< Geography analysis would probably make the easiest and very useful addition to the existing AIs (though accessing the pathfinder would be one of the smallest problems you encounter). On the current development branch you have access to terrain topology, so you may already have a look at any proof of concept approaches and later see how to improve performance through native functions.

...it's just that making a human-level AI would take a lot more.
User avatar
NoQ
Elite
Elite
 
Posts: 6015
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: AI strategy should be based off map parameters

Postby MIH-XTC » 07 Feb 2015, 21:07

NoQ wrote:
If it is possible to extract this information from a map, there is no doubt that I could generate static base building and research order sequences that would beat most human players in a fair 1v1 game.


Haha. Tactical analysis would be a lot harder. Even on a fixed map with hardcoded hand-picked research path and build order, the AI would still loose his first battle 1:2.

upd: didn't have time to write a sensible post, so the above sounds like crap, sorry >< Geography analysis would probably make the easiest and very useful addition to the existing AIs (though accessing the pathfinder would be one of the smallest problems you encounter). On the current development branch you have access to terrain topology, so you may already have a look at any proof of concept approaches and later see how to improve performance through native functions.

...it's just that making a human-level AI would take a lot more.



Are you referencing the AI's unit handling abilities? Yea I can imagine that would be hard to program. I think just programming a collection/rally point for AI's units and then making a push with no micro unit handling would still suffice though.

As an example of what I mean for static build, res and truck orders, this is what I would do for low oil maps (less than 10 oils):

https://www.youtube.com/watch?v=u8irDuPU7Sk

Taken from the comments section:

BUILD ORDER: fac, res, fac, hq, res, pow, pow, fac, res, pow

TRUCK ORDER:
1st truck builds base
2nd build base
3rd build middle oil/possibly opponents oil
4th build middle oil
5th build oil in and around base
6th build base

RES ORDER: mg, truck, half track, mg, light cannon, engine, cyborg fac, pow upgrade, twin mg.

Despite the lack of unit handling on AI's behalf, I think this would give most human players a good challenge in a fair 1v1 game. The static build/res/truck orders listed above would vary slightly depending on map size and # of oils but I think I could modify the orders just based on map parameters without even looking at the map. It would probably take 8 - 10 different profiles for each set of map paremeters but those profiles would suffice for all maps so at least it's dynamic in that regard.

I understand object oriented programming pretty well but I don't know anything about warzone development. I haven't a clue as to how difficult this would be to implement. On a side note, approximately how many developers are there working on AI behavior?
MIH-XTC
Trained
Trained
 
Posts: 125
Joined: 31 Jan 2014, 07:06

Re: AI strategy should be based off map parameters

Postby montetank » 07 Feb 2015, 21:53

MIH-XTC wrote:On a side note, approximately how many developers are there working on AI behavior?

Ask NoQ :wink:
By the way-don`t forget the difference between Strategy and tactics. Strategy: To know, WHAT you want to use.
Tactics: To know, HOW you will use.
In case the WZ-game ends in a draw , the game winner will be determined by penalty shoot-out.
User avatar
montetank
Regular
Regular
 
Posts: 624
Joined: 14 Feb 2013, 00:05
Location: Montenegro

Re: AI strategy should be based off map parameters

Postby stiv » 07 Feb 2015, 21:58

Just Thinking Out Loud:

Extracting map features is not the hard part. Relatively trivial. Deciding what they mean and what to do about them is more interesting.

While WZ takes place *on* a map, and the map certainly influence the game, you are not fighting the map. Your opponent is your opponent. Figuring out what threats he poses and how to respond is the fun/challenging part.

And why isn't JTOL a standard internet acronym?
stiv
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 876
Joined: 18 Jul 2008, 04:41
Location: 45N 86W

Re: AI strategy should be based off map parameters

Postby NoQ » 13 Feb 2015, 05:45

Oh well, afk so much that will compose offline and paste><

You'd probably want to know what's already been done. Not much. Pretty much the only kind of geographical analysis implemented in NullBot is support for hover-only and vtol-only maps: whenever the AI finds that the remaining enemies cannot be reached by ground (either from start, or after defeating one of the neighbors), it stops producing ground units and focuses on researching the necessary propulsion technology as soon as possible. That said, the original NullBot doesn't even support vtol-only maps; only NullBot3 does. Another tweak done in NullBot3 is balancing research and production depending on power amounts; i think i already pushed that for v3.03; this may count as a map-specific trick, because amount of oil controlled is a very good approximation for amount of oils in base during most of the game (apart from the early game), and is probably even more relevant.

Now, what needs to be done. First of all, the AI should be aware of 'rush distance' - the amount of time an early wheeled tank takes to reach the enemy. It is also the amount of homeground advantage a techer has over a rusher (on enemy territory you'd always have less tanks), so it's the primary concern for choosing the amount of teching gambit a player can afford. All existing versions of NullBot are hardcocedly-tweaked for maps with rush distance of around two minutes. Going away from this hardcoded value and making the AI flexible would be a great improvement.

The problem is not easy though. The first test for the concept would probably be the 2c-Startup map with scavengers. Usually, when scavengers are enabled, rush distances change dramatically and unpredictably. If scavengers are completely blocking your way to the enemy, then the map plays as if it's really huge. Depending on their strength, your first engagement may be delayed to around python-medium-cannon phase, and it's pointless to produce a single unit before you reach this tech level. But on 2c-Startup, scavengers are not completely blocking; you can reach your enemy by highground, which is slower than the direct way, but much faster than killing off scavengers in the middle. So the AI would need to find the path through the highground, determine that it is safe, calculate the distance and compare it to time required to blow up the scavenger base, and only then decide on its tech path. Additionally, a human would notice that the northern base is vulnerable to tower rushes from highground (covering all four derricks with one or two mg towers - or even worse, with MRA pits, then you cannot fire back from lowground) and probably try to make use of that as well.
User avatar
NoQ
Elite
Elite
 
Posts: 6015
Joined: 24 Dec 2009, 11:35
Location: /var/zone


Return to Skirmish / Multiplay