We all know it's very difficult to get it balanced with the exact same number of Roman infantry and allied infantry, and then fit all the other units in around them with the 20 unit limit... 2 units of hastati in your front line means you'll have to have 2 units of allied infantry next to them, and then 2 next to your 2 units of principes in the next line, but a front line of 4 units is just too short. You can't have 3 units of hastati and 3 allied because the Romans need to go in the middle so you're going to have 1 unit too many allied soldiers on either flank... But 4 units of hastati and 4 allied is too much, because your front and second line would take up 16 unit slots and that doesn't leave room for the rest of the legions units, so the only option you have really if you want to be realistic is 2 units of Romans in each line and 2 allied, but like i say the line is way too short and i know the Romans used a rather long battle line.

So anyway my suggestion. For example, if we play on large unit sizes, there are 80 men to a unit of hastati, so if we have a front line of 4 hastati, which is long enough for a legion, then there would be 320 Romans in the front line. So we need 320 allies now, but 4 units is too much since it takes up too much of the slots, so my suggestion is simple... Make the number of men in whatever allied infantry unit you are putting in the game double the number of a unit of hastati... So 160 men. That way you put one on each flank, you have the same number of allied troops as you have Romans, and still enough space to fit all the other units into your legion.

Another suggestion about the triarii... If we had a front line of 6 units, 4 of them being Roman, then we need half the number of triarii on the 3rd line, so 2 units of triarii. But you have to either put them side by side or space them out one at either side of the line, and i don't think this is how it should be, they should be as long as the battle line itself, so increase the number of triarii slightly also so that we can make the last line as long as the rest without spreading them so thin that they are uneffective.