Once the cav impact/get near/with your tight formation order your men to charge in melee, this ensures maximum amount of bot bayonets heading for stuck cavalry. It also means that bots will not be stationary targets for the rest of the oncoming cav and will find the closest targets and aim their bayonets at them making ride bys harder. Make sure your men don't disperse to far if you do this. You may have to occasionally call them back to hold position. If your outnumbered by cav however it may not be the greatest idea.