Logo Mibo

Level Design

Mibo builds maps from a CellGrid2D<'T>. Two channels author the same grid: F# values (Code-First Maps) and KDL/XML documents (Authored Maps). Both stop at cells; the game draws them.

Map terms

Term

Meaning

Cell

One grid position. The game defines the cell type 'T.

Grid

CellGrid2D<'T>: the cell array, square or hex.

Stamp

A reusable F# value with a footprint and a paint.

Word

A name for a cell value, used by documents: fill grass.

Kernel

A named per-cell rule, used by documents through generate.

Element

A named body of statements with an optional size.

Surface

The game's frozen tables of words, kernels, and elements.

Layer

One grid in a stack, painted bottom first.

Span

How many cells one drawn instance covers: Span(4, 2), Radius 2.

Occupancy

The build's answer to "which instance owns this cell".

Landmarks

The rectangles element names resolve to, plus tag and cell queries.

The domain is the map data: words, kernels, elements, layers, spans. The infrastructure is the game side: the cell type, the surface, the build call, the queries, the render context, the stack. 3D from 2D walks the infrastructure.

Pick a path

Goal

Page

Build a map step by step

Build a Map End to End

Author in F#

Code-First Maps

Author in KDL or XML

Authored Maps

Use raw grid operations

The Layout Escape Hatch

Stack layers

Layers

Cover many cells with one instance

Instances and Occupancy

Build a 3D map

3D from 2D

Work with hexes

Hex Grids

Grid storage

Square and hex maps share one storage type. Geometry is a configuration.

Square

Hex

Storage

CellGrid2D<'T>

CellGrid2D<'T> (hex geometry)

Build

CellGrid2D.create

CellGrid2D.createHex

Cursor

GridSection2D<'T>

GridSection2D<'T>

World space

Vector2

Vector2 (staggered rows or columns)

Spatial queries

Grid2DSpatial

Hex2DSpatial

Cells hold 'T voption: ValueSome content or ValueNone. CellGrid2D.getWorldPos converts a cell to world space.

Build and draw order

  1. Create the grid with CellGrid2D.create or CellGrid2D.createHex.
  2. Paint it with Flow.run, or build a document with DocFlow.buildLayers.
  3. Query it: Landmarks answers names, tags, and cells; Occupancy answers the instance that owns a cell.
  4. Draw it: a 2D sprite loop (Buffer & Commands), or InstancedRenderContext for a footprint grid (GPU Instancing).

Run steps 1 to 3 at load. Step 4 runs per frame.

2D and 3D

2D layout fits side-scrolling platformers, top-down RPGs and roguelikes, isometric games, and tile-based puzzles.

A 3D map is a 2D footprint plus a Height per cell: walls are tall columns, ramps are stepped heights. A span scales one instance over several cells, so one model covers a 2×2 deck or a 16×6 plaza. See 3D from 2D.

Hex geometry fits strategy and tactics games, wargames, and games with six-directional adjacency.

Guides

Type something to start searching.