Feb Update: Empires and Revolutions

Empire and Revolution
4 min readFeb 19, 2022

Battalion Orders

If this is my first blog post you’re reading, I’d encourage getting introduced to the game here.

A lot of recent effort has been spent on breaking up the orders that can be delivered to regiments and battalions so that they behave as expected while also allowing for the large groups of units to operate independently of the player or AI. For instance when given maneuver orders to battalions, the AI of the battalion should determine if it needs to cross a choke-point, whether it should change its formation to achieve the new maneuver, or if it should change its direction to face enemy presence while it moves. If there are obstacles in the way of the maneuver, the battalion must navigate around, which can be difficult when a battalion of units can encompass +15 grid squares while navigating.

Ultimately the AI must be smart enough for both player and computer to not have to micromanage large groups of units. As a commander of a battlefield you want to be able to give approximate orders to units and let the AI resolve the best way to achieve the order. Of course the game will still allow for micro-managing individual units when so desired.

Battalions receiving new line formation orders
Battalions receiving new maneuver orders

Bridge Crossings

Any fan of the total war series can attest that one of the greatest weaknesses of the enemy AI was when crossing bridges. Now that I’m working on AI routines its obvious why this would be the case. Bridges are a difficult choke-point to handle logically, especially for a battalion of ~1000 units. What happens if the crossing order is cancelled halfway through crossing? What if there are enemy units across the water? How do we prevent mob traffic from forming on the bridge. How can the AI be prevented from dying needlessly from the player cheesing at choke-points? Here’s the main solutions I’ve worked on:

  1. Have reliable AI routines so that large formations / battalions will progressively cross the bridge. Cancelling a bridge crossing while mid-crossing should result in predictable behavior from the AI
  2. Make sure the computer can recognize correctly that a choke-point is contested or under threat by enemy forces
  3. Make sure the AI always uses ranged units / overwhelming artillery support close to the choke-point if the above situation occurs
  4. Allow for engineer units that can clear/construct new pontoon bridges to prevent camping of existing bridges
Player cheesing AI 101: Make a 180 circle around the bridge exit point for the AI to run into.
In the most recent Total War they have given up on bridge AI by simply producing impossibly large bridges for their maps. Its a bit of a cop-out but I can understand the decision
Battalions marching across bridge choke-points will march one company at a time across each bridge to prevent traffic jam but also to allow companies to support the crossing companies in the event of a contested crossing.
Battalions marching across bridge choke-points will march one company at a time across each bridge to prevent traffic jam but also to allow companies to support the crossing companies in the event of a contested crossing.

Grid Gradients

Threat gradients can be recalculated every simulation step on a separate compute thread. When the enemy AI wants to draw new line formations or direct its forces, it can use the gradient (otherwise known as influence mapping) to reform its lines to face the enemy properly.

Red-to-yellow threat gradients allow for the AI to quickly determine which directions to face enemy based on the threat gradient, as well as to quickly calculate line formations that will conform to the enemy

Along with influence maps the plan is for the AI to use utility calculations to make decisions regarding whether to advance, retreat, or hold ground. Utility tables can be simple to debug and track but they also require a lot of code and testing of the parameters. For instance a regiments decision on whether to advance towards the enemy can be as follows:

AI forces are concentrated in strength: +100 to advance.
AI battalions are low in morale: -80 to advance
Enemy has higher artillery presence in area: +50 to advance
Enemy is entrenched: -80 to advance
Friendly forces are already advancing: +40 to advance

These conditions summed together can then be used to determine whether to maintain the advance order. While it is easy to debug the decisions the AI makes using this model, it requires a lot of code to setup each condition.

--

--