Also, do not max walls at any ages, keep them a bit lower as when you move up ages, you can use it to sink extra resources. This makes you save time (looting for walls is a grind) and you will not get attacked. Walls can be built as and when you have resources. But aim for level 8 so as poster above said, food can then be used to up walls.
Level 11 walls are max for Enlightenment. I suggest ya cap them every age so ya don't get attacked so often. Others will say different. In my experiences capped walls have helped me more than when I didn't cap them so go figure ;-]
Working walls while buildings or research is going on is how I cap my walls/gates every level. Just got to have a citizen always free. If you're a good scheduler, walls can be done before your base is ready to age up. Yes, it will effect war weight (see faq). I'm in a group that accepts my strategy, maybe its cause I draw a lot of Industrial and some Global aged attacks during war. Last war I soaked up 4 IA and a GLA and still wasn't flattened (5★).
I recommend getting lvl 8 walls in EA. You can go for 9 if you feel like staying at the end of EA a bit longer. Definitely don't go higher, unless you're unemployed and raiding bases in dominations all day. Btw, capping = maxing out, getting the highest possible.
I have all lvl 8 walls now plus some lvl 9 in the central area but my base is still being defeated regularly.
And it will continue to be as long as you're in EA, regardless of what level your walls are. EA is probably the weakest age for defense, because the power gap between IA and EA is so big, meaning the IA people in multiplayer will wreck your base no matter what. I'm in IA myself, and I will wipe any EA base if the loot is big enough, even if it has full defensive blessings active.
The only solution is to move into IA and get yourself that 4th mortar and some tank depots and anti tank guns. That will stop many people from attacking you. Of course much depends on your base layout too.
I have all lvl 8 walls now plus some lvl 9 in the central area but my base is still being defeated regularly.