In [2]:
import math
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

Combat

In the COE4 manual we find a pretty nice description on how semi-large scale battles are resolved.

  1. Remove cloud effects from the battlefield.
  2. Move all units
  3. Move fast units
  4. Check for fear effects
  5. Determine attacks and set initiative
  6. Magic wands
  7. Perform attacks in initiative order
  8. Apply persistent effects
  9. Apply battlefield effects
  10. Check if battle is over

There's still some open questions:

  • How are units placed on the battlefield?
  • How is movement determined?
  • Do we limit the size of armies?
  • If not, how do we deal with oversize armies?

Placing units

Battlefields are rectangular and we need to place units on both sides of the field. This is not that hard but things get more complicated when we want to involve defensive structures.

We start with the restriction that only units from the middle or back ranks can take up a position on a defensive structure. Also, we assume that the available positions depend on the type of battle field. It seems then that we only need a a rectangular array of tiles with each tile specifying what kind of ranks may be placed there. However, in the back of our minds we consider the possibility that we might want to override some of these assumptions in special scenarios.

Moving units

For unit movement we can use a reasonably simple algorithm:

  1. Find the nearest enemy unit
  2. Move a step in that direction

We can expect that we need some kind of pathfinding if we want to involve battlefield structures and/or obstacles. Different units might use different pathfinding strategies.

If we want to support amphibic creatures we need to encode the water tiels in the battlefield map information. Or we might want to restrict movement on general abilities.


In [ ]: