Simulated Logistics, Procedural Stories, and a Naive Approach

May 6, 2017 | Posted in Development | View comments

The Baggage Train, by Albrecht Altdorfer

In Simulating Medieval Logistics we looked at a system for keeping armies well-supplied. By searching through a set of supply opportunities (i.e., actions which provide supplies), the army's supply-over-time could be kept in an optimal range. The Amaranth Saga will consist of thousands of simulated characters, and needs a system like this to ensure they are adequately fed.

But... why?

Before we proceed, you might ask why logistics need to be simulated at all.

Since The Amaranth Saga is aimed at creating stories, everything in it must ultimately achieve this end. Historical events are frequently driven by wealth, greed, plunder and starvation... so they must have a presence in the game. However, we need to ask, is a detailed simulation the right approach?

1. Philosophy

The Amaranth Saga's underlying philosophy is that you can't procedurally generate good stories if things are kept abstract. We could roll a die every month to decide whether an army was well-supplied or not. And we'd get a story something like this:

In early summer of 840, King Ceres marched with his army. In mid summer, the army was low on supplies. By late summer, the army was starving. By mid autumn, supplies were once again low. By late autumn, the army was well supplied. In early winter, supplies were running low. By late winter, the army was starving. By early spring, the army was well supplied...

Such a story is clearly random and meaningless. An exaggerated example perhaps, but you get the point. The starvation of an army only has meaning if it can be explained by something a bit more alive than just "The random numbers were 2, 1, 1, 2, 3, 2, 2, 1, 3". Thus, we have an interest in simulating logistics.

2. Consistency

We could keep logistics simple (i.e., ignore them), as most strategy games do. Each person could have an amount of wealth, used to keep themselves fed. People leading armies would also spend that wealth on keeping the armies supplied. This could still create interesting stories, with room for further complications (like varying the cost of food in different regions). In the end, The Amaranth Saga might take this approach.

The main issue with tracking people's wealth, but not where they're keeping it, is that its unrealistic. In a game which simulates people individually, it would be strange for, say, a king behind enemy lines to feed troops with supplies from their distant capital. We might differentiate between wealth 'carried' and wealth 'owned', with people forced to pick up their wealth from friendly settlements, but this would still be a little weird.

Of course, keeping the game feasible is more important than keeping it realistic... so if we do simulate logistics, we have to try and keep them simple.

El Saco de Roma, by Francisco Javier Amérigo y Aparici

So, why not?

Consider how a medieval army might obtain food:

  1. Foraging and pillage
  2. Carried rations
  3. Food purchased from merchants following the army
  4. Supplies delivered via supply chains
  5. Supplies captured from enemy forces

Clearly, supplying an army is pretty complicated. And doing it just by looking at a set of 'supply opportunities' has some problems...

Time and Space

The supplies an army can access are dependant on its location. Since armies move, this makes searching through a set of supply opportunities extremely complex. A system responsible for managing armies' supplies must consider where they will be at any given time.

One solution is to ignore movement as much as possible. Rather than optimise supplies delivered to a (moving) army, we can optimise supplies delivered to a stationary stockpile. The army must then remain close to the stockpile to access supplies. When the army moves a great distance, we can establish multiple stockpiles along the way, and only focus on them.

Performance

We also have hardware limitations. In a simulation with thousands of agents (i.e., people), with each one tracking supply opportunities, the simulation may run very slowly.

Optimistically, a few wars would involve several commanders, each with several subordinates leading smaller groups of soldiers. Even if the soldiers simply trust their leaders to provide food, that's still dozens of people independently tracking supplies. And if they can all think of a few dozen ways to get food, there could be thousands of supply opportunities being searched through at any given time.

It's hard to guess what the game's performance will be like before we actually build it, but this is definitely a risk.

Allocation

Finally, we need to avoid different people counting on using the same supplies. A queen directing a military campaign will want to allocate resources to her generals without any overlaps. She'll need to communicate her intentions to the generals. If circumstances change (perhaps the enemy pillages supplies), the generals must improvise accordingly. And so on.

There are techniques to avoid over-allocating supplies, but they increase the complexity of the simulation. Combined with several smaller issues (which I won't discuss here), simulating medieval logistics risks blowing out and never getting finished.

Next steps

I think we need a simpler way to manage army supply (and supply in general). The final solution must be simple for several reasons:

  • The game actually needs to get finished.
  • The simulation must be simple enough for players to interact with it. Everything the AI does, players must be able to do as well.
  • Simple solutions tend to more closely resemble the real world.

In a later post, we'll look at a better approach (most likely the final approach), and some key insights which make it possible.