Formations

Warning

This page is a work in progress. Assume that nothing described here is finalised yet and everything could work completely different in the end.

Current state and Goal

Fighting in 0 A.D. should be diverse, interesting and challenging. Good tactics should make it possible for a player with a smaller and weaker army to win against a stronger opponent. There should be multiple gameplay mechanics that enable the players to use a variety of tactics and to counter tactics of their opponents. Formations are a core element of battles, but there's currently just a placeholder implementation which does not have a real impact on how battles work in the game.

Battalions vs Single units

Currently, all units in 0 A.D. are controlled individually. A battalion is a new concept where units can only be selected and moved as a group. Battalions can be put into a formation.

Training

Approach A: Single units only

All units can be trained, selected and ordered individually. For fighting, you usually use a formation because that brings many tactical advantages and bonuses. This has some advantages compared to battalions:

On top of that, most of the disadvantages can be mitigated:

Approach B: Battalions only

Units are trained in battalions already and they can't be separated. With a population cap of 300, it becomes quite a task to manage all the units individually. Such management tasks include:

Training all units in battalions reduces the tedious micro-management tasks and gives the player more time to do fun things.

Decision

Approach A will be used. It seems like Approach B only looks good in the beginning, but there are too many inconsistencies with how the game is designed and it would require too much changes for only little benefit.

Fighting

If we support fighting in formation as well as fighting as individual units, both need to be valid choices under some circumstances.

Fighting as individual units

Fighting with formations

Number of units in formations

Unit types and formations

We need a decision how we restrict the type of units that can form a formation together.

Allowing ranged and melee mix

Mixing ranged and melee units in the same formation is not allowed. An important aspect of the system is the challenge of protecting the ranged units against attacks from melee units and cavalry in particular.

Forming and disbanding a formation

Forming a formation

A formation is formed by selecting a number of units and clicking the button of the desired formation. Buttons only become active when all requirements are met. For example, a formation requires a minimum number of units or it requires units of a specific type. Formation bonuses start applying as soon as 90% (exact value TBD) of the units have reached their designated location in the formation. If the new bonus would apply instantly after ordering a different formation, players could switch to different bonuses instantly while in battle. This would be unrealistic and a problem for the visualization of the bonus. Why would you get a different bonus when none of your units actually move?

Disbanding a formation

Duration

Disbanding is instant.

Assuming a formation has a defense malus on the rear, you can instantly get around this malus by disbanding. The downside is that forming the formation again might not be possible if your units can't get into position for the formation anymore. The other obvious downside is that you also loose all bonuses.

Conditions

Formations can be disbanded if their morale is above 50% (exact value TBD). This prevents players from quickly disbanding a formation before it gets into panic mode.

Forced fallback to default formation

Different formations have different minimum requirements for the number of units. This is meant to be a higher value than the minimum battalion size because it should encourage players to make larger battalions without having to increase the lower limit for forced formation disbanding. As units in the formation die, this minimum requirement suddenly isn't met anymore. In this case, the formation falls back to a default formation. How this happens exactly is a bit tricky because it should be visualized well to the player and shouldn't look strange or unrealistic.

Forced disbanding

Battalions have a minimum requirement for the number of units. As units in the battalion die, this minimum requirement suddenly isn't met anymore. This causes the battalion and therefore also the formation to get disbanded. Units can be selected individually again and they loose all formation bonuses.

Considerations:

Fighting in formation

Default behaviour (melee)

Ranged

TODO

Special behaviour

There are some special formations that might need to stay in formation more strictly (TODO).

Movement in formation

Formations have a larger obstruction than single units and have difficulties pathing through narrow gaps. The following approach is used to work around this issue.

TODO: Some open questions:

Formation positioning

You click to the spot where the left side of the formation should be placed and then drag your mouse to the right side. Going further right means your formation will have more columns but less rows. Clicking to the right and moving the mouse to the left on the screen will do the same, but the formation will be turned 180 degree (so the left side with respect to the formation is always where you start click-dragging the mouse). Some formations may have a limitation how many rows or columns they need as a minimum. Such restrictions will be reflected in a preview while you are dragging the mouse.

Directionality

So far, formations basically just reduce the number of entities the player has to control and therefore make it possible to use the rock/paper/scissors concept. To offer real tactical depth for battles, we need some other means of getting an advantage over the enemy.

Formation based

Directionality for formations means that formations have an orientation and units get different modifications for their attack and/or defence values based on the direction they are facing relative to the formation orientation. This can be used to achieve two slightly different mechanics:

1. Surrounding

Assuming a formation can change its orientation nearly instantly, the only way to take advantage of directionality is to attack from more than one sides. The formation can turn quickly, but it can't face two directions at the same time. It also feels quite apparent that surrounding troops or attacking them from two sides should give you some advantage and therefore the concept can be easily explained to players.

2. Outmanoeuvring

If formations have a limitation how fast they can turn, there's also the possibility of outmanoeuvring slow formations. This could be applied to special formations like a Phalanx, which is very deadly against cavalry when attacked from the front but vulnerable when attacked from the back.

Unit based

Unit based directionality means that a unit has weaker armour on the back and the sides. If you attack a formation from the side, the units there will obviously turn to face the attackers. They have their defence values reduced because they are on the side of the formation (formation directionality), but their defence values aren't reduced further because the unit itself faces the attacker (unit directionality). Unit based directionality applies in the following situations:

1. Attacking units on formation-corners

If you manage to attack a unit at the corner of a formation from the front and the side, you can benefit from unit based directionality. To prevent this, players want to close gaps between formations or make their formation wider than the enemy formation. If the attacker manages to break the line completely, this effectively doubles the number of corners and opens a way to get behind the formation.

2. Wide formation with few ranks

As described above, formation directionality favours very wide formations to make it harder for the enemy to attack them from the side or from behind and to keep the corners protected. With unit directionality added, wide formations get more disadvantages. If the formation is so thin that you can not just attack the formation from behind, but also the units, the attacker get both bonuses. Unit attack range will have to be fine-tuned for this effect to work. It might be good if at least some units could reach further than one rank in the formation so that you also get a unit directionality bonus when attacking a formation which is two ranks deep.

Formation bonuses

Different types of formations give different modifications to unit properties (attack, defence, move speed etc.). There can be positive and negative modifications and modifications can be directional (see directionality) or general.

Morale

What influences morale?

What happens if morale reaches 0?

Tactical considerations

Stamina

The question is if we actually need stamina in addition to morale because they are similar.

Brainstorming...

Charging

TODO

Potential issues

Fallback

There are some parts of this design that could be removed completely if testing shows that they don't work as expected.

Minimum units for formation and fallback to default formation

Instead of having a minimum requirement for the number of units per formation, we could just have the minimum battalion size that applies to all formations and remove the whole logic about falling back to default formation completely. There would still be some good reasons to make formations larger than the minimum size. Making them larger protects them better against panic mode and forced formation disbanding. We might want to start implementing it this way and see how it works.

Movement in detail

A: Corridor movement

ImageA.png

Goals:

  1. The formation picks the direct path
  2. No units must turn around and walk backwards
  3. The formation movement looks natural

Decisions: Nothing to decide, the expected behaviour is quite obvious.

B: Corridor movement marginally obstructed

ImageB.png

Goals:

  1. Same goals a s with A
  2. The formation moves around the small obstacle (fence) in the middle. Roughly half of the formation should move around the left and half around the right of the fence (when it's in the middle).

Decisions:

  1. Formations are allowed to split up in order to path around small obstacles. They don't require a path for the full formation obstruction.

C1: Too narrow target location (no alternative)

ImageC1.png

Goals:

  1. The formation is allowed to move to the flag, even though there's too little room for the whole formation obstruction.
  2. The formation ends up with more ranks but less wide to fit into the narrow spot

Decisions:

  1. It's allowed to move formations to a target when there's not enough space for the whole formation at the target location.
  2. Different behaviour would be a problem, especially with large formations and unrevealed territory
  3. It doesn't seem too difficult to achieve a reasonable behaviour in the vast majority of cases

C2: Too narrow target location (alternative path)

ImageC2.png

TODO: This is where it gets difficult. Maybe this needs another testcase that elaborates on the behaviour.

  1. Does the formation use the same behaviour as in C1 or does it try to position units outside of the wooden walls too, trying to keep the formation shape?
  2. Different behaviour might be wanted depending on how much distance (real walk distance, not linear distance) units have to cover to reach that spot.
  3. The player might not want units to walk through the narrow gap and take the way on the front if enemy units are there.

D: Partially obstructed paths with alternative

ImageD.png

Goals:

  1. The formation picks the direct path (where the trees are).
  2. Movement looks natural (no units going back and forth for example).

Decisions:

  1. Formations always pick the shortest path, even if it's partially obstructed (all individual units in the formation can pass, but not the formation as a whole) and even if a free (but longer) path is available.
  2. Different behaviour would not be predictable for the player and it would be very hard to implement a reasonable fuzzy logic that covers all the cases well.

E: Dense forests

ImageE.png

Goals:

  1. The formation picks the direct path.
  2. Units pick reasonable paths to get through the forest and keep close together as good as possible. They try to keep the formation shape if possible, otherwise they just try to keep as close together as possible.
  3. Formation movement looks natural.

TODOs:

  1. If formations move through dense forests or similar obstacles and units separate too much, this should have an impact on formation bonuses. Is it enough to use a rule like "if less than x% of the units are in their designated location according to the formation shape, bonuses do not apply"?