ForestBuilder.module
This package holds more than this page lists. See all of its files in its world.
README.md
ForestBuilder
The "drop a forest into my world" builder forestKit is built around: ForestBuilder.build(opts) turns size, seed, density, forest type, season, look and an optional stream/path/clearings/hand-placed extras into a seeded Ground site, a Rules.place population, the instanced draws (ForestRender), the flowing water (StreamWater) and the colliders (one compound per trunk shape, one per rock, a box per log, turned and tagged with its footstep surface), plus four boundary walls around the walkable square.
Called by the Forest component for the one-setting case, and directly by code (the showcase's Showcase component) when the forest needs to fit a hand-designed level: a specific path, clearings, spots kept clear for buildings, hero props placed by hand.
local ForestBuilder = require("@root::forestKit.ForestBuilder")
local forest = ForestBuilder.build({ size = 160, seed = 21, density = "normal", type = "oakWoodland", stream = true })
forest:update() -- call every frame: re-sorts instances into near/mid/far draws as the camera moves
forest:setQuality(0.7)
forest:destroy()
Returns { site, instances, view, stats, update, setQuality, destroy, counts }; stats carries buildMs, draws, instances, colliders and fingerprint, a short code for everything placed (kind, age, variant, position to the centimetre, turn, size) that is the same on every machine standing the same forest. What stands and what collides never depends on the machine: on the web build only the draw distance is capped (webQuality, default 0.6).