At the start of the battle, some of Gongsun Yuan's forces are targeting your main camp and you need to get rid of them. Defeat the first two and the others will start retreating. Follow them to the west base, where an ambush will be sprung on you from inside the base. Defeat all of the officers, including Wei Yan, who will trigger the capture of the base.
This will make the troops in the base to the east of your position panic, causing them to open the gates. Defeat the officer inside to capture it, then continue east to take on the assault unit. It's likely that the reinforcements will show up just north of the assault unit, so take out all of the officers that appear.
Gongsun Yuan holes himself in his castle, meaning you'll need to find another way inside. Go to the west side of the map and use the ladders to climb up the mountain. Clear the garrison at the top, then make your way down the path and drop into the enemy's main camp. Defeat Gongsun Yuan to finish the battle.