Military strategy and AI

Started by
3 comments, last by trysil 22 years, 8 months ago
Hi! I''ve been designing (very high level design this far) a RTS based on the concept "tank rush won''t work"... well there is a little more to it :-) During a military campaign the AI has to make strategic decisions based on more or less complete information about the enemy. Decisions on several levels from platoon up to high level, long term decisions. The decisions may consist of sending a tank platoon up a hill to secure it - to - bombing enemy supply lines deep inside enemy territories - to - a naval blockade of its harbours. Many of these problems may be solved using state machines etc. But the problem is that I want the AI to adapt to changing circumstances. The front line may have moved away so far that the hill lost it''s strategic importance, why squander resources to secure it? I''ve been looking into NN:s, Fuzzy, state machines. Maybe a combination there of or...? Second --- "City building AI" - Someone? /Trysil "A witty and slightly sarcastic quote from an unkown source" -- The generic SIG /trysil
"A witty and slightly sarcastic quote from an unkown source"-- The generic SIG/trysil
Advertisement
Look into influence maps.

Basically, this is how it works: You start with a map of numbers corresponding to your game map, filled with 0s. Enemy units subtract in a decreasing radius around themselves (maybe use a logarithmic function for this - you can think of it as falloff) from values in the map, depending on their firepower, etc. Friendly units add as much as a comparable enemy unit would subtract. You''ll end up with countour lines of 0s. Those are your fronts. Very low numbers are deep in enemy territory. Very high numbers are deep within your own.

You can also have "strategic importance" influence maps. Resources add. High grund next to low ground adds. Being within range of enemy mortars subtracts. Being in range of areas of high enemy influence adds. Etc.

This is far from being a complete AI solution, but it is useful. You''ll probably do best to forget about learning AI and just code everything so it plays well using MinMax trees or something more deterministic.

As for NNs, I freely admit I don''t understand them, but I have a feeling they''re really nothing more than fancy trial-and-error state machines that are harder to debug.
Thanks.
Learning AI is not the problem... spent five years at the university doing just that :-)

The problem I have is to break down this problem area into specific problems that can be
stated using a logic formalism - i.e. fuzzy expressions, patterns to be analyzed with NN:s,
specified as a state machine etc.

The description you gave of specifying the battlefield with "0":s is a good start, have to work
on that.

So the problem is not that much the AI but how to break down the "problem" itself.

/Trysil

"A witty and slightly sarcastic quote from an unkown source"
-- The generic SIG

/trysil
"A witty and slightly sarcastic quote from an unkown source"-- The generic SIG/trysil
Strategy - ignoring its economic aspects - is essentially pathfinding. Use A*, and use the influence map to give each tile its cost. That way, you maneuver around enemy concentrations to attack the weakest portions - giving rise to such behaviors as flanking. The destination points for each "platoon" will be areas of high strategic importance - as defined as areas with high numbers on the strategic importance influence map. Defense shoud simply be defined as the fortification of areas with high strategic importance. The aspects that a learning AI would have to consider would be: How much should different things influence the strategic influence map? How much should different enemy units (or combinations thereof) affect the player influence map? What combinations of units are best suited for combat with what other combinations of enemy units? How much should a path cost for a given type of platoon? What combination of units is best at defending in certain areas? All these questions should be able to be solved using statistical analysis of battles.

Here''s a list of things that should be considered by the learning AI and weighted to be part of the strategic influence map (and some weights that I think could work):
- A front (+5)
- High ground near low ground (+2)
- A choke point (+5) [You''d need a deterministic algorithm to determine choke points, I think)
- Resources (+6)
- Enemy supply lines (+2)
- Enemy production centers (+2)
- A record of a lot of combat in that area wihin the past X minutes (+3; X=10)

You should have, in addition to the strategic influene map, an accompanying player influence map. However, you could also have the following maps:

- Team 1 firepower
- Team 2 firepower
(Note that they are seperate; they don''t cancel each other out. If you''re in range of the enemy mortars, you''re in danger regardless of whether you''re also in range of your own mortars)



In addition to strategy, you may want to have tactical learning AI. This wouldn''t take into account any of the influence or firepower maps, I think, but just have some of the following inputs:
- unit elevation
- target elevation
- geometric distance to target
- length of shortest path to target
- terrain type around target
- terrain type around unit
- unit type
- target type
- unit health
- target health.


That''s a lot of code, no matter how you do it.


Of course, there''s also the brute force approach: Statistically evaluate all possible game states that can be reached from the currrent game state in CONST_X minutes/seconds/hours and choose the one with the best win-to-loss ratio. Of course, for a game with 128x128 maps with 5 terrain types, 3 of which are passable, 2 teams, and 7 units types, that would be a total of ((5-3) + 3* 2 * 7)^(128 * 128) , assuming my math is correct, and that, again assuming my math is correct, is 44^16384 or, according to my calculator, infinity . Imagine trying to store that file on a CD for distribution! So I don''t think that''s an option...
You might also be able to use a GA to "evolve" working stratagies into your NNs. I''ve been toyin with it for a while now, and it seems to work. And of course, GAs are actually easier to code (in my opinion) then NNs. it goes something like this...

you have a bunch of pre-generated NNs. All the weights are random. You assign your NNs to there positions (Admiril, capt. etc..) Low level to high level, like you said. And there is more than one command structure too. (each NN command structure will take in the same data, but learn differently, do to the random weights). The command structures that do better, you "breed". The weights evolve in controled fashon based on how the command structure did in "war" or what ever.

I wrote a tic tac toe NN with a GA and it worked great. I found that the best stratagy for ttc is one that will always come out in a tie. TTC might not have been the best game to use, but it was the easiest to code.

This topic is closed to new replies.

Advertisement