TOTAL WAR WIKI

Group Formations documentation

Contents

Group formations

Formations to not delete

First things first, the following formations are referenced in the game code so don’t delete them. Some are the ones that can be selected by the player when a group is made, others are used by the AI in certain battle types:

  • Multiple Selection Drag Out Land
  • Spear Point
  • Crane’s Wing
  • Flying Geese
  • Reclining Dragon
  • War of the Tiger
  • Bark of the Pine Tree
  • Cloud Dragon
  • Flying Bird
  • Double Line Standard
  • Grand Battery
  • Cavalry Heavy Right
  • Cavalry Heavy Left
  • Melee Frontline
  • Artillery Crossfire
  • Siege Approach Column
  • Siege Approach Line
  • Ambush Column
  • War of the sword
  • Bird cloud
  • Three day-old moon
  • Extended snake
  • Boshin Line Astern
  • Boshin Line Abreast
  • Multiple Selection Naval

Editor

I recommend using Notepad++ or a similar xml editor to help more easily spot errors in changes you make.

How formations work

Each formation has a variety of information defined for it. Let’s use the Double Line Standard formation as an example of what makes them up. The formation looks like this:

   <GroupFormation FormationName="Double Line Standard">
       <AiPriority>1.0</AiPriority>
       <AiPurpose>Attack</AiPurpose>
       <AiPurpose>Defend</AiPurpose>
       <AiPurpose>Default_Deployment</AiPurpose>
       <GroupFormationBlock BlockId="0">
           <ContainerAbsolute BlockPriority="3.0" EntityArrangement="Line" InterEntitySpacing="2.0" PositionX="0.0" PositionY="0.0" MaximumEntityThreshold="5">
               <EntityPreference Priority="1.0" EntityDescription="infantry_elite"/>
               <EntityPreference Priority="1.0" EntityDescription="infantry_line"/>
               <EntityPreference Priority="1.0" EntityDescription="infantry_militia"/>
           </ContainerAbsolute>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="1">
           <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="6.0" RelativeBlockId="0" PositionX="-5.0" PositionY="0.0">
               <EntityPreference Priority="1.0" EntityDescription="artillery_fixed"/>
               <EntityPreference Priority="1.0" EntityDescription="artillery_foot"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="2">
           <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="6.0" RelativeBlockId="0" PositionX="5.0" PositionY="0.0">
               <EntityPreference Priority="1.0" EntityDescription="artillery_fixed"/>
               <EntityPreference Priority="1.0" EntityDescription="artillery_foot"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="3">
           <Spanning>
               <SpannedBlockId>0</SpannedBlockId>
               <SpannedBlockId>1</SpannedBlockId>
               <SpannedBlockId>2</SpannedBlockId>
           </Spanning>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="4">
           <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="3" PositionX="-5.0" PositionY="0.0">
               <EntityPreference Priority="1.0" EntityDescription="infantry_light"/>
               <EntityPreference Priority="0.3" EntityDescription="infantry_matchlock"/>
               <EntityPreference Priority="0.3" EntityDescription="infantry_bow"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="5">
           <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="3" PositionX="5.0" PositionY="0.0">
               <EntityPreference Priority="1.0" EntityDescription="infantry_light"/>
               <EntityPreference Priority="0.3" EntityDescription="infantry_matchlock"/>
               <EntityPreference Priority="0.3" EntityDescription="infantry_bow"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="6">
           <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="3" PositionX="0.0" PositionY="-10.0">
               <EntityPreference Priority="0.2" EntityDescription="infantry_sword"/>
               <EntityPreference Priority="0.2" EntityDescription="infantry_spearman"/>
               <EntityPreference Priority="0.2" EntityDescription="infantry_heavy"/>
               <EntityPreference Priority="1.0" EntityDescription="infantry_elite"/>
               <EntityPreference Priority="1.0" EntityDescription="infantry_line"/>
               <EntityPreference Priority="1.0" EntityDescription="infantry_militia"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="7">
           <ContainerRelative BlockPriority="0.86" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="3" PositionX="-5.0" PositionY="-15.0">
               <EntityPreference Priority="1.0" EntityDescription="cavalry_sword"/>
               <EntityPreference Priority="1.0" EntityDescription="cavalry_lancers"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="8">
           <ContainerRelative BlockPriority="0.86" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="3" PositionX="5.0" PositionY="-15.0">
               <EntityPreference Priority="1.0" EntityDescription="cavalry_sword"/>
               <EntityPreference Priority="1.0" EntityDescription="cavalry_lancers"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="9">
           <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="7" PositionX="-5.0" PositionY="0.0">
               <EntityPreference Priority="0.9" EntityDescription="cavalry_missile"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="10">
           <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="8" PositionX="5.0" PositionY="0.0">
               <EntityPreference Priority="0.9" EntityDescription="cavalry_missile"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="11">
           <ContainerRelative BlockPriority="0.9" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="3" PositionX="0.0" PositionY="-10.0">
               <EntityPreference Priority="1.0" EntityDescription="general"/>
           </ContainerRelative>
       </GroupFormationBlock>
       <GroupFormationBlock BlockId="12">
           <ContainerRelative BlockPriority="0.6" EntityArrangement="Line" InterEntitySpacing="2.0" RelativeBlockId="11" PositionX="0.0" PositionY="-10.0">
               <EntityPreference Priority="0.01" EntityDescription="any"/>
           </ContainerRelative>
       </GroupFormationBlock>
   </GroupFormation>

Starting at the top we have this information:

   <AiPriority>1.0</AiPriority>
   <AiPurpose>Attack</AiPurpose>
   <AiPurpose>Defend</AiPurpose>    
   <AiPurpose>Default_Deployment</AiPurpose>

The priority is one number that helps the AI decide which formation to use. You can also use this to create different formations for the player and AI, by giving the ones available to the player an AI priority of 0.0 and the new one for the AI a higher one.

The AIPurpose flags allow you to define whether formations are used by the Ai to attack, defend or both and whether a formation is used for deployment as well.

Whilst not featured in the Double Line Standard formation, there are extra lines that can be added after the AI lines to help the Ai refine its selection.

<MinUnitCategoryPercentage Category ="infantry_ranged" Percentage="35"></MinUnitCategoryPercentage>

There are both Min and MaxUnitCategoryPercentage tags that can be utilised to limit some formations to only being used by armies with x% of the army being made up of a certain category of units.

We now move into the setting up of the layout of the formation, which are made up of blocks. Blocks look like this:

<GroupFormationBlock BlockId="1"> <ContainerRelative BlockPriority="0.83" EntityArrangement="Line" InterEntitySpacing="6.0" RelativeBlockId="0" PositionX="-5.0" PositionY="0.0">

       <EntityPreference Priority="1.0" EntityDescription="artillery_fixed"/>
       <EntityPreference Priority="1.0" EntityDescription="artillery_foot"/>
   </ContainerRelative>

</GroupFormationBlock>

Each block is given a preference; this is used to help the Ai distribute its units amongst the blocks of a formation.

Apart from block 0, all blocks are placed relative to another block (Block 0 is a ContainerAbsolute, all other blocks are ContainerRelative). They are positioned with relative x and y co-ordinates. So for example in the Double Line Standard formation, blocks 0, 1 and 2 are placed as follows:

Group formations.png

The units in a block can be arranged either as a line or a column with the EntityArrangement tag for each block.

Within a block can be listed various lines to define what classes should be placed in that block and the priority for each unit class. The combined priorities of the unit classes in a block, the priorities of the various blocks and the AIPriority for the whole formation go into the decision process for the AI picking what formation to use in battles.

Make sure that in a formation there is at least one block that has an entry for EntityDescription=”any” so that any units not fully accounted for in the other blocks can be placed. If they can’t be the AI will ignore the formation. Remember the AI will not always have a perfect army for most formations so it is important to allow a bit of flexibility.

Several blocks can be grouped together in a spanning block as shown below:

       <GroupFormationBlock BlockId="3">
           <Spanning>
               <SpannedBlockId>0</SpannedBlockId>
               <SpannedBlockId>1</SpannedBlockId>
               <SpannedBlockId>2</SpannedBlockId>
           </Spanning>
       </GroupFormationBlock>


Other blocks can then be positioned relative to that spanning block, which can help organise more complex formations.

Processing the Group Formations

In BOB, click on the Groupformations.pack in working_data and process the file.

Testing formations in the game

An easy way to test a new formation you have added or one you have modified is to set the AIPriority of all other formations to 0.0 (backup the file before you do this!) , load the game and then in custom battles pick an army that should perfectly match your formation. Then when you load into the battle you should see your army laid out as set in your formation.

Troubleshooting

If you have trouble processing the GroupFormations.xml file in BOB or loading the game a few common problems are listed below:

  • Missing brackets, with manual editing this can happen easily and this is where programs like Notepad++ come in handy as they colour the file based on what brackets are in place.
  • Blocks not in number order or numbers missing. Blocks must start at 0 and then in number order.
  • If in game units are being placed on top of each other, it may be that units are not being placed in a block or the blocks are not being set far enough apart with the x and y co-ordinates.
  • Remember, if the Ai does not have a perfect set of units for a formation it may still pick at the best fit, try and make your formation blocks flexible enough that units will not be placed oddly if certain blocks aren’t filled.