Sign in to follow this  
ID Merlin

Strategy game formations

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by ID Merlin
I'm tired of my AI trickling its units into the defender, so I'm going to implement a "formation" for attacking.

I'm sick of seeing it in a lot of games as well. Maybe what is needed is an estimation of victory.

For instance, have the factory only send units to a rally point. And then only attack when the rally point has gathered enough troops to succeed.

Success could be defined economically as destroying more enemy resources than the AI spent on that conflict. Or it could also be defined as a mission rather than a generic target: Reduce player factory output by destroying a factory. Reduce player input by destroying their mines/workers. Or it could be defined by build rate: If the AI has a higher production rate than it's current target, it could successfully wear down the target (provided it can actually take down bits with a spam stream).

For any major asset the player has, how much will it take to destroy it? Is it worth doing? If it is economically feasable to take it out, then gather a strike force with the strength to do the job, and then launch the attack.

And if a unit/group is clearly outclassed (AI will lose more than player) retreat is appropriate -- if possible.

[Edited by - AngleWyrm on February 11, 2008 5:32:29 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this