# AlpineProp
Puts one alpineProps prop on its entity: any kind `AlpineProps.kinds()` lists (conifers, dead and fallen trees, and the shrubs, flowers, rocks and structures the other catalogs register). It builds one child per part, each a `Model` with a `MeshLod` swapping to the cheaper bakes as the prop shrinks on screen, and a static collider child from the catalog entry (sized per age for trees, tagged with the attribute `forestSurface`). The children are temporary and rebuilt from the synced fields, so every player builds the same prop and a reload rebuilds it. Needs nothing else on the entity.
```luau
local e = entity.spawn("spruce")
e.component.add("alpineProps.AlpineProp", { kind = "spruce", age = "old", season = "winter" })
```
| Field | Default | Meaning |
|---|---|---|
| `kind` | `spruce` | any kind AlpineProps lists |
| `age` | `mature` | sapling, young, mature, veteran ("old" = veteran) |
| `season` | `summer` | spring, summer, autumn, winter (larch gold in autumn, bare in winter) |
| `look` | `real` | real, painted, toon |
| `variant` | `1` | baked shape variant (wraps) |
| `seed` | `0` | non-zero picks the variant and a yaw from the seed (scattering) |
| `detail` | `auto` | auto swaps LODs by screen size; near, mid, far pin one |
| `collide` | `true` | build the static collider |
| `snow` | `auto` | snow on the branches: auto (winter), on, off |
For whole forests use forestKit's Forest / ForestRender, which draws the same kinds instanced.
# AlpineProps
The alpineProps registry: every alpine kind (58 of them: conifers, dead trees, shrubs, grasses, flowers, rocks, cliffs, huts and trail props) is registered here, and through it also in forestProps' `Props`, so forestKit's `ForestRender` draws and collides alpine props the same way it does forest ones. The `AlpineProp`, `Cabin`, `Signpost` and `PropGallery` components and the catalogs call it, and game code calls it to list kinds or get draws.
```luau
local AP = require("alpineProps.AlpineProps")
for _, k in AP.kinds() do print(k, AP.info(k).category) end
local parts = AP.parts("spruce", { age = "veteran", season = "summer", snow = true, lod = 0 }) -- { { mesh, material, part } }
```
- `AP.kinds()` lists every kind in registration order; `AP.kindsOf(category)` those of one category (`tree`, `deadtree`, `log`, `bush`, `grass`, `flower`, `rock`, `cliff`, `structure`).
- `AP.info(kind)` returns the catalog entry: `category`, `variants`, `radius`, `height`, `collider`, `surface`, and for trees `ages` and `byAge`.
- `AP.parts(kind, opts)` returns the draws. Opts are `age`, `season`, `look`, `variant`, `lod` (0-2), `seed` and `snow`; `snow` defaults to `season == "winter"`, and `age = "old"` reads as `"veteran"`.
- `AP.normalize(kind, opts)` returns forestProps-normalised opts plus `snow`. `AP.register(entry, partsFn)` adds or replaces a kind, which is how the catalogs (`ConiferCatalog`, `FloraCatalog`, `RockCatalog`, `StructureCatalog`) plug in; they load on first use.
- `AP.AGES`, `AP.SEASONS` and `AP.LOOKS` hold the accepted values.
# BakedConifers
Generated by `ConiferBake.writeIndex()`; do not edit by hand. Every baked conifer mesh of alpineProps as a literal `asset.ref` (so publishing and installing see each mesh as a dependency), its triangle count (`M.tris`), and the measured size of every conifer kind and age (`M.dims[kind_age] = { radius, height, trunk, length? }` in metres). `ConiferCatalog` reads it; nothing else needs to.
# BakedFlora
GENERATED by FloraBake: the bake manifest of alpineProps' plants (variants, triangles per part per LOD, atlas cell used) and one literal `asset.resolve` per baked mesh, so FloraCatalog never resolves a computed asset name. Do not edit by hand; re-run FloraBake.
# BakedRocks
GENERATED by FloraBake: the bake manifest of alpineProps' rocks and cliffs (variants, triangles per part per LOD, size and collider boxes per variant) and one literal `asset.resolve` per baked mesh, read by RockCatalog. Do not edit by hand; re-run FloraBake.
# BakedStructures
Generated index of every baked hut part and trail prop mesh (`StructureBake.writeIndex()` writes it from `meshes/structures_manifest.json`; do not edit by hand). `StructureCatalog` reads it to hand out parts; nothing else needs to.
- `meshes[name]` is a literal `asset.ref` for each `<kind>_v<variant>_lod<lod>_<materialKey>` mesh under `meshes/structures`, so publishing and installing see every mesh as a dependency.
- `parts["<kind>_v<v>_lod<l>"]` lists the material keys that stem draws, in order (`snow` last, drawn only when snow is on).
- `tris[name]` is the triangle count of each mesh, used by the budget tests and the package README.
```luau
local Baked = require("alpineProps.BakedStructures")
print(Baked.parts["bench_v1_lod0"][1], Baked.tris["bench_v1_lod0_roughTimber"])
```
# Cabin
Assembles alpineProps' baked structure parts (wall sections, corners, windows, doors, gables, roofs, chimney, foundation, porch, bench, woodpile, trough) into a whole mountain hut. The `Cabin` component calls it; call it yourself to place huts from code or to lay out a single part.
```luau
local Cabin = require("alpineProps.Cabin")
local hut = Cabin.build("logHut", { parent = root, position = { 0, 0, 0 }, yaw = 0.4, season = "winter", snow = true, seed = 7 })
hut:destroy()
```
- `Cabin.STYLES`: `logHut`, `stoneHut`, `aFrame`.
- `Cabin.build(style, opts)` builds temporary child entities, each with a box collider, and returns `{ root, style, parts, colliders, destroy }`. Opts: `parent`, `position`, `yaw`, `season`, `look`, `snow`, `seed`.
- `Cabin.layout(style)` is the list of placements `{ kind, v, p, yaw }` in the hut frame; `Cabin.footprint(style)` its size.
- `Cabin.placePart(parent, kind, variant, position, yaw, opts)` places one part with its colliders.
The front (door side) faces local +Z and the origin is the ground at the centre of the footprint.
# Cabin
Stands a whole mountain hut on its entity: `logHut` (notched log walls, shingle roof, stone chimney, bench and woodpile), `stoneHut` (dry-stone walls, slate roof, deep small windows, bench and water trough) or `aFrame` (steep shingle A-frame on a stone base with a timber gable, porch deck and stovepipe). The hut is assembled by `alpineProps.Cabin` from baked parts as temporary child entities with a box collider per part, rebuilt from the synced fields, so every player sees and bumps into the same hut. The door faces the entity's +Z; the footprint is about 5 x 6 m centred on the entity. Needs no other component.
```luau
local hut = entity.spawn("lakeHut", { position = { 40, 0, 12 } })
hut.component.add("alpineProps.CabinHut", { style = "stoneHut", season = "winter" })
```
| Field | Default | Meaning |
|---|---|---|
| `style` | `logHut` | logHut, stoneHut, aFrame |
| `season` | `summer` | spring, summer, autumn, winter |
| `look` | `real` | real, painted, toon |
| `snow` | `auto` | snow on roof, rails and sills: auto (winter), on, off |
| `seed` | `1` | turns the loose props (bench, woodpile, trough) a little differently |
`component:hut()` returns `{ root, style, parts, colliders }` once built.
# ConiferBake
Tool code that bakes the alpineProps conifers (`ConiferGen`) into `.mesh` assets under the package's `meshes/conifers/` folder and regenerates `BakedConifers`, the literal index the catalog reads. Run it inside a task when a generator changes:
```luau
local Bake = require("alpineProps.ConiferBake")
Bake.bakeKind("spruce") -- every age and variant of one kind (or a dead/odd kind)
Bake.writeIndex() -- regenerate BakedConifers from meshes/conifers_manifest.json
Bake.prune() -- delete meshes the manifest no longer names
Bake.bakeAll() -- everything (about three minutes)
```
Re-runnable: bakes overwrite the same assets. Paths come from where the package sits, so it also bakes in a world that installed alpineProps under `deps/`. The manifest records triangle counts and the measured size (radius, height, trunk radius, length) of every kind and age, which the catalog uses for spacing and colliders.
# ConiferCatalog
Registers alpineProps' conifer kinds with `AlpineProps.register` (so they are in both `alpineProps.AlpineProps` and forestProps' `Props`, which forestKit's ForestRender draws instanced with three LODs). Loaded by `AlpineProps` on first use; call `AlpineProps.parts(kind, opts)` rather than this module.
| Kind | Category | Ages / variants | What it is |
|---|---|---|---|
| `spruce` | tree | sapling, young (2), mature, veteran (3) | Norway spruce: straight leader, narrow cone, drooping branch tips; old trees 34 m with hanging curtains |
| `scotsPine` | tree | same | Scots pine: conical when young, flat irregular crown high on a bare orange-topped bole when old |
| `fir` | tree | same | silver fir: flat horizontal tiers, blunt stork's-nest top when old |
| `larch` | tree | same | European larch: airy cone with drooping twigs; golden in autumn, bare in winter |
| `stonePine` | tree | same | Swiss stone pine: dense rounded-columnar dark crown, multi-topped when old, 10-17 m |
| `mugoPine` | tree | same | dwarf mountain pine: multi-stemmed sprawling shrub 0.6-3 m |
| `deadSpruce` | deadtree | 3 | silver snag with drooping dead branches, stubs and a snapped top |
| `krummholz` | deadtree | 2 | wind-bent stunted spruce mat, branches on the lee (+X) side only |
| `windbentPine` | deadtree | 2 | leaning treeline pine with a wind-flagged crown |
| `fallenSpruce` | log | 2 | fallen trunk along +X with branch stubs and torn roots; box collider, walks as `log` |
Parts, in order: bark, needles (`leaf`, or `toon` near in the toon look; none for winter larch), then `snow` when snow is on (default: winter). Every part carries `part = "<name>"` beside `mesh` and `material`. Materials come only from `alpineMaterials.AlpineMaterials`. `C.dims(kind, age)` gives the measured size; `C.mesh(C.meshName(...))` a baked mesh.
# ConiferGen
Deterministic generator for the alpineProps conifers: Norway spruce, Scots pine, silver fir, European larch, Swiss stone pine and dwarf mountain pine at four ages (sapling, young, mature, veteran), plus a dead spruce snag, wind-bent krummholz, a treeline windbent pine and a fallen spruce. `ConiferGen.generate(kind, age, variant)` returns Geo geometries for three levels of detail; `ConiferBake` turns them into the package's baked `.mesh` assets. Tool-time code: nothing loads it at runtime.
How each tree is grown:
- **Excurrent conifers** (spruce, fir, larch, stone pine, young Scots pine): one leader with whorls of primary branches every annual shoot (plus interwhorl branches), lengths cut by a per-species crown profile (narrow cone, blunt stork's-nest top for old fir, rounded column for stone pine, egg for young pine). Spruce droops and turns its tips up and an old spruce hangs curtains of twigs; fir lies flat in tiers; larch hangs long twigs; old stone pine forks into several tops. Dead stubs on the bare bole below the crown.
- **Pine form** (mature/old Scots pine, windbent pine): a clear bole with orange upper bark into big upturned limbs, sub-branches and twigs whose ends carry clumped needle tufts under a flat or wind-flagged crown (windward limbs reduced to dead stubs).
- **Multi-stem** (mountain pine): sprawling stems curving up from one base into a dome.
- **Krummholz**: silver stems bent leeward (+X), branches only on the lee side, a low skirt, flat-topped by the wind.
- **Dead / fallen**: silver snag with a snapped top and drooping dead branches; a fallen trunk along +X with branch stubs, a snapped top and torn roots.
Parts per LOD: `bark` (tapered tubes, flare and lobes, world-scale bark UVs), `leaf` (alpha-cut needle spray cards: UV 0..1 per card, vertex alpha = wind weight 0 base to 1 tip, RGB = shade/tint), `snow` (opaque pillowed pads on the upper sides of branch layers and foliage clumps, or ridges along bare branches; far: sloping tier bands), `toon` (stacked jagged cone tiers or clumped blobs, LOD0) and `tsnow` (snow caps on the toon shapes), `barkw` (larch's bare-winter far bark). LOD1 is ~30% of LOD0; LOD2 is at most 600 triangles including snow, built from enlarged cards where the near cards are so the silhouette and colour hold at 300 m. Budgets (LOD0 bark + needles): sapling 1.4k, young 5k, mature 11.5k, veteran 19.5k.
Tune a species in `G.config` (`cfgFor`), then rebake with `require("alpineProps.ConiferBake").bakeKind(kind)` and `.writeIndex()`.
# FloraBake
Bakes FloraGen and RockGen to `.mesh` assets under `meshes/flora/<kind>/` and `meshes/rocks/<kind>/` (names `<kind>_v<variant>_l<lod>_<part>`), finishing each part (winding, solid alpha, alpineMaterials atlas-cell UV remap) and rewriting the BakedFlora / BakedRocks indexes. `require("alpineProps.FloraBake").run()` inside a task bakes everything (about a minute); `.run({ kinds = { ... } })` re-bakes some and keeps the rest. Re-run after changing a generator or when alpineMaterials' atlas cells move.
# FloraCatalog
Registers alpineProps' shrubs, grasses and flowers with `AlpineProps.register` (and so forestProps' `Props`, which forestKit's ForestRender draws). Parts come from BakedFlora, materials from alpineMaterials. Seasonal rules: flowers spring/summer only; alpenrose blooms and cotton-grass heads in summer; dwarf willow and green alder bare in winter; alpenrose and juniper evergreen; a `snow` part on shrubs when snow is on (default winter). Exposes SURF / PART_SEASONS / showsPart for tools and tests.
# FloraGen
Procedural generators for alpineProps' plants: shrubs alpenrose (dense dome, pink summer blooms), juniper (low spreading mat), dwarfWillow (creeping runners with upright shoots), greenAlder (2-3 m thicket of arching stems); grasses alpineTussock and cottonGrass (cotton heads); flowers gentian, edelweiss, arnica, saxifrage (purple cushion), alpineAster, campanula, globeflower. `FloraGen.build(kind, variant, lod)` returns named parts (stems, leaves, blooms, blades, heads, plants, snow) as geometry; deterministic per kind and variant. Run by FloraBake; the game reads only the baked meshes.
# GroundKit
Bake-time geometry kit for alpineProps' ground generators (FloraGen, RockGen): seeded random, fractal noise, bent alpha cards and swept tubes (forestProps GroundGeo conventions, MIT), geodesic blobs, and an exact convex-polytope builder for granite: a block is cut from a box by planes (half-space clipping), meshed with flat faces and sharp edges, subdivided and warped by position-based noise so shared edges stay closed. Also `snowSkin` (a snow layer on a solid's upward faces) and `toMesh` (rounded arrays for byte-stable bakes). Nothing on the gameplay path requires it.
# PropGallery
Lays every alpineProps kind out side by side on its entity, in labelled rows, so the whole kit can be looked over (and compared between looks, seasons and levels of detail) in one place. Rows run along the entity's +X and follow each other toward -Z; each row has a Text3D title at its left end and every item a label in front of it. Everything it builds is a temporary child (never saved), rebuilt from the synced fields a few items per frame. Needs no other component; it adds `alpineProps.AlpineProp`, `alpineProps.Cabin`, `alpineProps.Signpost` and `Text3D` to the children it spawns.
```luau
entity.spawn("gallery").component.add("alpineProps.PropGallery", {})
entity.spawn("trees").component.add("alpineProps.PropGallery", { sections = "conifers,deadTrees", look = "painted" })
```
| Row (`sections` id) | What it shows |
|---|---|
| `conifers` | one row per species (spruce, scotsPine, fir, larch, stonePine, mugoPine): sapling, young, mature, veteran without snow, then the same four in winter with snow |
| `deadTrees` | deadSpruce, krummholz, windbentPine, fallenSpruce, without and with snow |
| `shrubs` | alpenrose, juniper, dwarfWillow, greenAlder, without and with snow |
| `flora` | cottonGrass, alpineTussock and the seven flowers, each as a patch of five seeded plants |
| `rocks` | graniteBoulder, rockOutcrop, screeStone, screePatch, flatSlab, cairn |
| `cliffs` | cliffFace, cliffSpire |
| `huts` | the `Cabin` component as logHut, stoneHut, aFrame |
| `trail` | a lettered `Signpost`, then signpost, signArm, waymarkPost, footbridge, summitCross, lookout, trailSteps, fenceRail, infoBoard, bench, woodpile, waterTrough |
| `hutParts` | every wall, corner, window, door, gable, roof, chimney, porch and foundation part |
| `other` | any kind `AlpineProps.kinds()` lists that no row above names |
| Field | Default | Meaning |
|---|---|---|
| `sections` | `all` | `all`, or a comma list of the row ids above |
| `look` | `real` | real, painted, toon |
| `summerSeason` | `summer` | season of the snow-free items (autumn turns larch gold) |
| `detail` | `auto` | handed to every AlpineProp: auto, or near / mid / far to pin one LOD |
| `labels` | `true` | draw row titles and item labels |
| `gap` | `2` | metres between props and between rows |
| `perFrame` | `6` | props spawned per frame while building |
`component:isBuilt()`, `component:itemCount()` and `component:extent()` (`{ minX, maxX, minZ, maxZ }` in the entity's frame) report progress and footprint. The full gallery is about 125 items over roughly 160 x 260 m; `PropGallery.scene` frames it with a sun, sky and camera.
# PropGallery
A showroom scene for the alpineProps kit: a large meadow ground plane, a midday sun with ambient fill, a `ProceduralSky` that leaves the sun light alone (`syncSunToLight = false`), one entity carrying the `alpineProps.PropGallery` component, which lays out every kind in labelled rows (each conifer at every age, without and with snow; dead trees, shrubs, grasses and flowers, rocks and cliffs, the three huts, trail props and hut parts), and a camera looking down the rows. Open it to look the kit over, compare looks (set the gallery's `look`) or check a re-bake; it holds no player.
The scene is written as code in `build.luau`; it builds when the scene is opened in edit mode.
# RockCatalog
Registers alpineProps' rocks and cliffs (graniteBoulder, rockOutcrop, screePatch, screeStone, flatSlab, cairn, cliffFace, cliffSpire) with `AlpineProps.register` (and forestProps' `Props`). Body in `lichenGranite`, snow part in `snowLoad` when snow is on. Each entry has a forestKit-style box `collider` (median variant), footstep `surface` (stone; scree for the scree patch, which has no collider) and `byVariant[v] = { radius, height, collider, boxes }` with exact per-variant boxes and one box per granite block.
# RockGen
Procedural generators for alpineProps' stone: graniteBoulder (1.3-3.8 m, 4 variants), rockOutcrop (4-8 m bedrock knob), screeStone, screePatch (4-6 m of loose angular stones), flatSlab, cairn (~1.2 m stacked stones), cliffFace (modular 10-20 m face facing +Z, 6 m below ground) and cliffSpire (8-15 m tower). Every stone is an exact faceted granite polytope (joint planes plus chamfers, then noise and joint cracks); big shapes are assemblies of blocks whose gaps read as cracks and ledges. `RockGen.build(kind, variant, lod)` returns { body, snow } and meta { size, boxes } (collider boxes). Snow is capped per LOD so body + snow stays inside the triangle budget.
# Signpost
A wooden trail signpost whose arms point at destinations and carry readable lettering ("Bergsee 20 min"). Fill in up to four arms, each with text and a direction in degrees about +Y (0 = the entity's +X). Built by `alpineProps.Signs` as temporary children from the synced fields, so every player sees the same sign. Needs no other component.
```luau
entity.spawn("trailhead sign").component.add("alpineProps.Signpost", {
arm1 = "Bergsee 20 min", dir1 = 0, arm2 = "Gipfelkreuz 2 h", dir2 = 150, arm3 = "", arm4 = "",
})
```
| Field | Default | Meaning |
|---|---|---|
| `arm1`..`arm4` | three sample destinations, `arm4` empty | text of each arm, top down; empty for no arm |
| `dir1`..`dir4` | 0, 20, 180, 200 | arm direction in degrees about +Y |
| `season` | `summer` | spring, summer, autumn, winter |
| `look` | `real` | real, painted, toon |
| `snow` | `auto` | snow on arms and cap: auto (winter), on, off |
# Signs
Builds a trail signpost with direction arms and readable destinations: the baked `signpost` post (variant 4, post only) plus one baked `signArm` per arm, lettered on both faces with a mesh laid out from the engine's font glyphs (`font.textMesh`, ArimoBold), so each face reads left to right. The `Signpost` component calls it; call it directly for signs with up to six arms or custom heights.
```luau
local Signs = require("alpineProps.Signs")
local sign = Signs.make(parentEntity, { arms = {
{ text = "Bergsee 20 min", yaw = 0 },
{ text = "Gipfelkreuz 2 h", yawDeg = 140 },
{ text = "Parkplatz 1 h", yaw = math.pi, height = 1.9 },
}, season = "winter", snow = true })
sign:destroy()
```
- `Signs.make(parent, opts)`: opts `arms` (`text`, `yaw` radians or `yawDeg`, optional `height`), `season`, `look`, `snow`. Arms stack top down from 2.32 m, 0.22 m apart. Children are temporary.
- `Signs.textMesh(text)`: the cached lettering mesh for one arm.
- `Signs.MAX_ARMS` = 6.
# StructureBake
Tool code that bakes the huts and trail props `StructureGen` describes into `.mesh` assets under `meshes/structures` and regenerates the `BakedStructures` index. Run it in edit mode when a structure's geometry changes; games never call it.
```luau
local Bake = require("alpineProps.StructureBake")
Bake.bakeKind("logWallSection") -- every variant x LOD x material of one kind
Bake.writeIndex() -- rewrite BakedStructures from the manifest
Bake.prune() -- delete meshes the manifest no longer names
```
`Bake.bakeAll()` bakes every kind then writes the index; it is heavy (hundreds of mesh writes), so prefer one kind per call. Mesh names are `<kind>_v<variant>_lod<lod>_<materialKey>`. Re-runnable: a bake overwrites the same assets. Paths come from where the package sits, so it bakes the same installed under `deps/`.
# StructureCatalog
Registers alpineProps' 27 hut parts and trail props with `AlpineProps` (and through it forestProps' `Props`), category `structure`. `AlpineProps` loads it on first use; ask `AlpineProps.parts(kind, opts)` for draws and this module only for colliders and triangle counts.
```luau
local AP = require("alpineProps.AlpineProps")
AP.parts("roofShingle", { lod = 0, season = "winter", look = "painted" }) -- snow on the roof
require("alpineProps.StructureCatalog").colliders("lookout") -- every walkable box
```
- Kinds (`SC.KINDS`): logWallSection, logCorner, stoneWallSection, timberWallSection, wallWindow, wallDoor, gableLog, gableStone, gableTimber, roofShingle, roofSlate, aFrameRoof, chimneyStone, porchDeck, stoneFoundation, bench, woodpile, waterTrough, signpost, signArm, waymarkPost, footbridge, summitCross, lookout, trailSteps, fenceRail, infoBoard.
- Each entry carries forestProps' `collider` (one box), `colliders` (every box of a multi-box kind: decks, rails, piers, steps), `variantColliders[v]`, `surface` (`wood` or `stone`) for footsteps and `variantNames`.
- `SC.parts(kind, o, snow)`, `SC.colliders(kind, variant)`, `SC.tris(kind, variant, lod)`.
- Parts come from `BakedStructures`; a part with no bake yet is built at runtime once per session so a kind always draws. Materials come from `alpineMaterials.AlpineMaterials`.
# StructureGen
Procedural geometry for the alpine huts and trail props: one builder per kind writes a `Geometry` per material key for a given variant and level of detail. `StructureBake` bakes its output, `StructureCatalog` registers it and `Cabin` lays it out using `SG.DIM`. Games do not call it at runtime except through the catalog's fallback for an unbaked part.
```luau
local SG = require("alpineProps.StructureGen")
local geos = SG.build("logWallSection", 1, 0) -- { [materialKey] = Geometry }
local boxes = SG.colliders("lookout", 1)
```
- Material keys map to alpineMaterials surfaces through `SG.SURFACE`: logWall, woodShingles, roughTimber, stoneWall, slateRoof, ironWrought, lichenGranite, deadwoodSilver, mountainLake, `paint` (roughTimber with vertex colours for trail paint) and `snow` (snowLoad, only drawn with snow).
- `SG.ORDER` lists every kind; `SG.KINDS[kind].entry` its catalog entry.
- Units are metres, +Y up; wall parts run along local X with the outside at +Z and the base at y = 0, sized on the 0.5 m grid in `SG.DIM`.