It's been on my to-do list for some time to develop some method for fleshing out settlements in my D&D games:
I had become aware at this point that my settlements need some work. They are usually something of an afterthought for me - a place for the party to sleep, gather rumors, recruit NPCs, shop, acquire services, and the like. Aside from the local ruler and nearby quest hooks, they don't have much character. I've decided to try to devote more time to fleshing them out with more details.
I don't particularly care what the local inns are called or what the blacksmith's name is, but it would be nice to know a factoid or two about local history, landmarks, important NPCs, and potential quests to be had in the settlement itself. I'm not entirely sure how I intend to flesh all that out and make it gameable (how many adventure sights should be in a village? a town? a city?), but it's something I'm definitely thinking about.
I don't know that I'm necessarily any closer to figuring it out definitively, but I figured I'd just start writing about it and see where the blogging process takes me.
It's worth nothing that there is a fantastic post on urban gameplay over at A Knight at the Opera which not only has an excellent and comprehensive bibliography but also a summary of the prevailing attitudes and approaches towards urban gameplay in the hobby. Dwiz's thoughts about urban gameplay, why it's daunting to prepare for and run, why it's important to include in a fantasy roleplaying game, and critiques of common approaches are similar to my opinions on the subject.
I will try to make this post unique and complimentary, rather than regurgitating the very good and thorough work Dwiz has already done.
The Purpose of the Settlement
What is the gameplay purpose of a settlement in D&D? The above quote from one of my previous play report addresses how I was thinking about the settlement at the time: a place for the party to recover and resupply (by resting and regaining hit points, but also purchasing equipment or recruiting NPC hirelings and henchmen), obtain services (like getting an NPC to cast identify on the magic item they found, or having their recently-acquired ankheg shells made into armor), and gather rumors (which provide gameable information about the region and broader setting, particularly calls to adventure).
That's a good amount of things, but the settlement serves so many other purposes. The most obvious purposes are tied directly to adventuring, which is the core element of the game - obtaining and completing quests (the former is often a result of gathering rumors, but can also result from being proactively recruited by NPCs, in which case a return to the settlement may be needed to cash in on the reward, if any) and offloading acquired loot.
And the settlement not only points the players towards adventure elsewhere, but can itself be an adventure location. That adventure might involve ridding an abandoned house in the village of a restless spirit, dealing with doppelgängers who have replaced the town's most esteemed family, bumbling through a secret door in an alley and into a lich's tomb, or confronting the cabal of vampires which pulls the city-state's strings of power.
Settlements are also a place where players can engage in a different timescale of play - downtime activities. They might spend weeks carousing and gambling, gathering information about their next adventure at the local archives, devising new spells and magic items, brewing potions, planning heists, and bribing or romancing NPCs.
Xanathar's Guide to Everything has rules for downtime in 5e which are more robust than those initially presented in the DMG, offering a range of complications that might occur for each activity the players pursue. These in turn can spur further adventures involving new allies and adversaries. (Unfortunately, because of the speed of natural healing in 5e - i.e., instant - player characters rarely if ever need to spend extended periods of time in a settlement between adventures, instead doing so only if the downtime activity itself is some sort of means to an end.)
As the players make contacts of the settlement's NPCs and become entangled in its politics and schemes, they may eventually want to plant roots there themselves. They may want to build their own estates, gambling dens, libraries, alchemical labs, temples, guildhalls, taverns, inns, and whatnot. The settlement has always been intended to be the first* "home base" for player characters - filled with recurring NPCs, intrigue, and property and businesses for them to own.
(*In OD&D, the intention was for player characters to eventually establish a more permanent home base by claiming unsettled wilderness and building their strongholds, temples, and the like there, but I don't see much reason why they couldn't do the same in a settlement - albeit with more hoops to jump through.)
If the settlement is only a place to recover and resupply between adventures, it makes plenty of sense to spend very little time thinking about it or playing in it. But, as I've hopefully demonstrated, the settlement can and probably should be a lot more - which means a lot more time and consideration needs to be put into it.
Where are the Settlements?
The first problem I'm confronted with when preparing settlements for a D&D game is where exactly to put them.
I almost exclusively run my campaigns as sandboxes in a large region represented by a hex map. It's not a "hexcrawl" per se, because I present the players with a map of the region with known locations included - the lay of the land is known from the outset, as are the locations of adventure sites, and I'm transparent with the players about the fastest way to travel from A to B. Wilderness exploration is not focused on gradually uncovering the "fog of war" so to speak, but on traveling from one known location to another, with the occasional unexpected encounter or discovery along the way. The characters are assumed to be somewhat familiar with the area, because at least one of them is usually from there, which means they should know approximately where the population centers are.
I start my campaign prep by using a modified version of Welsh Piper's Hex-Based Campaign Design to create a map of the region. I like to be surprised by what the area of play looks like, so this randomized method works for me. I try to use common sense to keep it from looking too bizarre. Once I have the map, I have to decide how to place the settlements (among other things).
I could just place the settlements where it makes sense for them to be - cities are mostly on the coast and adjacent to rivers, with some being inland to serve as trade nexuses or capitals for other forms of industry. They're surrounded by a ring of villages and towns which support the city. The towns are in turn surrounded by villages which support them, and the villages are surrounded by hamlets and thorps which support them. There's plenty of information online about why cities are where they are. I've played a lot of Civilization - I've got a pretty good idea as to where is the best hex to plant a city.
But something about that is just kind of...boring to me. I'll never end up with a city like Tenochtitlan, built on a marshy island in the middle of Lake Texcoco, with great causeways connecting the sprawling city center to the lake shores. Tenochtitlan wasn't there because it was an good place to build a city, but quite the opposite - the Mexica were more or less exiled there for being bad neighbors who angered the local powers. Tenochtitlan only developed into the urban center that it was as the Mexica rose to power in the region by conquering the surrounding people, who had much better land.
Likewise, if I simply place settlements where it makes sense for them to be, I'll never end up with a city in the middle of an arcane wasteland, its hinterland sucked of all vegetal life by the hubris of its sorcerous rulers and their defiling magic. I'll never end up with the seat of a lizardfolk empire in a vast and intractable swamp. I could decide to deliberately include those things, but if there's one thing I hate doing when preparing a campaign setting, it's deciding things.
As a DM, I'm deciding things all the time. I got back into running D&D around 2018. I've been deciding things continuously for like six years. It's exhausting.
The opposite of deciding things is rolling dice and letting them decide for me (or at least letting them do their damnedest to convince me).
One method of letting the dice decide is presented in the AD&D DMG, where the DM rolls on each hex to determine inhabitation (including castles and ruins). This allows for an 11% chance of a settlement being present in each hex, with a 1% chance for a city to be present. That doesn't sound like a lot, but my regional maps are usually 37x37, which is 1,369 hexes, meaning approximately 150 settlements and 13 cities. That is far more than I care to detail, especially considering that I'm trying to give these locations their due.
Instead, I again prefer a modified version of Welsh Piper's Hex-Based Campaign Design. Part 2 of the process details placing major and minor locations on the map generated in Part 1. There can only be one major location in each "atlas hex" (a 5x5 hex superimposed on top of the smaller hexes), whether there is major location at all is determined by dicing against the hex's terrain, and the location has only a 1-in-6 chance of being a settlement.
This method usually leaves me with around two cities and one city-state/metropolis per area of play, which is a very manageable number while still allowing for some variety of places to explore and engage in urban adventure.
The random placement of settlements doesn't necessarily make sense, but that's a feature, not a bug. D&D is a fantastic game - settlements might exist in odd places because of the magical nature of the world and its inhabitants. Dwarves, elves, halflings, goblinoids, kobolds, orcs, and the like live in different places than humans. Cities can sustain themselves in unusual places thanks to magic, and they might be built in those places because their location allows the inhabitants to take advantage of some magical resource, like ancient technology or ley lines.
There could be some version of this procedure where, after making the regional map, I stock it with "resources" like food, livestock, stone, and luxury and trade goods, then place the cities in resource-rich locations a la Civilization, but I don't think it's worth it to do all that work when I could just roll on a table to determine if a settlement is known for its thoroughbred horses, its marble quarries, or its gold mines (even that much, I think, is pretty much unnecessary for gameplay purposes).
Types of Settlements
Another benefit of Welsh Piper's method is that it breaks settlements down into three types: towns, cities, and city-states - I add villages (or more accurately, probably, small towns) to the list so that I have four "tiers" of settlements corresponding to 5e's tiers of play (my modified method treats a "major" settlement as being a city or city-state, and a "minor" settlement as being a village or town). I think this is a lot neater than Gygax's nitty-gritty distinction between single dwellings, thorps, hamlets, and villages. I also like having the distinction between small cities and sprawling, anachronistic, fantastical cosmopolitan metropolises.
Using a combination of the 1e DMG and the 5e DMG, I have the following table for a settlement's population:
Village: 2d3+4 x 100 (600 to 1,000)
Town: 2d3 x 1000 (2,000 to 6,000)
City: 6d4+1 x 1000 (7,000 to 25,000)
City-State: 1d4+2 x 10,000 (30,000 to 60,000)
These numbers are simply to find some sort of sweet spot between what Gygax originally wrote in the AD&D DMG and how the designers of modern D&D see the game today. I have no idea (or care to determine) whether the numbers are "realistic" or "make sense".
One could certainly build their setting using historical medieval demographics, but this seems like a tedious slog to me, involving calculating hectares of arable land and dividing numbers and squaring them and whatnot. Besides, D&D is not medieval and never was. I'm just trying to play a fun fantasy game, not recreate the idea of France but with goblins. Just as dungeons are the mythic underworld and the wilderness is the mythic wilderness, cities should be mythic too.
Anyway, now I know a settlement's approximate population. What is the point of determining that?
Fantastic Demographics
My general rule is this: 1-in-100 people have class levels. Of that 1-in-100, 65% are Tier 1 (levels 1-4), 20% are Tier 2 (levels 5-10), 10% are Tier 3 (levels 11-16), and 5% are Tier 4 (level 17+). This works for 5e, where tiers of play are made explicit, but I use a different breakdown when playing something like AD&D.
This ensures that not only are player characters "special", but also that they aren't the most special. It's not just dressing for the setting, or an attempt at simulation - it has gameplay implications. This number of leveled NPCs in the setting allows for there to be replacement player characters, allied and rival adventuring parties, knowledgeable wizards to serve as mentors, devout clerics to raise the party's dead before they have ready access to such magic, immortal archdruids and their weirdly specific hierarchies and ranked battles for advancement, and master thieves sending the party's rogue out on heists.
Using this rule, villages will on average have 7 NPCs with class levels, with at least one of Tier 2 and a chance of one or two of Tier 3 or 4 in rare and very rare cases. The average town will have 26 such NPCs, with at least one of Tier 4. The average city will have 160 leveled NPCs with at least 8 of Tier 4. The average city-state will have 450 leveled NPCs with a whopping 22 to 23 or so of Tier 4.
Okay...so what use is any of that? I could exhaustively detail all of these NPCs, but it should be apparent that at the city, city-state, and even town levels this is not really practical. Instead, I tend to focus on the exceptional leveled NPCs in each settlement.
Villages are assumed to have a handful of Tier 1 NPCs, so I only detail those of higher level than that (on average, 2 NPCs). Towns are assumed to have Tier 1 and 2 NPCs, so I only detail those or Tier 3 and 4 (on average, 4 NPCs), and so on. I wouldn't detail all 8 to 23 Tier 4 NPCs in a city or city-state, but assuming an even distribution of those NPCs from levels 17 to 20, I know that there are 2 to 6 NPCs of level 20 in such a settlement. Those might be leaders of regional factions, and similar NPCs found in the smaller settlements in the region might then be their agents, lieutenants, and the like.
The exceptional NPCs in each settlement might be the rulers of the place (because D&D implied setting is a levelocracy), or else provide local color. A village which is home to a Tier 2 fighter, wizard, cleric, or rogue would probably feature a prominent stronghold, mage's tower, temple, or criminal operation which is either a landmark that stands out to the player characters upon their arrival there, or otherwise influences events and drives adventure in the settlement.
By comparison, a city-state might have whole neighborhoods dedicated to the needs of its powerful NPCs. There could be a district which houses the wizarding academy, with streets lined by spell component shops, crowded with familiars, constructs, and summoned extraplanar creatures who do their masters' bidding, all in the shadow of soaring wizards' towers. Another district might house the many temples run by powerful clerics. Another might be a seedy slum run by local thieves' guild bosses who are eternally at war. An entertainment district might house the bard college, amphitheaters, and coliseum. A lush garden might be the "stronghold" of the urban arch-druid. I find it far more gameable to flavor the settlement this way than to determine a handful of mundane industries like masonry or textiles, which the players rarely ever do anything with.
This information also suggests what sorts of problems the locals are able to deal with on their own, as well as when they would need outside help. The village might have problems with the minor fey of the fields and woods, or with griffons stalking their horses, or skeletons stirring in the barrow-mound over the hill, but there are leveled NPCs in the village who can deal with that. That's not to say that the villagers won't turn to the player characters for help, but that the player characters might then be able to encounter allies or rival adventurers while dealing with those problems.
The 10th-level wizard might be able to handle the pig-stealing kobolds with a flick of the wrist, but that wizard is preoccupied with larger concerns, like the young dragon that's started nesting in the nearby swamp. The wizard can't handle that issue on their own, so they would need to send for help from a nearby town or city.
Similarly, while individuals within a city-state might still be preyed upon by puddings from the sewers, they don't pose any threat of overrunning the place. A portal to Orcus's realm in the Abyss, spewing undead demons into the undercity, is another matter entirely.
Magical Goods and Services
The type of settlement and its NPCs also tell me what sorts of services are available in the settlement: 1st- and 2nd-level spells in a village, 3rd-, 4th-, and 5th-level spells in a town, 6th-, 7th-, and 8th-level spells in a city, and 9th-level spells in a city-state. The occasional exceptional NPC in a settlement can provide additional services, which is why it's important to determine who exactly those NPCs are (a Tier 2 fighter in the village provides different services than a Tier 2 wizard, cleric, or rogue) - and what the players might have to do to befriend them.
This approach is somewhat validated by the 2024 PHB, which lists what spellcasting services are available in which type of settlement:
Spellcasting Services
Spell Level Availability
Cantrip Village, town, or city
1 Village, town, or city
2 Village, town, or city
3 Town or city only
4–5 Town or city only
6–8 City only
9 City only
This aligns eerily closely with my own system, aside from the fact that I distinguish between cities and city-states.
I extrapolate this further with regards to the buying and selling of magic items (which I allow not because it's my preference, but because my players feel very strongly about being able to do it). Since 5e again helpfully breaks magic items down into "tiers" based on rarity, I allow common magic items to be bought and sold in villages, uncommon items in towns, rare items in cities, and very rare items in city-states. Legendary items and artifacts are of course the things that adventures are made of.
Exceptional NPCs might have additional magic items to sell, but these will probably be limited to the extent that the player characters will have to befriend that specific NPC, and by the fact that the NPC will likely only sell items which they cannot use themselves or which they can reproduce (potions, scrolls, etc.).
The types of items the player characters can buy in the settlement (and the type of settlement) also determine some of the settlement's locations and NPCs. In a village, potions might be sold by an otherwise mundane herbalist or disgraced alchemist. Scrolls might be sold by a hedge wizard. A village might have a blacksmith, but the player characters will need to travel to town to find the blacksmith who forges +1 swords or whatever, whereas a city-state might have an entire district where master smiths churn out such weapons every week.
Lodging
According to this post on Red Ragged Fiend (which also has an interesting and insightful series on worldbuilding which could potentially compete with the Welsh Piper method in terms of stocking a sandbox, but which I personally don't prefer due to how involved it is), "historical data" suggests that "there’s an average of one inn in a settlement for every 2,000 residents." I can't speak to the veracity of that assertion, but it sounds good enough, so let's roll with it.
In keeping with our established population guidelines for each type of settlement, that means that villages never have an inn, the average town has one, the average city has 8, and the average city-state has 22.
The PHB outlines seven types of lifestyle: wretched, squalid, poor, modest, comfortable, wealthy, and aristocratic. The wretched lifestyle costs nothing and suggests that the player character isn't receiving any hospitality at all - they're basically living on the street, which leaves six types of lodging (examples from the PHB text):
- Squalid: A vermin-infested boarding house in the worst part of town
- Poor: A room in a flophouse or in the common room above a tavern
- Modest: A room in a boarding house, inn, or temple in an older part of town
- Comfortable: A private room at a fine inn
- Wealthy: A comfortable suite at a fine inn
- Aristocratic: Rooms in the finest inn
This in turn suggests the following types of inn:
- Vermin-infested boarding houses
- Flophouses and taverns
- Boarding houses, inns, and temples
- Fine inns
- The FINEST inns
Since the average town has one inn, and modest is right in the middle of the seven types of lifestyles, I assume the one inn in the average town is a boarding house or inn (whether or not there's a temple would be determined by whether the town has leveled clerics or maybe paladins among its population).
A city with 8 inns would probably have a relatively even spread of the five types (perhaps one of each plus an additional one of each of the three middle types), and the same could be said of a city-state with 22 inns (roughly four of each type plus two more). This suggests areas of the city segregated by class - the slums or lower city, the middle ward, and the upper city.
Staying in the poorer inns should come with drawbacks, while the richer inns come with benefits. Characters who stay at the poorer inns are susceptible to crime and disease, while those who stay at the richer inns have access to the middle and upper classes - merchants, artisans, nobility, politicians, and high priests. On the other hand, perhaps a character can keep a low profile in a poorer inn, while a character in a richer inn is vulnerable to political machinations and enemies looking to use them for their wealth.
This has implications for the carousing downtime activity. Xanathar's Guide to Everything says that characters can carouse with the upper class only if they have the noble background, have made sufficient contacts, or disguise themselves and use the Deception skill to pass themselves off as foreign nobles. I would say that the character's lifestyle puts a hard limit on who will associate with them, which is a decent way to incentivize players to spend that 10 gp per night on accommodations at the FINEST inns.
The carousing downtime activity also implies the existence of additional locations in the settlement, which is where the carousing actually occurs. It might be in the common rooms of the FINEST inns, but it could just as well occur at a noble's manor (every D&D game needs an Eyes Wide Shut party), a guildhall, or the like.
I wouldn't detail every inn in every settlement in advance, but I would consider where the player characters might find lodging in a village, or detail the one inn in town, or an inn of each type in a city or city-state. I could come up with those details on the fly, but if I always improvise, I'll probably never come up with anything like the Yawning Portal, the Elfsong Tavern, the Overlook Hotel, or any truly fantastic inns - which is what a good D&D game deserves.
Other Downtime Activities
Carousing is not the only downtime activity which implies the existence of a location in the settlement.
If player characters can buy magic items, then there must be a place to do so - an auction house, a magical Walmart, or specialty shops whose artisans imbue their wares with magical power.
Crafting mundane and magical items requires access to facilities with equipment - alchemical laboratories, tanneries, forges, and such.
The crime downtime activity allows the player to target a struggling merchant, a prosperous merchant, a noble, or "one of the richest figures in town", all of whom would presumably have shops, warehouses, homes, vaults, and the like.
Gambling can be done in taverns, but it also implies the existence of dens, gaming halls, and maybe even magi-tech casinos.
Pit fighting might be fighting farm boys in the village, back alley brawling, basement fight clubs, or a Roman coliseum with thousands of spectators.
Relaxation requires only modest living expenses and could be done at a boarding house, inn, or temple, or at a specialty spa, sauna, or bathhouse.
Religious service is done at a religious building dedicated to a deity "whose beliefs and ethos align with the character's", although I don't see why a character can't perform religious services disingenuously in order to ingratiate themselves to the clergy, provided the character has the requisite skills. In a smaller settlement without much choice of such places, this may be the only option.
Research is done at libraries or with the help of a sage. This could be an exiled scholar or hedge wizard in a village or a full-blown university or national college in a city.
Training might take place at a guildhall, with a tutor, or with an appropriately leveled NPC.
Finally, work can occur in many places, depending on the character's skills - whether backbreaking labor in, at, or on the fields, lumber mills, mines, docks, plantations, quarries, or fishing boats, an apprenticeship at a guild or artisan's workshop, or a musician's residency at a tavern or music hall.
It's way too much work to detail all these locations, especially for multiple settlements. It's appropriate to simply keep in mind that these places exist (although probably not everywhere), and determine the specifics once the player characters express an interest in engaging with them.
Player Character Backgrounds
There are a number of player backgrounds that also imply the existence of certain locations and NPCs in a settlement.
Acolytes can receive free healing and lodging at religious sites of the character's deity, as well as support from people of the same faith.
Criminals have access to criminal contacts, including messengers, corrupt officials, and "seedy sailors".
Entertainers can receive free food and lodging in exchange for performing at an inn, tavern, circus, theater, or noble's court, and people in town tend to recognize them. Gladiators gain access to arenas and secret fight clubs.
Folk heroes can receive shelter from commoners.
Guild artisans are members of a guild, with access to a guildhall, which in turn provides access to patrons, allies, hirelings, and politicians, and protection from the law.
Nobles are welcomed by figures in high society.
Sages have access to libraries and information.
Urchins know hidden ways through the city, allowing them to traverse it twice as fast (suggesting that time should be a factor when traveling from one place to another in such environments).
As with downtime activities, not every settlement needs all of these things. There won't always be a temple or local worshipers of the character's deity, and smaller settlements won't always have spies from the criminal's network, or a guildhall, and they will be too small to necessitate the use of the urchin's City Secrets feature. Still, all are worth considering, especially when preparing larger settlements.
Adventure Sites
As I mentioned earlier, a settlement can point the players towards adventure or be the site of adventure itself - and in this case, I'm not talking about carousing, or committing crimes, pit fighting, or any of those things. I'm talking about the rat-infested cellars, the ruins at the bottom of the town's lake, the estate of the richest merchant in the city who is a rakshasa in disguise, and the lair of the Great Old One cult infiltrating the city-state's halls of power.
I know how to stock a dungeon with monsters, traps, tricks, and treasure. I know how to stock a wilderness with strongholds, ruins, and monster lairs. How do I "stock" a settlement - not just with powerful NPCs, inns, libraries, guildhalls, shops, and the like, but with dungeons, and monsters? Places to explore and threats to overcome? I truly don't know of any methods for doing so.
And these aren't things I can make up on the fly. I can't just decide one week that the city-state that the players have been cruising around for several months is suddenly ruled by a vampire lord that needs to be taken down - that needs to be apparent if the player characters spend any significant time in the place at all (and maybe even evident upon their initial arrival). The same goes for a hag disguising itself as the village herbalist, wererats crawling out of the ruins beneath town at night, or a silver dragon leading a crusade against the city's criminal element.
A lot of settlement generators will have a table to roll on to determine "what's going on" or what "the current problem" is, which is a place to start, but I find it unsatisfying that there should only be one big thing happening in a sprawling metropolis. I like the idea of there being one adventure site in any given village - a haunted house or abandoned mill or infested barn, for example - but what about in town or city?
Maybe there's an adventure site per every 1,000 residents (rounded up). That's one in the average village and three in the average town, but 16 in the average city and 45 in the average city-state. That seems like way too much, considering that I'd want these elements to actually impact life in the settlement and so would have to have some idea as to what each entailed.
Maybe there's one adventure site in a village, two in a town, three in a city, and four in a city-state. But that feels too small.
Maybe I should treat adventure sites similarly to powerful NPCs - there might be hundreds of them in a sprawling metropolis, but I only need to detail the exceptional ones - but then that eliminates the possibility of low-level adventures in a big city, because I'm only detailing those of Tier 4 or so.
Maybe I only detail those which the players are likely to engage with - i.e., start with the small-time stuff, then build up as the campaign goes on - but if I don't know what the settlement's most dangerous adversaries are until the players are ready to engage with them, then I can't reason out ahead of time how those more powerful creatures influence the settlement and the larger world.
Districts
This is probably the time to mention that Brave (Dwiz's Knave hack) has a pretty neat system for building settlements. According to that procedure, each settlement has a certain number of districts, industries, defenses, languages, and temples. Then, each district has its own shops, landmarks, factions, NPCs, and taverns.
Detailing each district according to this system ends up being a little much for my purposes. A city has 5 to 6 districts, each with 2 to 3 factions, for 10 to 18 factions in a single city on average. Remember, I'm building about 3 cities for a single campaign, and not really trying to determine ahead of time what or who every shop, tavern, and NPC is.
While Brave's system is more in-depth than I need, I do really like the idea of breaking the city down into districts. A village is basically a single district. A town will have 2 or 3 districts on average. An average city will have 5 or 6 districts. There's nothing equivalent to my city-states in the Brave settlement rules (Dwiz is clear in his post on urban gameplay that he prefers much smaller, more historically accurate medieval settlements in his games), so I had to extrapolate to determine how many districts there should be. I landed on 3d6+1, which is an average of 10 or 11.
Instead of rolling up a list of factions, landmarks, and NPCs in each district, I use districts to break a settlement down into tightly-themed chunks: the port, the slums, the rich people neighborhood, the market, the temple district, the place where all the wizards live, etc.
With themed districts, it's easy to determine where the characters need to go for whatever activity they'd like to do. If they want to talk to the mayor, they have to go to his manor on the hill in the town's center. If they want to shop, they need to go to the market district. If they need to raise an ally from the dead, they need to go to where the temples are. Once I know what a district's theme is, I can figure out who the important factions and NPCs are based on that.
If there are more than three districts, I'll make a hex map with each district represented by a hex to see how they connect (if there are three or fewer districts, I assume they're all connected to each other, so there's no need to map it out). That way, I know what districts the characters need to move through as they run their errands.
Moving through a district is a turn. Doing anything within a district is also a turn. I don't really care how long a turn is or where each building or landmark is in the district relative to the others. If it's important to track exactly how long the party spends in the settlement, I might call a turn 10 minutes. D&D characters are weirdos who do everything together apparently, so I imagine most parties will stick together when running their errands, though it may behoove them to split up if they have a lot to do and are crunched for time somehow.
I'm aspiring to have a random encounter table for each district, which I would roll on every turn, but maybe the AD&D 1e city encounters table is just fine. Creating urban encounter tables is a conversation for another day.
To circle back to my point about adventure sites, I can also give each district a unique problem related to its theme. That problem might then suggest one or more adventure sites in that district. There might be a necromancer raising zombies in the cemeteries of the temple district, giant crocodiles in the sewers beneath the slums, and a colony of mind flayers infiltrating the upper city. Just as the district's theme informs what services, factions, and NPCs are there, it also informs what problems the district experiences, which in turn inform its adventure sites.
A City in Hell
I've been running a 5e game for the past few months. I was originally a player in the game and occasionally ran a short adventure, but when the primary DM ran their last adventure, which ended with the remaining party members being trapped on the wrong side of a portal to Hell, I couldn't resist picking up the reins.
The party is now on their way to visit the region's metropolis, which I decided was once a mortal city that was sold to Hell by its rulers - Descent Into Avernus-type thing, but better because I'm doing it instead of Wizards of the Coast.
I've been using my methods to flesh it out. It has a population of 39,000 mortals, which means about 4 or 5 20th-level NPCs. There are 15 districts and 19 inns of varying quality. Each district has its own theme and a single problem of varying severity. I arranged them all on a hex map so I can see how they all connect. I don't have every single little detail figured out, but I know where the players can find goods and services, high-level NPCs, lodging, and locations related to their backgrounds or to downtime activities. I know where the districts that contain those things are in relation to the rest of the city and how the character need to navigate the city to get to those places.
It's still a work in progress. I'm trying to figure out how many NPCs need to be fleshed out, whether every problem needs a "monster" (whether it be a literal monster or an NPC) at its root, and why the party might travel to each district aside from just passing through. I really want to make an encounter table for each district, but on top of everything else I need to get together, that seems like a tall order.
I can easily see how someone can get totally bogged down when detailing a city, and how a sprawling, anachronistic metropolis could be the setting for an entire campaign.
Conclusion
After all that, I don't know that I'm that much closer to having a foolproof method for generating settlements, but I at least have a pretty good idea of what they're for, and what they need to have in order to serve their multifaceted purposes. I have a method of placing settlements and determining their populations, what powerful NPCs reside in them, what services they can provide, how many neighborhoods they have, and what problems those neighborhoods are facing.
A lot of this is purely dependent on the players and their characters. Their chosen races, backgrounds, and classes will all determine what elements of a settlement need to be fleshed out, as will their in-game desires. Like most prep in a D&D game (especially a sandbox), I don't want to have to figure out every little detail ahead of time - I just need to try to stay one, two, or three steps ahead of the players, and have some idea of what exists in the world on the margins of the game in case the players decide to ask about it or go looking for something.
This is certainly nothing like a definitive guide to settlements in D&D. I'm yet to find anything that is, but I'm always fascinated to read others' opinions on the topic, and I always come away with something new to think about for my own games. Hopefully this post has given someone something new to think about or a new way to approach this kind of gameplay.