Log inGet started
Package

sengokuTownKit.package

This package holds more than this page lists. See all of its files in its world.

README.md

Noise

Deterministic integer-hash randomness for the castle town: every decision the kit makes (where a street runs, which house stands on a plot, which way a barrel turns) comes from here. It uses only integer arithmetic and plain + - * / on doubles (no math.noise, no trig), so a seed gives the same town on desktop and in the browser.

Noise.hash(...) and Noise.str(s) hash integers or a string. Noise.unit(...) maps integers to the range 0 to 1 (exclusive of 1). Noise.rng(...) makes a seeded stream read with Noise.next, Noise.range, Noise.int, Noise.pick and Noise.weighted. Noise.value2(x, z, seed) and Noise.fbm(x, z, seed, octaves) give smooth lattice value noise for the ground.

Noise.yield() and Noise.beat() let a long build yield a frame and bump a counter the CastleTown component's stall watchdog reads. Noise.fingerprint(items) makes the short placement code reported in a town's build stats.

Used by TownLayout, TownGround, TownScatter, TownRender, TownColliders, TownBuilder and CastleTown.