At the beginning of the battle, some of Cao Cao's forces have infiltrated the castle, so go around and defeat the officers inside. There are a few in the first room, as well as some in the second. While likely fighting the second set of officers, you'll get a prompt to start the boulder device by defeating the officers in the southwestern chamber. Do that and boulders will begin dropping from giant dragon statues on one of the paths.
The next big event will split up Liu Bei's forces into three. Zhang Fei will go after the units beginning to build some catapults to destroy the boulder devices, while reinforcements will come from the north (Liu Bei will go after this) and west (Guan Yu will go after this). If you manage to stop all three events, then Cao Cao's troops on the frontline will withdraw.
It is at this time that Guo Jia will appear and order a fire unit to attempt to set fire to the castle. There will be two different units that follow the same paths the reinforcements from earlier followed. All you need to do is defeat the officer with the fire units to get rid of them.
If either manage to make it to the castle, then it will be set ablaze and Dian Wei, Cao Ren and Xu Zhu will march towards Liu Bei. If the fire units are defeated before reaching the castle, then only a few of the remaining officers will come after Liu Bei. Either way, defeat the remaining officers and then go after Guo Jia to finish the battle.
There are two Hypothetical situations to fulfill in this battle. Both revolve around the same set of enemies, so an explanation will be given as to which enemies the withdrawing ones are. After clearing out the castle, you should see Yue Jin and reinforcements show up in the southwest. Any officer that shows up as reinforcements here count when the order is given to withdraw.
The easier of the two is to let all of the officers withdraw, which will open up 3-X. Disturbance at Guandu. However, the other one is slightly trickier, as you need to defeat them all only after they have been given the order to withdraw. This is easiest with Zhang Fei, as his job is to defeat Li Dian to stop the catapults, which happens to be the closest to the officers.
The order to withdraw is given when the catapults are stopped, and Guan Yu and Liu Bei defeat the other two units they are given. There will be a total of EIGHT officers you need to kill, which are Yue Jin, Lu Qian, Xiahou En, Xun You, Cheng Yu, Man Chong, Li Quan, and Liu Ye. Make sure you don't take out any of them prior to the withdrawal order. They will retreat to where they first appeared, so run past all of them and defeat them one by one, starting with the closest to the escape point. You know you did it right when you don't see the cutscene at the end of the battle.