Log inGet started
World

Blockbuster 767

Branchmain
Branchesmain
Commit8e9b87fcce

README.md

blocks

Where the block city stands, and what each building is made of. Pure geometry: this module spawns nothing, reads no entity and touches no physics, so a layout can be inspected and counted without a running simulation.

local Blocks = require("game.city.blocks")
local plan = Blocks.layout(7)
print(plan.blockCount, plan.jointCount)
for _, s in ipairs(plan.structures) do
    print(s.kind, s.x, s.z, s.height, s.tier, #s.blocks)
end

Archetypes

kindwhat it isneeds
skyscrapera tapering stack of banded storeys under a slate cap2.3 m
officeSlaba wide low block with a setback penthouse4.2 m
waterTowerfour legs, a platform, a tank, a chrome cap3.0 m
antennaMasta broad footing under a thin tapering column and a spire2.0 m
bridgetwo piers with a three-block deck laid across them7.2 m
gatetwo piers, a lintel over them, a clock on top5.0 m

Blocks.layout(seed, opts) deals them across four streets of sites, widest archetype first so each appears at least once, then fills the rest by weight. Sites are shares of the table's own half-width and of the band the city is allowed to stand in, so the same layout scales with the table rather than walking off it.

The one joint rule

An entity carries at most one Joint component, so a structure's edges form a tree in which every block is the HOLDER of at most one edge. That is what makes Physics.jointReaction(blockId) unambiguous, which is what lets the break thresholds be measured instead of guessed. Blocks.validate(structure) checks it and the City component refuses to build a structure that fails.

The rule is why the piers of a bridge and a gate are chained in opposite directions: the free end of each chain is what the deck or the lintel hangs from.

What a block is

{ x, y, z, sx, sy, sz, ry, paint, mass } — a world centre, full extents, a yaw about Y, an index into the painted-wood palette, and a mass from its own volume, clamped into the envelope Rules.PHYS allows. No dimension is thinner than Rules.PHYS.blockMinThickness, so nothing in the city can be tunnelled through at 60 Hz — which matters, because CCD is forbidden on every body in this game.