Advertisement

Strategy game formations

Started by January 31, 2008 09:02 PM
9 comments, last by AngleWyrm 16 years, 9 months ago
I'm tired of my AI trickling its units into the defender, so I'm going to implement a "formation" for attacking. My idea is to build a list of candidate hexes, and use the blackboard to reserve the hexes that a particular unit wants to move to. The line of units should be within one turn movement for the units, so they don't get scattered. I have identified the front, flank and rear of the defenders using the influence map and distances. So, I can find the hex that is within the movement capability of the units and on the line between their center and the defender center. I want the strongest units to be in position to attack the center, the faster units to attack the flanks or rear, and the weaker units to hang back. Any ideas how to create that line so that the units advance in a sensible way? I don't think this is particularly hard, but if someone who has done this can offer some practical advice that will save me some time, it would be greatly appreciated.
If you are using an influence map, why don't you identify a value on the map that would be used for all your attacking units. That is, you could say "OK guys, everyone line up on the -2 line." Ideally, if you are using a combined influence map of your own strength and the enemies, lining up at the 0-line is the battle front anyway.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
One of the problems that I have with my first implementation is that the faster units get to the line, and then to the next line, faster than the slow units. (This was predicted in AI Game Programming Wisdom.) I'll keep plugging away at it...
Can the fast units NOT move at their maximum speed? Identify the units that will be taking place in the assault and proceed at the speed of the slowest.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Quote: Original post by InnocuousFox
Can the fast units NOT move at their maximum speed? Identify the units that will be taking place in the assault and proceed at the speed of the slowest.


They can. I need to readjust my AI to keep them in line.
Could you design it so there are more than one location for the rally point? The c&c series had a rally point for the first time in RA2, and they always rally in the same place for each base. It would be good also if the AI could separate its forces into smaller groups each with its own waypoint list, allowing the implementation of pincer movements, diversionary raids, etc.

Just a thought.
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
Advertisement
Attack formations and movement formations can be done by implementing a simulated command chain, meaning organizing your military "units" in military units. (See the quotes?)

Military units get orders to operate in certain space restrictions and in a certain way (offensive, defensive, hit-and-run etc.).
By graining your military down to heterogenous units formed by homogenous "individuals", and imposing a chain of responsibility, you can apply rules of engagement which in the end will result in your military units organizing themselves autonomously inside the formation - by obeying their space restrictions, and rules of engagement.
(Space restrictions can be absolute, like "position x,y,z", and relative like "left to unit 2./34 in a distance of d", always applying to space volumes, not points only; this way, the units will always try to stay at their ordered position, and you only need to do the pathfinding and movement calculations for one unit, which will be either one random "flag ship" or the abstract higher-order unit, like a wing, squadron, flotille, fleet or whatever)
Using your brain doesn't hurt at all.
Quote: Original post by lucem
Attack formations and movement formations can be done by implementing a simulated command chain, meaning organizing your military "units" in military units. (See the quotes?)

Military units get orders to operate in certain space restrictions and in a certain way (offensive, defensive, hit-and-run etc.).
By graining your military down to heterogenous units formed by homogenous "individuals", and imposing a chain of responsibility, you can apply rules of engagement which in the end will result in your military units organizing themselves autonomously inside the formation - by obeying their space restrictions, and rules of engagement.
(Space restrictions can be absolute, like "position x,y,z", and relative like "left to unit 2./34 in a distance of d", always applying to space volumes, not points only; this way, the units will always try to stay at their ordered position, and you only need to do the pathfinding and movement calculations for one unit, which will be either one random "flag ship" or the abstract higher-order unit, like a wing, squadron, flotille, fleet or whatever)


One reason why approaches like this (which are great in principle) don't make it into games is the sheer volume of computation needed at each iteration to work out what units should be doing. This is why game AI often involves simpler explicit descriptions of state and behaviour.
Complexity of this depends on how you implement it.
Re-computations don't have to be done every frame, and mimicking real command structures can be very efficient - in this case, AI decisions fall down the tree automatically, and get concretized on the go.
Inside the various stages, existing technology like state machines etc. can be used, and as orders usually stay valid for longer periods than a couple of frames, it can be both elegant and efficient.
Using your brain doesn't hurt at all.
I like the "idea" of the command hierarchy, but I agree that the implementation would be too complex and time-consuming. The game plays pretty well with individual strategies that are simple to compute, because there isn't any huge "strategy" involved in a small battle.

I'll probably go the bigger route when I start working on more global strategies involving multiple armies or decisions such as development, attacks on other cities and so forth.

This topic is closed to new replies.

Advertisement