Log inGet started
World

Helsinki Metro

Branchmain
Branchesmain
Commit18b3807e49

README.md

nordicSuburbKit

A grey Nordic suburb you can drop into any world: 1960s-90s apartment blocks in six styles and many colour schemes, windows that light one by one after dusk (you choose how many flats ever light up, and how many have curtains drawn), bare silver birches, recycling shelters and deep-collection bins, clothes-drying and carpet-beating racks, puddles, parking, road markings, fences and street furniture, wet asphalt and other ground surfaces, plus three enterable interiors with a door to walk in and out: a small flat, an open-plan office and a slightly bigger grocery store. Everything is generated from code as merged, shared meshes, so a whole housing estate stays light enough for a tablet browser.

Version 0.4.8 · depends on worldClockKit (windows and lamps follow its shared clock) · multiplayer-safe (every machine builds the same thing from synced fields; nothing is sent while it runs).

Install and use

Install it from the engine shell (it brings worldClockKit with it), or find "nordicSuburbKit" on ZeroMind:

zero zeromind installAsset 022600ca-0aff-4e9b-bfbe-1859363ff753

Then put components on entities in your scene's build.luau, inside content():

-- a three-storey lamellitalo with stairwells A and B
entity.spawn("BlockA", { position = { 0, 0, -18 } })
	.component.add("nordicSuburbKit.SuburbBuilding", { style = "lowBlock3", scheme = "grey", letters = "A,B" })

-- the courtyard
entity.spawn("Birch", { position = { 6, 0, -4 } }).component.add("nordicSuburbKit.SuburbProp", { kind = "birch", variant = 2, seed = 7 })
entity.spawn("Recycling", { position = { 10, 0, -6 } }).component.add("nordicSuburbKit.SuburbProp", { kind = "recyclingShelter" })
entity.spawn("Yard", { position = { 0, 0, 0 } }).component.add("nordicSuburbKit.SuburbSurface", { kind = "asphalt", sizeX = 40, sizeZ = 20 })

-- an enterable flat somewhere out of sight
entity.spawn("Flat", { position = { -400, 0, 0 } }).component.add("nordicSuburbKit.SuburbInterior", { room = "flat", style = "rental70s" })

Add a WorldClock (worldClockKit) and the windows come on one group at a time as it gets dark. Street lamps are worldClockKit's WorldLamp with style = "streetLamp".

Swap the style with one change

Every look is one field. Change style on a SuburbBuilding (lowBlock3 to oldBrick, say) and the block rebuilds as a brick block with the same doors and footprint rules; change scheme for another colour scheme of the same style; change style on a SuburbInterior to refurnish a room (rental70s to student). Props pick their look with variant.

Lit windows and curtains

Field on SuburbBuildingDefaultMeaning
litShare-1 (kit default 0.6)Share of flats whose windows ever light up after dusk, 0 to 1. The rest stay dark all evening (people away, asleep, flats empty). For the sparse, tired look of a real November evening use about 0.25.
curtains-1 (kit default 0.35)Share of windows with curtains: two pleated fabric panels inside the glass in linen, dusty rose, mustard, sage, white lace or rust, some drawn nearly shut. A lit flat glows through the gap between them. 0 gives bare glass everywhere.
dayShare0.3Share of the light groups already lit by day (a grey day has lamps on).
lightsautoauto follows the clock's darkness (put a WorldClock in the scene); on / off force every window.

Each light group glows in one of three tints picked from the block's seed, the same for every player: warm yellow in most flats, a soft white kitchen light in some, the blue of a TV in a few. They are bright enough to bloom: the courtyard guide and the how-to guide show the one PostProcess line that makes them glow softly at dusk.

-- only a few warm windows, many with curtains: the courtyard at 17:00 in November
entity.spawn("BlockA").component.add("nordicSuburbKit.SuburbBuilding", { style = "lowBlock3", scheme = "grey", litShare = 0.28, curtains = 0.55, dayShare = 0.12 })

The same options are on the generator for your own code: require("nordicSuburbKit.buildings").build(style, scheme, seed, { litShare = 0.3, curtains = 0.5 }), and the kit-wide defaults are Buildings.LIT_SHARE and Buildings.CURTAINS. The generator's answer includes panes = { lit, dark, stairwell, curtained }: how many flat windows can light after dusk, how many never do, the always-lit stairwell windows, and how many windows have curtains.

What you get

ComponentPicks withVariants
SuburbBuildingstyle, schemelowBlock3 (grey, beige, whiteBlue, rust), pointTower (grey, ochre, blueGrey), rowHouses (falunRed, mossGreen, ochreYellow, greyBrown), oldBrick (redBrick, yellowBrick, darkBrick), concrete70s (grey, brownBand, tealBand), pastel90s (salmon, mint, lemon, lilac); seed, floors, length, letters, lights (auto/on/off), dayShare, litShare, curtains
SuburbPropkind, variantbirch x4, recyclingShelter x3, carpetRack x3, dryingRack x2 (clothes-drying rack on T-posts), deepBins x2 (half-buried deep-collection bins, wood or concrete), bench x3, puddle x4, parking x2, laneDashes x3 (60 m dashed centre line, solid edge line, zebra crossing), fence x3, bollard x2, bush x3, bikeRack x2, springRider x2, microcarBody x3, coffeeCup x3, shopBuilding x2, officeBuilding x2
SuburbInteriorroom, style, ownLight (dim interiors on their own light channel, default on), fill, lampShadows (off by default: point-light cube shadows are costly on tablets), lampDistance (the room's lamps switch off while the camera is further than this, default 40 m), rainCap (a weather roof reaching 30 m past the walls so falling rain from kits like Cloudburst never falls inside or around the room; 0 turns it off), ceiling (off makes a cutaway room you can look into from above)flat (rental70s, freshWhite, student), office (openPlan, concreteLoft, agency), store (kotimaa, discount, corner)
SuburbSurfacekindasphalt (wet, reflective), grass, paving, kerb, gravel, concrete
SuburbDoorinterior or to, turna door between outside and inside: beside an interactKit Interactable (install interactKit for it) it moves the player who used the prompt into the named SuburbInterior or to the point to, facing turn degrees

SuburbInterior:spots() returns the world position of every interaction spot in the room (bed, washingMachine, stove, sink, cardboardPile, drawer, homeExit; vendingMachine, desk, window, officeExit; shelves, bottleReturn, checkout, storeExit) so a game can hang prompts on them, and spawnPoint() where someone entering stands. Ask the component on the entity you placed; the answers follow the entity's position and turn:

local flat = entity.spawn("Flat", { position = { -400, 0, 0 } })
flat.component.add("nordicSuburbKit.SuburbInterior", { room = "flat", style = "rental70s" })
-- later, once it has woken up:
local spots = flat.component.get("nordicSuburbKit.SuburbInterior"):spots()
print(spots.washingMachine[1], spots.washingMachine[2], spots.washingMachine[3])

SuburbBuilding:doorPositions() does the same for a block's stairwell doors: { x, y, z, letter } for each, in world space.

Performance

  • Each building draws as: walls (one textured mesh with frames, balconies, roof and curtains), glazing, door lamps, stairwell windows, one mesh for every window that never lights, and one mesh per light group (eight); lighting a group swaps its material, so a group is one draw whether lit or dark. Identical buildings share meshes. No window is a light source.
  • Props share meshes per kind and variant; a 60 m laneDashes run is one draw instead of ten.
  • Interiors switch their lamps and fill off when the camera is far away (lampDistance), and lamps cast no shadows unless you ask.
  • Surfaces are generated, tileable 1K PBR sets (rain-streaked precast concrete, wet asphalt, office carpet tiles, terrazzo linoleum, oak laminate, white backsplash tiles) plus a 4x4 grocery packaging atlas and the two shop signs, all shared runtime materials tinted by vertex colour.
  • In the Survive Thursday courtyard view the move to 0.4.0 took the frame from 288 draw calls and 371 instances to 167 draws and 133 instances.

The interiors' signature appliances are modelled in detail: a front-loading washing machine, a tall black KAHVI coffee vending machine and a white-and-green PULLOPALAUTUS bottle-return machine. The microcar body is a tall rounded kei car with round lamps; coffeeCup is a real-size takeaway cup.

Guides

  • guides/how-to-build-a-nordic-suburb-with-apartment-blocks.guide: every component and field, lit windows and curtains, performance.
  • guides/example-a-rainy-finnish-courtyard.guide: from an empty world to a courtyard with a block (few lit windows, curtains), birches, recycling, a carpet rack, parking and a flat to walk into, step by step.

Gallery

nordicSuburbKit.gallery (scene) shows every style in every scheme, the lit-window and curtain settings side by side, every prop in every variant, every ground surface and the three interiors in every style (as cutaways), labelled, on a wet asphalt yard under a drizzly late-afternoon clock where the windows come on one by one. Press play to walk around it; everyone who joins sees the same gallery. Gallery.stage() and Gallery.layout(origin) put the same showroom in a scene of your own.

Tests

tests/nordicSuburbKitTests.testSuite checks that the gallery opens and shows every variant, that every style, scheme, prop kind and variant, interior room and style and ground surface builds, and that every code example in this README and the two guides runs as written: tools.use("tests", "run", { suite = "nordicSuburbKitTests" }).

Changes

  • 0.4.8: everything builds in the editor, without pressing play, in the browser as on desktop.
    • SuburbSurface, SuburbProp, SuburbInterior and SuburbBuilding build in a system task instead of a gameplay task. A gameplay task spawned from awake is held while edit mode is paused, so in the browser, where a build waits for its textures to stream in, the ground, props, rooms and blocks stopped half way in the editor and only appeared once play started. Nothing changes in play or on desktop.
    • SuburbSurface and SuburbProp sweep what an earlier copy of their code left when the module reloads, as SuburbInterior and SuburbBuilding already did, so an edit to the kit no longer leaves a doubled surface or prop in the editor.
  • 0.4.7: store description and README opening rewritten for creators: what the kit gives you (including the deep-collection bins, drying racks, ground surfaces and door added since 0.4.0), and the one install command. No code changes.
  • 0.4.6: a look, defaults and variety pass, walked as a player at dusk in the rain.
    • Lit windows glow in three tints per light group, picked from the block's seed (warm yellow, soft white, TV blue), and bright enough to bloom; each group is still one draw. The gallery adds a soft bloom, and the guides show the one line that does it.
    • Wet ground: the asphalt is rougher, so a low light no longer paints one even pale sheen over the yard (it read as snow), and the gallery's walkways have puddles. A puddle's water now lies 1 cm above where it is placed, so a puddle put on the ground no longer flickers (the courtyard guide's puddle did).
    • Two new yard props in the usual swap-by-kind way: dryingRack, the clothes-drying rack on T-posts, and deepBins, a row of half-buried deep-collection bins (wood-clad or concrete with coloured lids, relabelled with labels).
    • Buildings.build(...) also counts curtained windows (panes.curtained).
    • Tests: curtains changes how many windows have curtains (every style) and what a placed block draws; windows follow the shared clock's darkness (dark at noon, all lit at night, the day lamps on by day); lit windows use the kit's tints and the same seed gives the same tints for every player.
    • The courtyard guide is rewritten for a newcomer: what to install, where the code goes, what to remove from a new world's template scene first, and what you should see after every step.
    • Defaults checked and kept: a block with no settings is the grey three-storey lamellitalo with the kit's lit and curtain shares, a prop is a bare birch, a room is the 1970s rental flat, a surface is wet asphalt.
  • 0.4.5 (contributed in pull request #1, reviewed and finished here). This is the first release from main with the door. The numbers 0.4.3 and 0.4.4 were published from the contribution's own branch while it was being prepared; they never became the version new installs get, and 0.4.4 still names the kit's interactKit as a dependency that does not install with it, so skip both and use 0.4.5:
    • New SuburbDoor component. Beside an interactKit Interactable it moves the player who used the prompt, and only them, into a SuburbInterior (or to a point) and back out, with turn setting their heading on arrival. It finds the prompt by its name on the same entity and never names interactKit in code, so the kit installs and publishes without interactKit and nothing pins it as a dependency. door:enter() and door:destination() serve a prompt of your own.
    • Courtyard guide, step 6 (the door into the flat) can be followed now: it says to install interactKit and gives the code for both doors. The way out is placed where the flat itself says its front door is (spots().homeExit), and lands you on the steps facing the yard.
    • Courtyard guide, step 2 lays the street that step 4's 60 m of lane markings run along (they used to lie on the lawn).
    • Tests: a door leads to its room or point, a door with nobody to move does nothing, and the guide's door block runs as written wherever interactKit is installed.
  • 0.4.2: SuburbInterior:spots() and spawnPoint() now follow a turned room (they used to ignore the entity's rotation), and SuburbBuilding:doorPositions() works again (it called a method entities no longer have and errored). Buildings.build(...) also answers panes = { lit, dark, stairwell }, how many flat windows can light and how many never do. New tests prove litShare changes how many windows glow (generator and placed block), and ask a placed interior and a placed block for their spots and doors the way this README does.
  • 0.4.1: the gallery scene opens again (its scene.json had been saved without a version) and now has a player who can walk the yard, a row of every ground surface, cutaway interiors and labels that read the right way round. New ceiling field on SuburbInterior. Courtyard guide fixes (weather on the clock, door A position, skipping ahead in time). First test suite.
  • 0.4.0: lit-window share and curtains, merged light groups, moved to its own home world.

Modules

geo (merged mesh builder), mats (shared runtime materials), buildings, props, interiors, gallery.