— MatrixEngineWGPU instance
— CollisionSystem instance
Optionalopts: { ceilTexture?: string; floorTexture?: string; wallTexture?: string } = {}OptionalceilTexture?: string— path to ceiling texture
OptionalfloorTexture?: string— path to floor texture
OptionalwallTexture?: string— path to wall texture
Internal: build a wall face with a centred door opening.
Produces:
<tag>_door_<uid>)
Translate/remove it from code to open/close.named refs for runtime control
random pillar cover, and optional crates/blocks.
Optionalcovers?: number— low cover blocks
Optionaldoors?: string[]OptionalpillarH?: number— pillar height
Optionalpillars?: number— number of interior pillars
Optionalroof?: booleanOptionaltag?: stringOptionalwallHeight?: numberLayout: entrance tunnel → fight arena → maze layer → (optional) multi-level maze
all created geometry groups
Create a 2-D maze on a horizontal plane at a given Y level. Uses recursive DFS — same algorithm as the original example.
— grid cells (forced odd)
— bottom-left world position
Optionalroof?: booleanOptionalspacing?: numberOptionaltag?: stringOptionalwallHeight?: numberCreate multiple stacked maze levels connected by stair runs. Each level is a full DFS maze. Stairs are placed at the exit of each layer connecting it to the entrance of the next.
OptionallevelGap?: number— extra gap between floor ceiling and next floor
— number of floors
— grid cells per layer
OptionalroofLevels?: boolean— put a ceiling on each level except top
Optionalspacing?: number— cell world-space spacing
OptionalstairSteps?: number— steps per stairwell
OptionalwallHeight?: number— height of each layer's walls
Create a box room.
— Z extent
Optionaldoors?: string[]— sides with door openings: '+x'|'-x'|'+z'|'-z'
OptionaldoorWidth?: numberOptionalfloor?: boolean— wall height
— bottom-center of the room
Optionalroof?: booleanOptionaltag?: stringOptionalwallThickness?: number— X extent
Create a stair run connecting two Y levels. Stairs travel along X or Z. Each step is one cube-block.
Optionalaxis?: "x" | "z"— travel direction
— bottom-start corner
Optionalroof?: booleanOptionalstepD?: number— tread depth
OptionalstepH?: number— riser height
— number of steps
OptionalstepW?: number— step width (perpendicular)
Optionaltag?: stringOptionalwalls?: boolean— side walls
Create a straight tunnel between two points (axis-aligned only). For diagonal tunnels, chain two calls with a corner room.
— tunnel inner height
Optionalroof?: booleanOptionaltag?: string— tunnel inner width (the non-travel axis)
MapCreator — Map generator for matrix-engine-wgpu (the beast)
Description
Claude assist. Adapted for MEGPU engine.
Architecture primitives: createRoom(opts) — box room with optional ceiling, N door openings createTunnel(opts) — corridor between two points createStairs(opts) — stair run connecting two Y levels createFightArena(opts) — open combat area with pillars + cover blocks createMazeLayer(opts) — DFS maze on a horizontal plane at given Y createMultiLevelMaze(opts) — stacked maze layers connected by stairs
All geometry registers walls/floors into CollisionSystem automatically. Shared cube mesh is passed once; everything reuses it (draw-call friendly).
Usage: const mc = new MapCreator(mazeInstance, cubeMesh, collisionSystem); mc.createRoom({ origin: {x:0,y:0,z:0}, width:10, depth:10, height:4, doors:['+x','-z'] }); mc.createTunnel({ from:{x:10,y:0,z:0}, to:{x:20,y:0,z:0}, width:2, height:3 }); mc.createMultiLevelMaze({ origin:{x:0,y:0,z:0}, levels:3, mazeSize:15, spacing:2 });