Matrix Engine Api Documentation - v2.0.0
    Preparing search index...

    Class MapCreator

    MapCreator — Map generator for matrix-engine-wgpu (the beast)

    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 });

    Index

    Constructors

    • Parameters

      • engine: any

        — MatrixEngineWGPU instance

      • m: any
      • collision: any

        — 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

      • mapParams: {
            collectItems: any[];
            zombie: {
                startUpPositions: {
                    north: number[];
                    p1: number[];
                    p2: number[];
                    p3: number[];
                    south: number[];
                };
            };
        } = ...

      Returns MapCreator

    Properties

    _ceilTex: string
    _floorTex: string
    _pDecorationEnabled: any
    _pillarDecorationTex: any
    _uid: number
    _wallTex: string
    collision: any
    engine: any
    mapParams: {
        collectItems: any[];
        zombie: {
            startUpPositions: {
                north: number[];
                p1: number[];
                p2: number[];
                p3: number[];
                south: number[];
            };
        };
    }
    meshes: any
    pillarsFlame: any
    shadowsCast: any

    Methods

    • Parameters

      • name: any
      • pos: any
      • scale: any
      • tex: any
      • mat: string = 'standard'
      • registerCollision: boolean = true
      • collisionRadius: number = 1.0
      • group: string = 'walls'
      • uvShema: boolean = false
      • effects: boolean = false

      Returns any

    • Internal: build a wall face with a centred door opening.

      Produces:

      • left wall segment (static collision)
      • right wall segment (static collision)
      • lintel above gap (static collision)
      • door panel (static collision, named <tag>_door_<uid>) Translate/remove it from code to open/close.

      Parameters

      • tag: any
      • cx: any
      • cy: any
      • cz: any
      • axis: any
      • wallLen: any
      • wallH: any
      • doorW: any
      • wallT: any
      • outArr: any

      Returns { door: any; lintel: any }

      named refs for runtime control

    • Parameters

      • name: any
      • pos: any
      • scale: any
      • tex: any
      • mat: string = 'standard'
      • registerCollision: boolean = true
      • collisionRadius: number = 1.0
      • group: string = 'walls'
      • uvShema: boolean = false
      • effects: boolean = false

      Returns any

    • random pillar cover, and optional crates/blocks.

      Parameters

      • opts: {
            covers?: number;
            depth: number;
            doors?: string[];
            origin: { x: any; y: any; z: any };
            pillarH?: number;
            pillars?: number;
            roof?: boolean;
            tag?: string;
            wallHeight?: number;
            width: number;
        }
        • Optionalcovers?: number

          — low cover blocks

        • depth: number
        • Optionaldoors?: string[]
        • origin: { x: any; y: any; z: any }
        • OptionalpillarH?: number

          — pillar height

        • Optionalpillars?: number

          — number of interior pillars

        • Optionalroof?: boolean
        • Optionaltag?: string
        • OptionalwallHeight?: number
        • width: number

      Returns { ceil: any; covers: any[]; floor: any; pillars: any[]; walls: any[] }

    • Layout: entrance tunnel → fight arena → maze layer → (optional) multi-level maze

      Parameters

      • opts: {
            mazeLevels?: number;
            mazeSize?: number;
            multiLevel?: boolean;
            origin?: { x: any; y: any; z: any };
        } = {}

      Returns any

      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.

      Parameters

      • opts: {
            mazeSize: number;
            origin: { x: any; y: any; z: any };
            roof?: boolean;
            spacing?: number;
            tag?: string;
            wallHeight?: number;
        }
        • mazeSize: number

          — grid cells (forced odd)

        • origin: { x: any; y: any; z: any }

          — bottom-left world position

        • Optionalroof?: boolean
        • Optionalspacing?: number
        • Optionaltag?: string
        • OptionalwallHeight?: number

      Returns { entrance: { x: any; z: any }; exit: { x: any; z: any }; walls: any[] }

    • Create 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.

      Parameters

      • opts: {
            levelGap?: number;
            levels: number;
            mazeSize: number;
            origin: { x: any; y: any; z: any };
            roofLevels?: boolean;
            spacing?: number;
            stairSteps?: number;
            wallHeight?: number;
        }
        • OptionallevelGap?: number

          — extra gap between floor ceiling and next floor

        • levels: number

          — number of floors

        • mazeSize: number

          — grid cells per layer

        • origin: { x: any; y: any; z: any }
        • 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

      Returns { layers: any[]; stairs: any[] }

    • Create a box room.

      Parameters

      • opts: {
            depth: number;
            doors?: string[];
            doorWidth?: number;
            floor?: boolean;
            height: number;
            origin: { x: any; y: any; z: any };
            roof?: boolean;
            tag?: string;
            wallThickness?: number;
            width: number;
        }
        • depth: number

          — Z extent

        • Optionaldoors?: string[]

          — sides with door openings: '+x'|'-x'|'+z'|'-z'

        • OptionaldoorWidth?: number
        • Optionalfloor?: boolean
        • height: number

          — wall height

        • origin: { x: any; y: any; z: any }

          — bottom-center of the room

        • Optionalroof?: boolean
        • Optionaltag?: string
        • OptionalwallThickness?: number
        • width: number

          — X extent

      Returns { ceil: any; floor: any; walls: any[] }

    • Create a stair run connecting two Y levels. Stairs travel along X or Z. Each step is one cube-block.

      Parameters

      • opts: {
            axis?: "x" | "z";
            origin: { x: any; y: any; z: any };
            roof?: boolean;
            stepD?: number;
            stepH?: number;
            steps: number;
            stepW?: number;
            tag?: string;
            walls?: boolean;
        }
        • Optionalaxis?: "x" | "z"

          — travel direction

        • origin: { x: any; y: any; z: any }

          — bottom-start corner

        • Optionalroof?: boolean
        • OptionalstepD?: number

          — tread depth

        • OptionalstepH?: number

          — riser height

        • steps: number

          — number of steps

        • OptionalstepW?: number

          — step width (perpendicular)

        • Optionaltag?: string
        • Optionalwalls?: boolean

          — side walls

      Returns { steps: any[]; walls: any[] }

    • Create a straight tunnel between two points (axis-aligned only). For diagonal tunnels, chain two calls with a corner room.

      Parameters

      • opts: {
            from: { x: any; y: any; z: any };
            height: number;
            roof?: boolean;
            tag?: string;
            to: { x: any; y: any; z: any };
            width: number;
        }
        • from: { x: any; y: any; z: any }
        • height: number

          — tunnel inner height

        • Optionalroof?: boolean
        • Optionaltag?: string
        • to: { x: any; y: any; z: any }
        • width: number

          — tunnel inner width (the non-travel axis)

      Returns { walls: any[] }