Attack management

I have an alternative idea for managing attacks. In a nutshell:

  • Do not attack during Treaty.

  • Do not attack in Age1.

  • If booming, do not attack in Age2.

  • Do not initiate any new attack if:

    • our own base is under attack
    • we’re defending monopoly
    • we’re defending the King’s Hill
  • The minimum number of units required before we can consider them as one army is as follows:

    • Age2: 20
    • Age3: 30
    • Age4: 40
    • Age5: 50
    • In other words: minimum_size = 10 + 10 × (age - 1)
  • Do not initiate any new attack until we have an army.

  • Initiate a new attack every time we have an inactive army — i.e. an army that is currently sitting in the base doing nothing. Target location is chosen this way:

    • find the most populated zone on the map by scoring it:
      • the size of each zone is roughly the same as the zone covered by the Town Center’s LOS in Age1 (i.e. a “circle” of 40m radius)
      • +2 pts per enemy villager in the zone
      • +2 pts per enemy military unit in the zone
      • +1 pt per enemy building in the zone

The code is for a legacy mod but it should be super easy to port into DE. It’s quite effective versus other bots, particularly due to the fact that the biggest majority of these bots use a timer for initiating new attacks. In other words, they “wait for time”, whereas my bot “waits for armies” — it starts a new attack every time it has enough units. But I’m pretty sure you people will find a way to break it (naturally, humans being far superior than a rigid set of rules). I think the biggest weakness is that it sends the entirety of its soldiers to attack and doesn’t leave some defenders behind. I hope you people will comment to give me some inspiration.

PS: I find that DE’s AI is already very good apart from a few minor bugs (like zigzagging sheeps and villagers not gathering sheep meat).