Lemme just start with a screenshot from my latest battle, with Perthia.
Yeeeah. Basically, I killed em. Well, I did have their training maxed out. And weapons. These were my prize fighters, my elite guys. I used them to show how awesome these can be. Basically, formations are key. There is is. Creepy, no? I know it's obvious, but Phallanxes are weak at the rear. Meaning, cover your ass. One cavalry charge can ruin the entire battle. So, there's a bunch of formations to do. Mainly, cover yourself. This on I'm using because I wanted more concentration at the back. So I angled them foreward, and streched the rear rank. This formation is surprisingly easy to move, too. Now, for defending. I have one screenshot that kinda sums it all up. Bracing the gate. Have them on semi circle ranks, and if they attack a wall, remove the outermost rank to support it. And then the one after that and so on. Having dudes on the walls helps. Then there's this: Standard. Hannibal used something simliar to this. And it worked for him. Works here, too. Hope this is helpful. I doubt it, but maybe someone will get something out of it. Had fun writing it :P
I'm sure there have been a million topics on this, but I just want to add my own to the mix.
(Note I'm running Rome: Total Realism. I plan on removing it soon, but It's a good mod, highly reccomend it)
Here's a better angle:
However, for those looking for a weakness? Cavalry charge the corners. They're the Achilles Heel. Also, if any of them rout, or if ANYONE gets inside the formation, the jig is up. Game over.