Log inGet started
World

Blockbuster 767

Branchmain
Branchesmain
Commit8e9b87fcce

README.md

City

The block skyline of BLOCKBUSTER 767 — the thing the plane is aimed at.

Put it on an entity and it builds a whole tabletop city from a seed, joins every structure together, and then scores what the player knocks off it.

local city = entity.find("mount_city").component.get("City")
city:census()      -- how much of it is still standing
city:structures()  -- every tower, its kind, height, tier and damage
city:rebuild()     -- lay it out again from the seed

What it builds

game.city.blocks decides the shape: six archetypes — a tapering skyscraper, a banded office slab, a water tower on four legs, a thin antenna mast, a three-span bridge, and a gate with a lintel — dealt across four streets so every archetype appears at least once. Blocks are painted wood (game/city/materials) over a shared grain texture, each structure turned off the grid and each stack given a little per-block twist, so it reads hand-stacked.

What holds it up

Every structure is a tree of fixed joints in which each block carries at most one joint, because an entity carries one Joint component and a second would silently replace the first. The joints are created with no threshold at all; then, once the city has stood on its own for settleFrames, the component reads Physics.jointReaction on every joint over sampleFrames and sets

breakForce  = measured force  × Rules.PHYS.jointBreakMargin
breakTorque = measured torque × Rules.PHYS.jointBreakMargin

with floors so a joint resting under nothing is not released by its own settling. Nothing here is a guessed number, and the grading falls out of the measurement: the joint under ten storeys ends up an order of magnitude stronger than the one under a spire, so a clipped top comes off while the tower below it stands.

What it does every frame

Every live block is watched. One that moved is clamped to Rules.PHYS.debrisMaxSpeed and debrisMaxSpin — the governor that stands in for CCD, which is forbidden on every body in this game — and scored:

what happenedeventscore
a block left home by Rules.SCORE.displaceDistanceblockDisplacedperDisplacedKg × its mass
a block fell past the table edgeblockOffRules.SCORE.offTable
a structure lost toppleFraction of itselftowerToppled (via Game.recordTopple)topplePerTier × tier, and the chain multiplier goes up

A block that reaches the playroom floor is despawned, a few per frame, so a wave of debris landing together does not rebuild the solver's islands all at once.

Fields

fieldwhat it is
seedthe layout; the same seed builds the same city on every peer
settleFramesframes the city stands before its joints are measured
sampleFramesframes the resting load is sampled over; the largest reading wins
minBreakForcenewtons no threshold falls below
torqueLeverScalescales the lever arm that floors the angular threshold
cullsPerFramehow many floor-bound blocks are despawned in one frame

It rebuilds itself on sessionStart, so a fresh session gets a fresh city. Everything it spawns lives under one temporary city_root: nothing is ever baked into the scene.