I've had good success lining up a few good units about even with the spot where the building of the settlement begin so that they completely block the road through town. If necessary to make them fit, park them just on the wall side of the buildings. This leaves the fairly wide road along the wall as a clear lane for 2 cav units that I arrange one on each side. As the enemy infantry pours in they should engage the heavies directly in front of them. Once they are committed, I charge my heavy cavalry in from the the flanks. Being charged on two fronts at once while already engaged on a third tends to shred whatever unit(s) it is that came in the gate in an awful hurry. If need be, reset the cav units and repeat.
Bookmarks