five-on-it / apps/tools/src/region-level
apps/tools/src/region-level
A level from a region spec (npm run level:region -- <spec.json>): @foi/catalogue's solver builds the region, and this writes what generate.py writes for a town, into the kits folder (or --out): the level's own kit (<name>.glb and <name>.foi.json: its ground, one terrain piece colliding as its triangles; a hidden piece per road carrying its centre line, its lanes, speed, surface and class; a structure per bridge's deck; a tunnel's roof and portals, structures, and its lights), its recipe (<name>.recipe.json: those pieces, the trees and rocks of the downtown kit, the spawn points) and its places (<name>.places.json). Then level:recipe and level:export, as for any recipe. The worker runs the same for a draft's region.
Without Blender, unless the region has towns: each town is built by the town generator (assets/blender/levels/generate.py --relief, headless Blender) on the land under it, its own kit (<region>-<town>.glb and .foi.json) written beside the region's, its placements and places merged into the region's, moved to its footprint and named after it (<town>-…, <town>.…).
Last, a level over a region's budget (REGION_BUDGET) loses the region's details that may go (trimToBudget: a rich region's plots and its landuse areas' pieces), the least needed first, spread over the whole map.