Skip to main content

Module tilebuild

Module tilebuild 

Source
Expand description

Ready-made tilesets and grid builders so a client (agent or GUI) can lay out floors, paths, dungeons and caves with one call.

preset_tileset registers a small kit of primitive-built tiles (floor, path, wall, corner, ramp, …) with matching materials; the generator functions paint those tiles onto a crate::tileset::TileMap: paint_line for paths, gen_dungeon (rooms + corridors + walls) and gen_cave (cellular automata). Tile convention: every kit mesh is built around XZ-center with its bottom at y = 0; ops::add_tile_mesh places it with an offset of half a cell.

Structs§

BuildReport
CaveOpts
Cave parameters: cellular automata. fill ~ initial wall density, smooth iteration passes; open cells become floor, border walls become wall; rare accent tiles (crystals) dot the floor.
DungeonOpts
Dungeon parameters: w×h cells (from cell 0,0), rooms random chambers connected by corridors; every border cell of open space gets the wall tile.
KitTile
One kit entry returned by preset_tileset.
Rng
Deterministic tiny LCG — no rand dependency.

Functions§

gen_cave
Organic cave system painted onto map.
gen_dungeon
Rooms + corridors + wall ring painted onto map (cells overwritten).
kit_motion
Motion the kits apply to their tiles by name (living-world wiring).
merge_meshes
Union of box parts into one mesh (no skin/UVs; normals recomputed).
paint_line
Bresenham line of tile from cell (x0,z0) to (x1,z1); returns count.
preset_tileset
Register a primitive-built kit as a new tileset. kind: dungeon (Verlies: Boden/Weg/Wand/Ecke/Rampe/Tor), cave (Höhle: dunkler Boden, Wand, Felsbrocken, Kristall, Wasser) or outdoor (Gras/Weg/Fels/Baum/ Hecke/Wasser). Returns the tileset id and its named tiles.