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 |
Grid |
|
Stamp |
A reusable F# value with a footprint and a paint. |
Word |
A name for a cell value, used by documents: |
Kernel |
A named per-cell rule, used by documents through |
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: |
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 |
|
Author in F# |
|
Author in KDL or XML |
|
Use raw grid operations |
|
Stack layers |
|
Cover many cells with one instance |
|
Build a 3D map |
|
Work with hexes |
Grid storage
Square and hex maps share one storage type. Geometry is a configuration.
Square |
Hex |
|
|---|---|---|
Storage |
|
|
Build |
|
|
Cursor |
|
|
World space |
|
|
Spatial queries |
|
|
Cells hold 'T voption: ValueSome content or ValueNone. CellGrid2D.getWorldPos converts a cell to world space.
Build and draw order
- Create the grid with
CellGrid2D.createorCellGrid2D.createHex. - Paint it with
Flow.run, or build a document withDocFlow.buildLayers. - Query it:
Landmarksanswers names, tags, and cells;Occupancyanswers the instance that owns a cell. - Draw it: a 2D sprite loop (Buffer & Commands), or
InstancedRenderContextfor 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
- Build a Map End to End: the whole path in order, from the cell type to the draw.
- Code-First Maps: the Flow DSL.
- Authored Maps: KDL and XML documents.
- 3D from 2D: height, spans, the stack, the instance draw.
- The Layout Escape Hatch: raw grid and section operations.
- Migrating to Mibo v6: the old-to-new mapping.
- V5-and-below archive: frozen docs for the retired APIs.
Mibo