Defensive buildings protect the town from raiders and pirates. Only a Lord Mayor can build these structures directly, everyone else can only encourage it. The construction is paid for from the town coffers, if you have the materials in your warehouse you will receive their worth in gold when you build fortifications.
Councillors and Patricians can propose an enlargement of Town Walls in any city where they have that rank, while an Alderman can propose it in all cities.
Construction of other fortifications can only be encouraged by constantly supplying the town with a lot of Bricks, Timber and Iron Goods.
The wall protects all buildings, preventing the destruction of workshops during a siege.
They can be expanded if the Town Council allows it (you can propose such an offer in the Town Hall). Housing and city buildings can only be built inside the wall, so the Town Walls should be enlarged as soon as possible. There can be two expansions, Level 2 and Level 3.
Pitch Shoot pours hot pitch onto the attackers during a siege, killing some of them in the process. The town must have enough pitch in stock for it to work. The construction is instantaneous, you just need to have the materials:
Iron Goods 5
Gate Bombard and Gate Cannon
Each town gate can be protected by two cannon towers. The towers attract the incoming fire from enemy trebuchets during a siege, which would quickly kill the ranged units that man the walls. One bombard should always be constructed at every gate.
A second tower should be built only on a Level 3 wall, it is not required earlier. Gate Cannon is an improvement of the Bombard (it can take much more damage, and does a bit more damage itself), and should be built before ordering the second tower.
Port Bombard and Port Cannon
Each port can be defended from pirate attacks by three cannon towers (and possibly by an outrigger convoy). These towers pose a very significant threat to any pirate that may attempt to plunder the town coffers. If there are no port defenses when it happens, the town coffers (and market warehouses) will be looted automatically. A town can only be looted when all the towers are destroyed. Port defenses also contribute to the citizens' morale.
Pirates do not attack towns very often, but there should always be at least two towers. Cannon upgrade is a significant improvement of the bombard (which is rather weak), it can take an enormous amount of fire before it is destroyed.