s.bernbaum
Mostly lurking
The defense percentage comes from the culture in the city. Walls and castles act as a multiplier for the percentage and reduce the effect of attacking siege. Siege is needed to reduce (and eliminate) the defense percentage bonus, no matter what type of actual attack units you are using. Also, for some strange reason, the game developers decided that walls and castles become ineffective not when the attacker is using gunpowder units but oddly when the defender has discovered gunpowder.