Mibo.MonoGame.Adaptive
5.1.0
dotnet add package Mibo.MonoGame.Adaptive --version 5.1.0
NuGet\Install-Package Mibo.MonoGame.Adaptive -Version 5.1.0
<PackageReference Include="Mibo.MonoGame.Adaptive" Version="5.1.0" />
<PackageVersion Include="Mibo.MonoGame.Adaptive" Version="5.1.0" />
<PackageReference Include="Mibo.MonoGame.Adaptive" />
paket add Mibo.MonoGame.Adaptive --version 5.1.0
#r "nuget: Mibo.MonoGame.Adaptive, 5.1.0"
#:package Mibo.MonoGame.Adaptive@5.1.0
#addin nuget:?package=Mibo.MonoGame.Adaptive&version=5.1.0
#tool nuget:?package=Mibo.MonoGame.Adaptive&version=5.1.0
Mibo
Install the templates:
dotnet new install Mibo.Templates dotnet new mibo-2d -o MyGame # MVU runtime dotnet new mibo-2d-adaptive -o MyGame # adaptive runtime cd MyGame dotnet run
NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.
Following that spirit, Mibo keeps it lean, just F# and the Elmish loop with a handful of commodities to get out of your way and let you enjoy the craft.
Mibo is an Elmish-based F# game framework with two interchangeable backends — raylib-cs and MonoGame (DesktopGL/OpenGL and WindowsDX/DirectX) — designed to allow developers to write games using familiar MVU patterns for all kinds of game genres and sizes.
Mibo aims to solve 80/20 of use cases for enabling developers to focus on game logic rather than boilerplate code, providing guidelines and architecture for structuring game code, handling input, rendering, asset management, and time management among others.
What's in the box?
- Elmish runtime (MVU loop) with
Cmd,Sub, optional fixed timestep, and frame-bounded dispatch - Input — raw input (
Keyboard,Mouse) + semantic mapping viaInputMap/ActionState - Assets — texture, font, sound, and model loading caches
- Rendering — Command buffer based rendering:
- 2D batch renderer with layers and multi-camera support
- 3D batch renderer with opaque/transparent passes and custom shader switching
- Escape hatches for custom GPU work
- Camera helpers with screen-to-world, orbit, and ray casting
- Layout — 2D procedural grid layout (
CellGrid2D) with platformer, top-down, and geometric primitives - Layout3D — 3D voxel-style grid layout (
CellGrid3D) with terrain, interior rooms, corridors, stairs, and procedural generation - Animation — sprite sheet slicing,
AnimatedSpritestate machines, and grid-based animation definitions - Mibo.Adaptive — a pull-based incremental computation library for tight-loop workloads:
CVal/AValroots and projections plus adaptive sets, maps, and lists with element-level deltas, allocation-free in steady state. The Mibo integration (AdaptiveProgram/AdaptiveHeadlessand the windowed hosts) is experimental. - Input Mapper — Listen to raw input and map it to semantic actions
- Performance — zero-allocation hot paths: spatial grid queries return a single result array per call, and per-frame dictionary lookups, light merging, and render-pipeline bookkeeping allocate nothing
Packages
Mibo ships as two independent runtime lanes on top of a shared kernel. Pick one lane per game — MVU installs pull no adaptive code, and adaptive installs pull no MVU code:
| Package | Gives you |
|---|---|
Mibo.Core |
Runtime-neutral kernel: GameContext, GameTime, render buffers, input contracts, layout, diagnostics |
Mibo.Mvu |
The Elmish/MVU runtime: Cmd, Sub, Program, loops, and headless support |
Mibo.Adaptive |
The dependency-free incremental computation library (CVal/AVal roots, adaptive sets, maps, and lists) |
Mibo.Adaptive.Mibo |
The Mibo-side adaptive runtime: AdaptiveProgram, AdaptiveHeadless |
Mibo.Raylib |
Neutral raylib shell: renderers, camera, windowing, input polling |
Mibo.Raylib.Mvu |
MVU host for raylib (RaylibProgram, RaylibGame) |
Mibo.Raylib.Adaptive |
Adaptive host for raylib (AdaptiveRaylibGame) |
Mibo.MonoGame |
Neutral MonoGame shell (same surface as the raylib shell) |
Mibo.MonoGame.Mvu |
MVU host for MonoGame (MonoGameProgram, MiboGame) |
Mibo.MonoGame.Adaptive |
Adaptive host for MonoGame (AdaptiveMonoGameProgram) |
MVU games reference Mibo.Raylib.Mvu or Mibo.MonoGame.Mvu; adaptive games reference Mibo.Raylib.Adaptive or Mibo.MonoGame.Adaptive (which bring the kernel, shell, and Mibo.Adaptive transitively). All namespaces and type names are unchanged from previous releases — the split only moves code between packages.
Getting started
Prerequisites:
- .NET SDK 8 or later
- A working OpenGL setup
dotnet --version
dotnet tool restore
dotnet restore
dotnet build
dotnet test
To build the docs site locally:
dotnet tool restore
dotnet fsdocs build
# or for live editing:
dotnet fsdocs watch
Samples
The samples are stored in a separate repository: Mibo.Samples.
You'll find examples of:
2D:
- PlatformerSample - A 2D side-scrolling platformer with procedural world generation, sprite animation, lighting, particles, and sound. Uses Mibo's Elmish architecture with
InputMap,AnimatedSprite,CellGrid2D, andLightContext2D.- Mibo.Raylib targeting Desktop OpenGL
- Mibo.MonoGame targeting DesktopGL (cross-platform)
- SpaceBattle - A turn-based tactical strategy game on a hex grid with fog of war, laser combat, particle effects, faction-based turns (Human + AI), and animated unit movement. Demonstrates complex game state management, hex grid spatial queries, and multi-phase turn resolution.
- Mibo.Raylib targeting Desktop OpenGL
- PingPong - A networked multiplayer Pong game with a client-server architecture over WebSockets. The server runs game logic and broadcasts state; the client renders locally and sends input.
- Mibo.Raylib Client
- Mibo.MonoGame Client
- dotnet app acting as a server running Mibo.Mvu's headless support
3D:
ThreeDSample - A 3D platformer with procedurally generated voxel terrain, PBR lighting, shadow atlas, 3D character animation, minimap overlay, and physics. Showcases Mibo's
Renderer3D,ForwardPbrPipeline, andAnimation3DState.- Mibo.Raylib targeting Desktop OpenGL
- Mibo.MonoGame targeting DesktopGL (cross-platform)
FPSSample - A first-person shooter featuring enemy AI, weapon systems, health management, and atmospheric lighting. Demonstrates Mibo's composable systems architecture with per-system sub-models, event-driven cross-system communication, and a
Systempipeline with snapshot barriers.- Mibo.Raylib targeting Desktop OpenGL
- Mibo.MonoGame targeting DesktopGL (cross-platform)
- Mibo.MonoGame targeting WindowsDX (Windows only, DirectX)
License
Mibo is distributed under the zlib/libpng License.
Built on
Mibo is built on top of:
- raylib — the cross-platform graphics library that powers the raylib backend's rendering, input, and audio layers
- raylib-cs — the C# bindings that make raylib accessible from .NET
- MonoGame — the cross-platform framework that powers the MonoGame backend (DesktopGL/OpenGL and WindowsDX/DirectX)
- AdaptiveSlop — the pull-based incremental computation library by TheAngryByrd that Mibo.Adaptive was adopted from
Mibo.Adaptive originated from AdaptiveSlop — adopted in its entirety, renamed, and maintained as part of Mibo.
Feedback
Issues and PRs are very welcome. If you're interested in using F# for game development beyond simple 2D games, Mibo aims to be a practical, batteries-included framework that scales with your ambition.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FSharp.Core (>= 10.1.400)
- Mibo.Adaptive.Mibo (>= 5.1.0)
- Mibo.MonoGame (>= 5.1.0)
-
net8.0
- FSharp.Core (>= 10.1.400)
- Mibo.Adaptive.Mibo (>= 5.1.0)
- Mibo.MonoGame (>= 5.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
### Added
- **Core:** the portable audio contract (`Mibo.Audio`). `Voice` carries the per-play knobs — volume, pan, and pitch as a speed multiplier (1.0 = normal) — and both backends clamp the knobs to the same ranges, so an out-of-range value behaves identically instead of crashing one backend. The `IAudio` service plays overlapping sound effects by key, drives the single looping music channel (play, pause, seek, position, live volume, fades), exposes the music slider value that fade-ins return to, and sets a master volume that scales the whole mix, music included. `Attenuation2D.compute` pans and fades a sound from 2D listener and source positions. Keys are game vocabulary ("jump", "overworld"); playing an unregistered key plays nothing, so headless runs and tests need no audio device. There are no mix groups: a sound-effect "bus" is model state the game multiplies into the voice, and music is one channel with one live knob. Every windowed host registers `IAudio` before user `init` runs, advances it once per frame, and disposes it on shutdown.
- **Raylib:** the audio service behind `IAudio`. Sounds register by file path (resolved against the program's asset base path); each key layers up to 8 overlapping plays through slots that share one copy of the sample data, so overlap costs no extra audio memory. Music streams from disk. WAV, OGG, MP3, FLAC, and QOA load from loose files.
- **MonoGame:** the audio service behind `IAudio`, where each bank entry names its source: `Pipeline` loads an MGCB asset (the guaranteed path; a missing asset throws at startup) and `File` loads a loose WAV sound effect or a decoder-backed music file. Playback slots are created on a key's first plays, so a large bank costs no platform voices until its keys actually play. `MonoGameAudio` adds 3D audio: set the listener (the camera is the usual choice), play sounds positioned with distance falloff, panning, and Doppler shift, and tune `DistanceScale`/`DopplerScale`; live plays re-attenuate as the listener moves.
- **MVU:** `Audio` commands — play and layer sound effects with per-play volume/pan/pitch (`play`, `playWith`, `stopAll`), drive the music channel (`playMusic`, `playMusicOnce`, `stopMusic`, `pauseMusic`, `resumeMusic`, `seekMusic`, `setMusicVolume`, `fadeMusicIn`, `fadeMusicOut`), and set the master volume (`setMasterVolume`). Every command plays nothing when no audio service is registered, so headless runs and tests need nothing. `RaylibProgram.withBank` / `MonoGameProgram.withBank` declare the whole sound bank as one list value (a literal or a generated one) that loads before user `init` runs.
- **Adaptive:** the same audio surface on the context — `ctx.Audio.play("jump")` plus the full music set — which plays nothing without a registered audio service. `AdaptiveRaylibProgram.withBank` / `AdaptiveMonoGameProgram.withBank` declare the sound bank as one list value that loads before the program's `Init`.