MoxiLang (pronounced Mochi) is a voxel programming language and engine for building 3D worlds.
It’s designed to be simple and intuitive for humans, while also being straightforward enough that GPT-style AIs can generate scripts from prompts.
MoxiLang mixes declarative voxel grids with imperative commands (clone, rotate, translate, merge) — so you can script voxel scenes by hand, or let an AI help you imagine and generate them.
It is not yet stable or officially released — expect changes, breaking updates, and experimentation.
- Voxel Models: define layers and assign colors to symbols or emojis.
- Procedural Commands: clone, translate, rotate, merge, and print voxel scenes.
- AI-Friendly Syntax: designed so LLMs can generate runnable
.miscripts. - Export: output voxel scenes as
.objfiles. - Viewers:
- Lightweight minifb viewer (isometric).
- Interactive Bevy 3D previewer with orbit controls.
- Legacy Support: includes an older ASCII grid parser (
voxgrid) for compatibility.
git clone https://github.com/moxilang/moxi-lang.git
cd moxi-lang
cargo build --release# Preview a .mi script
cargo run examples/forest.mi
# Run without preview
cargo run examples/forest.mi --no-show
# Export to .obj
cargo run examples/test.mi --output out.obj# A parameterized 2x2 checkerboard tile
voxel Checkers(dark_color, light_color) {
[Layer 0]
⬜⬛
⬛⬜
add Colors { ⬛: dark_color, ⬜: light_color }
}
# --- Base colors
dark = ["black"]
light = ["#ffffffff"]
# --- One small tile (2x2)
plane = Checkers(dark, light)
# --- Build a supertile (2x2 planes, offset by 2)
tile1 = translate(plane, (x=0, y=0, z=0))
tile2 = translate(plane, (x=2, y=0, z=0))
tile3 = translate(plane, (x=0, y=2, z=0))
tile4 = translate(plane, (x=2, y=2, z=0))
supertile = merge(tile1, tile2, tile3, tile4)
# --- Build a mega_checker (2x2 supertiles)
mega1 = translate(supertile, (x=0, y=0, z=0))
mega2 = translate(supertile, (x=4, y=0, z=0))
mega3 = translate(supertile, (x=0, y=4, z=0))
mega4 = translate(supertile, (x=4, y=4, z=0))
See MOXI_LANG.md for the full specification:
- Voxel models
- Layers & colors
- Built-in commands
- Transformations & helpers
- Runtime actions
src/moxi/→ core language (lexer, parser, runtime, commands).src/bevy_viewer.rs→ interactive 3D preview.src/viewer.rs→ minimal isometric viewer.src/export.rs→ export to.obj.examples/→ sample.miprograms.src/legacy/→ legacy ASCII voxel grid parser.
MoxiLang is experimental but aims to become a playground for AI-assisted 3D generation. By keeping syntax simple and explicit, it’s easy for LLMs to generate scripts that render into voxel worlds.
MIT
