After browsing the Civopedia abit I came across across some curious wording in the Wall and Castle entry.
"+50% Defense (Except versus Gunpowder-based units)". So my question is this:
What are gunpowder-based units?
Are they simply all the units in the Gunpowder category from Musketman to Mech. Inf.? Does this mean that siege weapons will continually face a 50% defense from a Wall if they don't bombard first? Even from Cannon up to Mobile Artillery and eventually Air units and Helicopter Units?
My guess would be that Musketman (Gunpowder), Cannon (Siege) and Cuirassier (Mounted) would be the first units of each these three unit categories who can ignore walls and castles. If this is true, then all in the Melee category, Archery category, Catapult, Trebuchet and Knight are the only units affected by walls and castles.
If this is true, then it would actually pay off to build walls and castles in border cities before they're obsolete, even against an ally, you never know if he'll stand between you and winning in the late game.
The threads I found while searching didn't quite give me a clear answer, but here is the best one for reference:
Obsolescence and City Defense. The other threads about walls and castles did not go into their classification or obsoletion.