I am currently writing the code for the formation system in my RTS game. It utilizes the standard movement command to move all the units in a squad, or higher order unit grouping, to a specific offset from the leader. I have a few questions about preferences and implementation. Currently in my idea you can define premade formations for a given leader unit type in XML. You assign the offets and name the formation and the unit type will have a button to organize your forces that way. I will ask some questions first and then some problems I have foreseen. What is the best way to determine position? I could merely allow you to assign a series of offsets. The problem here is how to choose what unit goes where. Ideally ranged and support units would need to go towards the back. If you have one set of offsets and one button the player would have to add units in the proper order if you tried to specify special offsets for support. My second plan was to assign special offset vectors for each unit class. So you would have one for melee and one for range. You could further subdivide, optionally of course, and have a first row, second row, and third row of melee, and then a row for archers and one for healers and mages or other support units. I know that Kohan had some formation work, but it was quite hard coded. You always had the same formation layout and it never really went above the first level. Now I really wanted the system to be customizable. There is no hard limit on the number of units in a squad, or the squads in a century and so forth for cohorts, legions, and finally hosts. So I have to figure out how to deal with people who put more than 10 units in a squad for instance. Most default formations will allow for the leader and 9 other units. There are free form formations, basically a vector with up to a leader and 100 units in a squad, a leader plus 25 squads in the century and so forth. Basically the idea is that you have enough space in a group to go all the way up to the next level. After you get to 100 units in a squad you are at the level of a century. And when you have 25 squads in century you are up to a cohort so why keep overloading a century? And so forth down the line. At the host level its not really a vector of hosts so you have no cap. So you are pretty much free to organize your armies how you like. But how do I get default formations to deal with overloaded squads? I guess you could have an overflow like if all your melee rows are full start stacking units on the outside of the first rows. Or stick them in a new automatic row in front of previous front rows. The problem with the free form system is you have to assign the positions in game. Essentially put all units in there spot and then hit a button. And of course your unit can only remember a few specialty formations, well not technically but just the amount of time to set it up especially for larger selections of units. So does anyone have opinions on the best way to set up the non-free form formations? Or any thoughts in general about units moving in formations? This thread is mostly about implementing formations, I will have probably have another one discussing the strategical and tactical implementations.
Can you explain the system in more detail? What level of the hierarchy does the player directly control, e.g. the unit, the squad, etc.
Usually people ask for less detail
There are 4 types of individual unit. Leaders, Heroes, Mages, and regular units.
You can control all of them as individuals. You can also assign regular units to leaders, mages, and heroes. You can control any level of the hierarchy directly from single units to hosts. You could even select a group of regular units not assigned to a leader and it would work like a regular RTS game.
However the game is designed to possess Sim, TBS, and RPG features and systems so if you spent all of your time microing your army you would be falling behind in research and economy and you wouldn't have time to decide what to do with RPG stuff like raising stats and having mages learn new magic and such.
The hierarchy works hand in hand with toggled and selected settings/commands and the unit automation to let the AI fight battles for you. You would normally micro only powerful mages and heros if you microed anything in a given battle.
So you could make a cohort with 5 squads of melee and 3 of archers and 2 of cavalry and one of mages and set the melee to hold a line, maybe a line 1-3 layers thick, tell each squad of archers to focus a single enemy mage or default to enemy archers if no mages are present. Then you set your cavalry to auto flank and charge enemy support, or even attack the melee line from the back and cause the enemy to route. Or w/e. And mages could be set to cast buffs or to cast attack spells. The units would do all this automatically.
But maybe you are looking around and deciding what you need to focus on at this moment and that cohort is doing badly in a fight, so much so that its more important to help it than to do anything else, and then you are perfectly capable of changing orders or controlling the mages individually or maybe microing one or more cavalry for better flanking.
The game is more like grand strategy than a traditional RTS. So the hierarchy and automation is so that your armies can handle themselves unless they are outnumbered and maybe even then, but if they get into trouble you can use your skills as a player to try and save them. The City Builder/Sim aspect has a similar level of automation. Theoretically if you are just not good at city building you can set up some simple automation and get by while focusing on fighting, but if you are not super good at tactics you can focus on min/maxing your economy and let the automated armies protect you.
And if you are good at both you can focus on whatever you need to at the moment.
In Star Wars: Empire at War they had squads of x-wings and tie fighters that used offsets defined in xml. There was some hard coded stuff for how they would clump together and spread out depending on context but it seemed to work okay in that simple example.
I think you should consider having tiered formations where you could select your archers and give them a formation and same for your warriors.
Then when you combine your warriors and archers you can use another formation that puts the warriors in front and the archers in back.
This would also let you make mixed formations with a line of warriors with archers in a circle behind, and then behind that is a triangle of mages and behind that is another line of warriors and then on the sides two vertical lines of spearmen.
So this way it would be pretty easy to set up a complex formation in a way thats easy for the user to understand. In order to break down the formation I think clicking to select the whole group and then control clicking to grab single units and drag selecting to grab sub-formations would work pretty well.
Also look at games like Total War and LOTR: BFME, they allowed you to drag the cursor when you issue a move command to adjust the width and height of the formation to easily change from 1 row of 20 soldiers to 5 rows of 4 soldiers.
However the game is designed to possess Sim, TBS, and RPG features and systems so if you spent all of your time microing your army you would be falling behind in research and economy and you wouldn't have time to decide what to do with RPG stuff like raising stats and having mages learn new magic and such.The hierarchy works hand in hand with toggled and selected settings/commands and the unit automation to let the AI fight battles for you. You would normally micro only powerful mages and heros if you microed anything in a given battle.
Maybe I should have asked for less detail.
I'm still not quite clear on how selection works. How does the player change selection modes? e.g. from individual selection to group or larger group selection?
Also, are the unit types pre-defined? Or can the player create new unit types?
The major drawback of the TW/BFME system is that it isn't great for managing small groups of units (movement commands aren't executed until the player releases the mouse), but if this isn't a priority, then it's a good solution.
To select a group the player clicks on the leader. Commands to units in a group are issued from the leaders command panel, while individual commands are issued from the individual units. So a squad leader has orders that affect his squad. A centurion has orders to affect his century and so forth.
I am not sure what you mean by unit types, since individual entities in RTS are called units. Groups of units or group types are purely representative of levels of hierarchy. So units are individuals squads are groups of units centuries are groups of squads and cohorts are groups of centuries and legions are groups of cohorts and hosts are a group of legions.
The names don't really mean anything though. And a modder could change them.
Players can mix and match stuff. So you could have squads from 1 to 100 units and centuries from I guess 2 to 1000 if you make a century where the leader only rules over a single other leader unit. A century could have only 1 or 2 squads or it could have like 10 or 15. I do believe that a cohort could have both centuries and squads and even individual units in it. Its really just regular units follow a leader and leaders could follow another leader. It doesn't really have to stop at hosts either. You could have a leader who is assigned 2 leaders of hosts or something. The names are just an example of a relatively real military system. I can't imagine you would ever NEED to have an army bigger than a host but if you wanted it you could have it.
I do remember that from Rome: Total War. I may do that or you could just click a button and make them change shape that way.
Go play 1984's Ancient Art of War
Look for the formation editor
That is where you start. I am completely perplexed that this has never evolved to become a mainstay feature of RTSes.
The 3 units in those games become "archetype" placeholdersArcher = Whatever Ranged UnitBarbarian = Whatever Armored Unit to push ground under fireKnight = Whatever unit vs unit, unit. (eg: High firepower and mobility)
Then you let the player decide what their formations should look like with a GUI
The played then decides what formation to call depending on his unit composition.
eg: The decision would run something like this for a player's individual custom formation choices they made I have Ranged unit Type X, and Skirmisher Type Y, so I call formation ZIf I had Ranged Unit Type Y, Skirmisher Type Z, and Armored Unit type G, I'd use formation F
Don't forget to patent this and use it against everyone....
Well, I have done a lot of work on the formation so far. Currently I just need to add formation buttons to the GUI, which is surprisingly hard with a C++ gui library. Then I will get to personally testing it and seeing what happens. Then hopefully some of my alpha testers can be bothered to try it out for me and give opinions.
There are many great features available to you once you register, including:
Sign in or Create Account