The key to a good offense is too understand how the mechanics of defense work. There are 2 various wall defense types 5k and compact the differences being the size of the starting battlefield.
5k defense consists of traps/abatis/treb all these wall fortifications set the range of the starting battlefield to 5k and only takes 1 of any of them too accomplish this.
This is the order in which archers attack against a 5k defense
Ideally you want low layers (20k pike/sword) due too the high range of the battlefield your infantry will go out where your archers can't defend them you can kill over 200k pike with one rainbow against a foe who has 5k defense and high layers.
Surprisingly you don't need much to fend off a rainbow just keep a steady supply of layers coming in. If your hero is much less than your opponent you may want too have more than just 20k. If they are sending multiple rainbows see how much damage the first one does and go from there typically they will never get too your archers as long as you keep all layer types.
One very effective way of utilizing your layers the best is to stash them in your nearby valleys 10k-30k in each valley and just recall them when you need more. another approach is to reinforce yourself every 5-10 Min's with fresh layers. Your enemy can send rainbow after rainbow and will only accomplish killing your sword/pike over and over and never touch your archers. You can do this with as little as 150k archers
The 5k defense is the best online defense in the game but can be picked apart pretty easily if you are offline. This will happen by them clearing your walls basically turning it into compact defense and then send ponies in too wipe you since you have such small layers.
Pros: can defend against rainbows and ponies effectively with minimal casulties
Cons: susceptible to scout bombs and can be easily taken down if you are offline.
Compact defense focuses on high layers and at least 3 to1 warrior archer ratio if not more. I recommend a minimum of 300k archers so the fight only lasts 1 round. The wall setup for a compact defense are pure AT's and a few rolling log if your so inclined. So NO trebs/abatis/trap. On top of the wall setup you also must have bal's and at least 1 pult these two units will increase the range of the battlefield further and is crucial against cavalry otherwise the cavalry will bypass all layers and go straight too archers. I would recommend at least 20k bal's.
This is the order in which archers attack against a compact defense
1. AT's (takes quite a few rainbows to take these down and from what ive seen most ppl dont know how to properly attack a CD)
2. Archers (can also be bal's depends on which of the 2 has a higher value)
3. Bal's (Be sure not too overkill with this unit archers can take them out quick so its better they target archers before bal's)
5. cav/phract/pike/sword/war in that order i believe
Pros: Takes alot too take down before getting to troops. Highly effective against scout bombs. Best offline defense.
Cons: Once AT's drop troops start too dwindle away pretty quickly. If you dont have high layers/bals/pult ponies will rip you too shreds.
So what is the best defense you may ask. I prefer compact defense due to its versatility remember if you are online all you have to do is build 1 trap/abatis and put your layers in valleys and defend against the rainbows as said earlier.(Timing on how you build your trap/abatis is key if you see a phract wave coming Que up 5-10 abatis to finish a few seconds before it hits)
And if you get overwhelmed just be sure all your cities are loaded up on stone and close gates and regroup since your walls are already tore down your not losing much especially if you have tons of stone.
Now you can take this info too help you in combat. Look at the wall fortifications and plan accordingly. The biggest thing I am seeing the most is you don't have to send 100k waves all the time. If your SR is telling you they have 20k pikes then a full rainbow would be a bust. So send in smaller waves till pike are cleared then go to sword etc... just look at what the archers attack first.No point in losing a full rainbow when 10k can do. Ideally just use the defense guide and work backwards to be effective at combat.
Every setup has a way of being taken down. Understanding the order in which units get attacked is a huge edge.