In campaign mode you have to use generals to kill the enemy soldiers to get experience, or in empire mode you have to use generals to finish the tasks. Even if you fail a task in campaign mode, experience points are still awarded for killing opponents.