Mibo.Raylib 4.0.0-rc-001

This is a prerelease version of Mibo.Raylib.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Mibo.Raylib --version 4.0.0-rc-001
                    
NuGet\Install-Package Mibo.Raylib -Version 4.0.0-rc-001
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mibo.Raylib" Version="4.0.0-rc-001" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mibo.Raylib" Version="4.0.0-rc-001" />
                    
Directory.Packages.props
<PackageReference Include="Mibo.Raylib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mibo.Raylib --version 4.0.0-rc-001
                    
#r "nuget: Mibo.Raylib, 4.0.0-rc-001"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Mibo.Raylib@4.0.0-rc-001
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mibo.Raylib&version=4.0.0-rc-001&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Mibo.Raylib&version=4.0.0-rc-001&prerelease
                    
Install as a Cake Tool

Mibo

Install the templates:

dotnet new install Mibo.Templates
dotnet new mibo-2d -o MyGame
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 via InputMap / 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, AnimatedSprite state machines, and grid-based animation definitions
  • Input Mapper — Listen to raw input and map it to semantic actions

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, and LightContext2D.
    • 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.Core'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, and Animation3DState.

    • 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 System pipeline 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)

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Mibo.Raylib:

Package Downloads
Mibo.Raylib.Adaptive

Package Description

Mibo.Raylib.Mvu

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.0.0 203 10/20/2026
6.0.0 160 10/7/2026
5.1.0 189 9/5/2026
5.0.0 184 9/5/2026
4.5.3 142 9/1/2026
4.5.2 140 8/28/2026
4.5.1 156 8/22/2026
4.5.0 128 8/19/2026
4.4.0 157 8/18/2026
4.3.0 163 8/16/2026
4.2.0 156 8/12/2026
4.1.0 142 8/10/2026
4.0.0 155 8/7/2026
4.0.0-rc-003 136 8/3/2026
4.0.0-rc-002 153 8/3/2026
4.0.0-rc-001 127 8/2/2026
4.0.0-beta-001 133 7/28/2026
3.3.0 149 7/26/2026
3.2.0 170 7/25/2026
3.1.1 156 7/23/2026
Loading failed

### Added

- **Core, MonoGame 3D, Raylib 3D:** bone pose queries and attachment draws for animated models. The new `BoneRef` type (`ByName` / `ByIndex`) addresses a bone; `Animation3DState.computePose` and `AnimatedModel.computePose` evaluate the pose once per frame into a `BonePose` (per-bone world transforms plus the skinning palette) that bone queries (`AnimatedModel.tryGetBoneWorld`, `BonePose.worldAt`/`tryGetWorld`) and the new `buffer.attachedMesh(animModel, bone, localTransform, mesh, material, transform, ?pose)` member share with the skinned draw. Evaluation is allocation-free after warmup. Attachments compose as `localTransform * boneWorld * transform` and inherit the instance's full world transform including scale; missing bones are never an error — queries return `ValueNone` and attachment draws emit nothing. `AnimatedMesh` now retains a bone name→index lookup (plus bone names/parents on raylib) for `ByName` resolution. See `docs/animation3d.md`.
- **Core, MonoGame 3D, Raylib 3D:** `buffer.animatedModel`/`animatedModelWith`/`animatedModelWithPerMesh` take an optional `pose` parameter so one pose evaluation per frame serves the draw plus any bone queries and attachment draws; omitting it keeps the previous behavior. **Breaking (binary):** adding an optional parameter changes the compiled (IL) signature of these members — existing source compiles unchanged, but assemblies compiled against a previous Mibo version must be recompiled.
- **Raylib 3D:** the new `AnimatedModel` record (shared mesh + per-entity state) is an opt-in GPU skinning path for `animatedModel`: it draws through the GPU-skinned path with a per-instance palette instead of mutating the model via `UpdateModelAnimation`, so the same model can be drawn with several different poses in one frame, and the `pose` parameter is honored. Passing a bare `Animation3DState` keeps the legacy mutating path unchanged (and ignores `pose`).
- **Raylib 3D:** `Animation3DClips.merge` combines animation clips loaded from several files into one clip set, remapping each clip's keyframe poses by bone name when a source file's skeleton orders bones differently than the model being animated (e.g. KayKit's MovementBasic vs General rigs, where left/right sides are swapped — without the remap those clips play mirrored). Companion helpers `Animation3DClips.boneNamesOf` and `Animation3DClips.buildBoneRemap` expose the pieces. MonoGame needs no equivalent — its clip channels are keyed by bone name. See `docs/animation3d.md` → "Loading clips from multiple files".
- **Raylib 3D:** the GPU skinning path (`AnimatedModel`) now supports `animatedModelWithPerMesh` (per-mesh material resolver), matching the legacy mutating path and the MonoGame backend.
- **MonoGame 3D, Raylib 3D:** skinned + instanced draws. `buffer.animatedModelInstanced(animModel, transforms, poses, ?material, ?colors)` draws N instances of the same animated model in one draw call (per sub-mesh), each instance with its own world transform and bone pose. `poses` carries one caller-evaluated `BonePose` per instance — compute poses once per frame and share them with bone queries and attachment draws. A pose palette must cover the model's bones: a shorter one raises an `ArgumentException` instead of silently corrupting the following instances' poses, and extra entries beyond the bone count are ignored. `material` is an optional `MaterialOverride` (`All` / `PerMesh`); `colors` (MonoGame only) tints each instance. Per-instance bone palettes are uploaded once per frame as a texture the vertex shader samples (raylib indexes it by `gl_InstanceID`), shared between the shadow and forward passes. The per-instance world rows are likewise staged once per frame and shared between the passes (DX11/Vulkan); on DX12 the forward/depth group budgets differ, so world-row staging stays per pass there. On DX12 — where the native runtime has no vertex texture fetch — palettes ride a per-group constant array instead, and draws are chunked into groups of `448 / boneCount` instances in the forward pass and `500 / boneCount` in the shadow pass (elsewhere, chunks of 2048); models with more than 448 bones fall back to per-instance skinned draws there (correct, but no batching win). The group budgets ride the effect's `$Globals` Int16 size cap (32767 bytes): 448×64 + 3156 bytes of lights/shadows/material uniforms in the forward effect, 500×64 + 132 bytes in the depth effect — the depth effect affords larger groups because it carries no lighting uniforms. **OpenGL note:** the MonoGame OpenGL backend has no vertex texture fetch either, so there the draw falls back to per-instance skinned draws (correct, but no batching win — this includes Android). Custom effects in a `beginEffect` scope can opt in via a `SkinnedInstanced` technique (MonoGame) or the `bonePalette` sampler plus bone attributes (raylib) — see `docs/shader-uniforms.md`. See `docs/animation3d.md` → "Skinned + instanced draws".
- **MonoGame 3D:** skinned + instanced draws automatically merge mesh parts that share a parent bone, vertex layout, and material into one draw per chunk — the merged geometry is built lazily on a model's first instanced draw and cached per model. A command whose materials split a group (e.g. a `PerMesh` override) falls back to per-part draws for that command, so output never changes. The static per-part data (technique references, skinned/grouped flags, the merged-group maps) is likewise resolved once per model per pipeline and cached — only the game-mutable data (bone worlds, materials, normal matrices) resolves per command, and swapping a part's `Effect` invalidates the cache so the draw follows the new effect.

### Changed

- **MonoGame 3D, Raylib 3D — Breaking (binary):** `Animation3DChannel`, `Animation3DClip`, `Animation3DClips`, and `AnimatedMesh` (MonoGame), and `AnimatedMesh` (raylib) are now `[<Struct>]` records — they previously were reference records. Besides the binary break, equality and copy semantics change to value semantics; code relying on reference identity needs review. **Breaking (source):** raylib's `AnimatedMesh` gains a `BindPose: Transform[]` field (the model-space rest pose, used as the fallback for bones a clip doesn't animate); code constructing the record literally must add the field — `AnimatedMesh.fromModel` populates it for you.
- **Raylib 3D — Breaking (behavioral):** `AnimatedMesh.computeBoneMatrices` now returns the bone palette in plain System.Numerics row-major layout (`result[i] = InverseBindPose[i] * pose[i]`) instead of pre-transposed into raylib's native layout. The framework transposes at upload time where the shader contract needs it, so palettes produced by `computeBoneMatrices` or a computed `BonePose` render unchanged. Code that feeds its own palettes to `skinnedMesh`/`DrawSkinnedMesh` must pass them in the same row-major layout — drop any manual pre-transpose, otherwise skinned meshes render distorted.
- **MonoGame 3D, Raylib 3D:** animation name lookups and pose sampling are faster. `Channels` and `ClipNames` are now frozen dictionaries, and on MonoGame a pose evaluation resolves each bone's clip channel once per (clip, mesh) pair instead of a string dictionary lookup per bone — the resolution cache reads lock-free, so parallel pose evaluation across many instances does not contend on a shared monitor. The string-keyed API is unchanged.
- **MonoGame 3D:** fewer per-frame allocations on the 3D hot paths, no API change. Instanced draws (`instanced`/`animatedModelInstanced`) no longer allocate a vertex-binding array per draw or reference tuples for effect/params selection (struct tuples now), the shadow pass builds its per-span render predicates once per pass instead of per caster region, and the bone-palette texture pool keeps up with per-frame chunk demand instead of disposing and recreating textures whenever a frame needs more than two chunks of a size.
- **MonoGame 3D:** single-camera frames walk the render buffer twice per frame instead of three times: shadow/scene-depth geometry is now collected inline in the pipeline's pre-scan, gated on the frame possibly needing it — a depth-needing post-process, or at least one shadow-casting light in the buffer (tracked by the new `RenderBuffer3D.ShadowCasterLightCount` counter, so frames with provably no caster skip collection entirely). Multi-camera-block frames are unchanged (per-block collection).
- **Raylib 3D:** the shadow-uniform upload now covers only the shader variants the frame actually draws through (usage tracked during the pre-scan) instead of all four unconditionally, and chunked transform slices for skinned-instanced draws are cut once per frame into pooled arrays (shared by the shadow and forward passes) instead of re-copied per chunk per pass. The same inline-collection walk and `ShadowCasterLightCount` gate as the MonoGame backend apply.
- **MonoGame 3D, Raylib 3D:** the forward PBR shader now samples the emission map only when the material binds one (new `useEmissionMap` uniform, mirroring `useNormalMap`) — materials without an emission map, the common case, skip a per-fragment texture read. Custom effects that declare `useEmissionMap` receive the flag from the pipeline as well.
- **MonoGame 3D, Raylib 3D:** fragments facing away from the directional light no longer sample its shadow map — their directional contribution is zero regardless, so roughly half the lit surface in a sun-lit scene skips the shadow texture reads.

### Fixed

- **Raylib 3D:** bones a clip doesn't animate (a merged clip animating only part of the skeleton, or a clip with fewer bones than the mesh) now hold their bind pose instead of collapsing to the skeleton origin with a zeroed transform — and blends no longer slerp against a zero quaternion — matching the MonoGame backend's long-standing behavior. `AnimatedMesh.computeBoneMatrices` also no longer reads past the end of the clip's native keyframe pose array when the clip has fewer bones than the mesh.
- **Raylib 3D:** GPU skinning now works with the stock raylib native library. raylib uploads the bone index/weight vertex buffers only when natively compiled with `SUPPORT_GPU_SKINNING` (off by default, including the raylib-cs NuGet builds), so skinned meshes previously rendered frozen in bind pose; `Animation3DState.create`/`AnimatedMesh.fromModel` now detect the missing buffers and upload them from managed code.
- **MonoGame 3D:** pooled 3D render targets (the post-process scene RT and the ping-pong intermediates) are now created with `RenderTargetUsage.PreserveContents`. MonoGame clears a `DiscardContents` target on every bind, so when a mid-frame pass (the scene-depth pre-pass, or a per-camera-block shadow pass) restored the caller's bindings and re-bound the scene RT, the rendered scene was wiped before post-process actions sampled it — `postProcessWithDepth` effects (fog, DOF, SSAO) received a black scene.

### Deprecated

- **Raylib, MonoGame:** the piped draw modules (`Draw`, `Draw3D`, `LightDraw`, `ParticleDraw`) now carry an `[<Obsolete>]` attribute, so code that still uses them builds with a deprecation warning (FS0044) pointing at the fluent draw DSL. The modules were announced as deprecated in 3.1.0 and remain functional; they will be removed in a future release. See `docs/draw-dsl.md` → "Migrating from the piped DSL".