-
Notifications
You must be signed in to change notification settings - Fork 1
Trapping
Our plan for teaching the AI to trap units:
-
Learn how to trap a unit first, using the simple method (an AI unit on either side)Done - Test that with some "toy cases" -- skyfaller: could you give this a shot? Notes:
- This is currently only set up for the NW part of the map
- There is a TOD-dependent criterion for when the AI will try trapping
-
Another CA (attack_leader_threat) might kick in before this one and look like trapping is not working correctly. We'll deal with this later (by making attack_leader_threat attempt trapping also, if possible). There is currently always a message displayed before a trapping attack, so that it is clear when Fred is trying to do this, and when it is doing something else.Taken care of.
- Come up with criteria for when to use this trapping
-
Don't use this trapping method if one of your units trying to trap is a lvl0 unitDone -
Avoid trapping if it is likely to result in the death of one of the trapping unitsDone -
Avoid trapping if it's a skirmisherDone
-
Trapping a unit is good, but not good enough. If the unit is trapped on a village, at least it can't go grab another village while you're holding it there, but it also has to die, the sooner the better. If you trap a unit, you need to send enough units to annihilate it quickly.
If you have to draw off units from your attack in order to kill the trapped unit, you need to call off the attack, rather than making a half-assed attack. If you end up with kills at the end of the night, you've achieved part of your goal with a grunt rush anyway (the other goal is to get a village, b/c orcs love an income advantage, but take what you can get).
Once the AI understands trapping, I would consider leaving the center village open even in the face of a village stealer in range, so long as the AI will be able to trap the unit if it grabs the village. That way the AI has two options, continue with the full grunt rush if there is no village steal in the center, or call off the attack and accept a kill if the village stealer comes in to be trapped. You want to teach the AI to recognize whether it will be able to trap next turn if a village is stolen.
There are other ways to trap a unit besides simply putting a unit on either side of them. For example, you can trap with three units in a roughly triangular formation, and you can use arrangements including lvl0 units, or impassable (or difficult) terrain. Teaching the AI all of these possibilities will take some work. See Rigor's suggestions for coding advanced trapping.