Skip to content
Felucca Online

Docs

Towns

Decision #103. Stage 3 of building the world (docs/world-atlas.md): every settlement of the atlas gets a plan (streets, squares, plots, districts, walls and gates), and its buildings come from the building generator (docs/buildings.md, #101). Plans are computed once, before the bake; the ground painter, the bake and the atlas picture all read the same plans, so the map in the atlas is the town you walk in.

Code: crates/uo-atlas/src/towns.rs. Run:

cargo run --release -p uo-atlas -- --plans-only --out /tmp/towns --town Skartor --town all-fort   # plan sheets, 4 px per tile
cargo run --release -p uo-atlas -- --no-tiles --out /tmp/atlas --bake assets/world/felucca         # bake the world with its towns (≈ 35 s)
UO_SPAWN=7110,6078 cargo run --release -p uo-server -- --world assets/world/felucca               # start in Skartor
cargo run --release -p uo-client -- --server ws://127.0.0.1:7777 --name Me
cargo test --release -p uo-atlas towns                                                             # plans of a whole atlas hold

--town takes a settlement's name, a tier (capital, city, town, village, fort: the first one of it) or all-<tier>, and prints what was built and what is missing.

Laid out for the camera

The camera looks north-west and never turns, so a building shows its south and east faces, and its front door is on one of them (#101). A town is laid out for that, like a planned medieval new town (a bastide):

  • Bands of plots run east–west. Every band fronts south onto its street, so across every street the camera sees the fronts, doors and shop signs. The other side of a street is the back gardens of the band below: tall back walls never hide a street.
  • Cross streets run north–south through the bands at irregular spacing, and some skip a band (T-junctions). The last plot before a cross street may front east onto it (a corner house).
  • The square is the band segment in the middle of the town: the fronts of the band above face it across the main street, and so do the corner buildings on its west side. Its south side gets only low market stalls, so the square stays open to the camera. Its landmark stands in the middle (a fountain, well, statue, shrine, moongate or gallows, by realm and size), with benches, lamps at the corners and a signpost. Capitals and cities have a market square with rows of stalls just south of it.
  • Bands near the middle are deep, for the big houses (temples, manors, inns, guildhalls); bands further out are shallower and denser. The band facing the square is deep enough for a temple.

Districts and what each town must have

Every plot belongs to a district by where it is, and the district decides what is built (weights):

DistrictWhereBuilds
civicthe square's band and the band facing itshops, guildhall, inn, houses, a manor
richa sector of the middle, chosen per townmanors, houses, a guildhall, a tower
gatenear a gate or where a road comes ininns, smithies, warehouses, workshops, barracks, shops
craftby a river or the seaworkshops, smithies, warehouses
commonthe resthouses, shops, cottages, workshops
outerthe edgecottages, houses, farmhouses (unwalled), towers (walled)

Each tier has a list it must have (required), placed first in the middle bands: a capital a temple, a bank, a guildhall, three inns, two barracks, two towers, four manors, two smithies and two warehouses; a city a temple, bank, guildhall, two inns, a smithy, a warehouse, two manors and a tower; a town a temple, an inn, a smithy and shops; a village maybe a smithy and an inn; a fort barracks, a tower and a smithy. Caps keep a town from filling with temples or barracks. A required building that doesn't fit where it was tried waits for another plot, and an ordinary house takes the plot instead.

About 10 % of plots in capitals and up to 20 % in towns and villages stay free for players to build on (#77); they are listed in world.json (plots: town, box, front).

Walls and gates

Walled towns and forts get an octagon: straight walls on the four sides and diagonal walls on the corners (wall_<m>_diag_a/b), stone or fieldstone with crenellations on top (storey 1, wall_<m>_crenel_*) for Karrak and the free cities, a palisade stepping along the diagonals for Aelwyn and the isles. A ring road runs just inside. Where an atlas road reaches the wall a gate opens (three tiles, posts, a torch on each side outside), on the nearest straight side; the road comes in straight through a levelled glacis. A walled town no road reaches still gets a gate on its south side. Unwalled towns get a street from where each road enters, straight in until it meets a street. Atlas roads stop at the town's edge; its streets take over.

Ground

The whole town is level at the height of its centre, blending into the country over 8 tiles. Streets are cobbled in capitals and cities (main streets also in towns), dirt elsewhere; the square is flagstone (a village keeps a green); yards are grass, working yards (smithy, inn, warehouse, workshop, barracks, farmhouse) dirt; cottages and farmhouses keep a vegetable patch of furrows. Forest, scrub and farmland inside the walls are cleared to grass. Brooks (rivers up to 2 tiles wide) run under the town: buildings and streets go over them. Streets ford wider rivers; lakes and the sea stay, and plots never stand on them.

Yards and street props

Behind every building its yard keeps what its trade needs: a smithy logs, ore and a trough; an inn a trough, hay and barrels (a stable yard); a warehouse crates, barrels and sacks; a workshop a sawhorse, boards and logs; barracks training dummies, an archery butte and a weapon rack; a temple a graveyard; a manor a garden with a statue, a bench and flowers; houses flowers, barrels, a bench and sometimes a well. The row against the back of the building stays clear (back doors). Many yards have a fence on the back street (wood, picket, hedge, stone, rope or iron by realm and kind) with a gap. Paved towns have lamp posts along their streets on the gardens' side, and the trades hang a shop sign by their door.

In the baked world

Statics format 2 (uo_world::baked): every record carries its facing, storey, roof flag and an exact height, and each region chunk has a table of the buildings whose pieces it holds. The server and the client build arenas, blocking and line of fire only from ground pieces (Content::ground_objects): upper storeys and roofs are drawn, as Overhead, and hide while the player is inside their building (H cycles the roof view), but movement stays on the ground (task multi-level-movement). world.json lists every building (town, kind, box, door, storeys) and every free plot.

Numbers

Seed 1, 16384²: 2665 buildings in 268 settlements (1028 cottages, 561 houses, 279 shops, 173 farmhouses, 140 smithies, 134 inns, 120 workshops, 62 manors, 52 temples, 35 towers, 26 guildhalls, 25 warehouses, 17 barracks, 13 banks) and 326 free plots; capitals about 150 buildings, cities 29 to 45, towns 7 to 29, villages 4 to 8, forts 5 to 7. 91 required buildings found no plot (--town all-<tier> lists what each settlement misses). Planning all of them takes well under a second. The bake grows to ≈ 21 MB of statics (6.8 M objects).

Frame time in the client, 2560×1600, zoom 4, headless, on a busy machine (load ≈ 8; compare only within these runs, #49): the middle of Skartor streams ≈ 15 000 statics and runs at 9–15 ms; a dense forest 22 ms; an open meadow 4.3 ms. Towns cost less than forests.

Not done yet

  • Walking upstairs: upper storeys, terraces and tower tops are drawn but not walkable yet (multi-level-movement).
  • Diagonal walls, crenellations, low walls and arrow slits are ordered from the asset pipeline (assets/requests/wall-pieces.md); until they are baked the client draws placeholders.
  • No castles, keeps, gatehouses or wall towers yet; no docks or bridges (streets ford rivers, ports have no piers); no stables; streets are straight.
  • No townsfolk, guards, vendors or signs with names: towns are empty until NPCs come.
  • A building hides its roof while the player stands anywhere in its box, so the yard of a U building counts as inside (#101).