Ok, trying to "solve" a bit of the puzzle of what was said here and expanding on my thoughts...
Type of formations:
4x4 formations?
A:
x
x x
x x
x x
B:
x x x x
C:
x x x x
x x x x
x x x x
I actually had thought of that too. Namely on a faction-specific rule. E.g. Romans or Greeks would have several different kinds of formations to choose from (that tactical strength was one of both armies' biggest advantages), say three to four (square, "triangle" (not sure what the word for it is in English, two flanks, circle, ...). Now Barbarians would have no formation at all or maybe just one like "circle" (and this is where the ideas I presented earlier came from, Barbarians (or other not so tactical army, would always move around scattered, but they would be able to regroup in a circle).
But that's not what I was talking about. Apparently, it was in Little Helper's mind. Ok, he did start this thread but he also agreed my ideas were part of his meaning so... I'll just focus on what I said before, even more so because those fixed-shape formations would, in my view, need the rest to actually work so...
My proposed "commands" were:
- Keep formation
- Mark formation
- Return to formation
Now, the "keep formation" would actually need the later too already coded (if not as a user-command, at the very least as an internal sub-routine) so... (yes, I've been thinking this in reverse... "top-down"). So let's start at the begining, the "bottom":
Mark formation and
Return to formation:
Mark formation #1+ You can already select a group of up to 16 whatever units you have.
+ You can give a command to all the units in this group that will be executed by each one individually (the same command).
Return to formation+ The relative geographical positions of each unit in the group are already "memorized" by the engine - if you give the "Move" command to the group and they are moving on open leveled-out terrain, they will reach the final destination
in the "formation" (relative geographical positions to each other) they were on departure.
Provided you do not change the destination while they are still moving (which will "mark" a new formation)!- If there are obstacles in the way, different paths with uneven terrain-levels for each unit's (
I think!!!), possibly something else, the formation on departure will not be
exactly the same on arrival. This is where the
Return to Formation command (internally or user/AI deployed) would become useful!
+ The engine already allows you to center on the "major sub-group" of a numbered group (numbered through the Control + # shortcut) by pressing the group-number twice (or the Space key in vanilla glest).
+ By "major sub-group" I mean the largest group of units that can fit in a normal camera view range (for what I've seen ingame, I believe this is how it works, it looks for the biggest sub-group of units of that group-number that fits in a standard view and moves the center of the view to the median of that sub-group units' positions).
Hence, we have the position around which we will make the units return to formation!Mark Formation #2* Now, in order to execute the Return to Formation command, we just need the original relative positions of the units (
formation) to their point of departure's center.
+ We had this point of departure
before we issued the Move command. The center was the same we would have gotten if we had the group number-marked and we pressed that number twice (as above for the point of arrival)
* We need this point (group center) for later use. This is first step of Mark Formation command.
* We need to remember the relative positions of each unit (including those not on the standard view screen), direction and distance (or x,y if applicable), to the above mentioned group center.
Return to Formation #2* We set the new center to the center of the largest group on destination (or even on the move! But let's not think of this now...) and set the destination position of every unit in the group to be the same relative to the new center (direction and distance or x,y) it was to the center marked earlier.
Voila! Mark Formation and Return to Formation implemented! (erm, in theory! )Some RTS games solved this by making it not "move in formation" but "move to position X in the formation". So when the move command is being "aimed", the player sees a series of indicators that show where the units will end up - as a formation. From there the engine just passes individual move commands on to the units simultaneously.
In an open field this results in a sorta formation move.
The above is my view, based on what
I think I know about the Glest/GAE engine, on how to implement exactly that in GAE.
As I said, it could be implemented internally (as the standard group move) or be issued by the player (human or AI). I dunno, maybe some people got used to the current behaviour and found ways to take advantage of it...? (different unit speeds, ...).
Of course, to be player-issued, the AI would have to be told
how (using variables such as different move speeds, attack ranges, sight, unit eficiency/cost etc, possibly to make a one direction formation (front to back) or more (something like outside to inside or something) taking into acount stuff like whether the AI knows the direction the foe is expected to be encountered) and
when (when moving to attack, when moving through unexplored terrain (related to SoD))...
On Formations:
I sat down and spent an hour or two with some graph paper trying to figure out how this might be doable some time ago. I didn't come up with anything good. It may be possible to do by treating several units as one larger unit, but even this would I think have some problems. Glest's grid constrained movement doesn't lend itself well to this feature
Does any of the above I said help regarding the grid constrained movement? Did you mean it is constrained to an x,y grid? Does it help to set the units' positions relative to the group center in a x,y coordinate?
I believe these two commands/functions alone would be very helpful in playing formations.
Keep Formation- Obstacles and terrain levels will break the formation.
+* You could use Mark Formation and Return to Formation (automatic or user issued) to well, return to formation once back on open-enough terrain... (for automatic use: Pathfinding permiting...
)
- Different speeds for different units may break formations a lot, specially on long "walks".
* Sollution for the above speeds problem: when moving in formation, make every unit in the group move only as fast as the slowest unit in the group!
- Air units and land units in a group: reducing speed will not solve...
*? For air units: Mark F. and Return to F?...
Might add a periodic check to see if we can / whether it's worth to return to formation, even if temporarily.
- Regarding:
Of course, with pathfinding you hqve to be careful using this method. What can happen is any units "in front" will start walking forward - but the units behind them will try to walk around them right away. It's b/c the pathfinding generates a "walk around that unit to reach your goal" - even though that unit won't be there in a moment.
As mentioned above, better pathfinding options can eliminate this. True formation movement would also.
+? Won't this here bellow help, once implemented?
On cooperative A*:
No, cooperative A* will just make units move more intelligently in congestion, they will take into account where other units are, and where they will be in the future.
I think that, to implement formation
designs such as Little Helper posted and I discussed a bit above, you would need to have those three commands/funcionts above implemented, as automatic (from as soon as you'd selected a formation).