The walls in pre gunpowder age civilizations were developed mostly to prevent rapid overrunning of the defended area, shelter from enemy "fire" and provide high points for observation and to deliver counter fire against invaders.
Curtain walls will also need deep foundations so they don't fall over (and to make them more resistant to mines and battering rams), and given the construction technology of the day, they need to be thick as well (no elegant engineering solutions here). This in itself limits the idea of walled cities to very rich principalities, and even then to the Imperial capital and major trade hubs, since otherwise the resource bill will overwhelm the amount of workers and materials available.
From a technical viewpoint, curtain walls are both stronger and easier to defend when they are supported at regular intervals by towers. The towers provide the effect of buttresses for part of the wall, but also strong points for the defenders, and the ability to fire across the front of the wall to engage enemy engineering troops trying to raise ladders, or move up siege towers and battering rams. Towers also provide artillery platforms for catapults or even small trebuchets, to keep the attackers at a distance (a catapult or trebuchet at ground level must be larger to match the range of an elevated catapult that is shooting at you. Moving large pieces of siege artillery is always an issue, so the attacker will often have to build the machines on the spot, with all the issues that entails).
The spaces between the towers in European castles and walled fortifications had the alternating pattern of stones and open spaces called crenellations, which allowed bowmen and others to have shelter and fire through the open spaces. Overhanging platforms were often built as well to allow soldiers to drop rocks, hot sand, boiling water, sewage or flaming debris on enemy soldiers toiling below.
The real key to fortified cities (or castles or even modern fortifications) is the resource bill for building them, maintaining them and having sufficient manpower to man the walls, extra troops to sally forth and attack the invaders outside the walls when advantageous and enough spare materials and engineering troops inside to repair the walls. Many walled cites and forts were undermined by allowing growing populations to build right outside the walls, giving attackers covered approaches to the walls, and many forts and walled cities were easily overthrown because the walls were in disrepair, or not enough troops were garrisoned inside, or the ones inside had insufficient supplies to last a long siege.
So building the walls is only the first step.