I can think of some potential issues that would have to be dealt with:
-Larger than size 1 units: they'd totally mess up any formation by the proposed system.
-When units from different fields are selected: What happens if you have an air and a land unit? Or a land and a future-water unit?
-If they have to be faction defined and no XML defining formations means no formations period, isn't that pretty restrictive? Why not a default set of formations?
And my personal opinion:I'd prefer to see formations being a generic shape that units would arrange to, rather than being some specific outline where there must be a specific number of units. If I recall correctly, AoE2 had a strong formations system like I have in mind. So having four units arrange in a "line" formation could work, so could having 20. I don't see how the concept of defining the layout in an XML would be able to expand when more or less units are selected, and
Extrapolation doesn't work.
Now, I haven't played AoE2 for a long time, but if I recall correctly, formations were generated "on the fly". So if you had units scattered around, selected them, and told them to use a rectangular formation, they'd move together to get into that formation. As well, units weren't "stuck" in a particular spot in the formation, but moved around when necessary (eg, trying to fit a 3x4 rectangle in a 2 cell-wide aisle won't work without adapting). Units with less health tried to stay towards the center, so as to keep vulnerable units safe. The AoE2 method of formations would solve the issues of large units, be familiar to gamers, and be friendlier to differing numbers of units.
In AoE2, the formations were:
[More info]- Line: A solid rectangle.
- Staggered: Rectangular, but spread out.
- Box: Melee units made a box around ranged and healing units.
- Flank: Divides the units into two even groups which try to surround the foe.
To sum that up, formations would just be a few generic shapes the units would have to form, and would not be modder defined. Sure, that's less customizible, but it would adapt better for all mods in general, and perhaps more importantly, work.
However, modders could optionally define the "type" of a unit. Ideally, this would be done with a
tag (from GAE). Then we could use tags to define if a unit is supposed to be melee, ranged, cavalry, or "vulnerable" (a vulnerable unit would be one like a dedicated healer, where they should generally be protected in formations. If those tags were not defined, the engine would try and determine that itself (larger than size one units with greater than average health would be cavalry (eg, horsemen, tanks), units with a melee attack would be melee (eg, guards, battle machines), units with a ranged attack would be ranged (eg, archers, gunmen), and units with no attacks, or that have a repair skill and a considerably weaker than average attack would be "vulnerable" (eg, workers, healers).