Skip to content

Commit 0e46e4a

Browse files
authored
Merge pull request #2 from AngelMunoz/chore/testing
chore: add tests missing from port initial effort and rendering mechanisms
2 parents c01fbc4 + a205fc4 commit 0e46e4a

13 files changed

Lines changed: 4490 additions & 167 deletions

File tree

.github/workflows/docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
- name: Restore dependencies
3838
run: dotnet restore
3939

40+
- name: Run Tests
41+
run: dotnet test --configuration Release --no-restore
42+
4043
- name: Build Library
4144
run: dotnet build src/Mibo.Raylib -c Release
4245

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ jobs:
7272
if: steps.check_tag.outputs.exists == 'false'
7373
run: dotnet restore
7474

75+
- name: Run Tests
76+
if: steps.check_tag.outputs.exists == 'false'
77+
run: dotnet test --configuration Release --no-restore
78+
7579
- name: Build
7680
if: steps.check_tag.outputs.exists == 'false'
7781
run: dotnet build --configuration Release --no-restore

README.md

Lines changed: 21 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,29 @@
44
55
Following that spirit, Mibo.Raylib 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.
66

7-
Mibo.Raylib is a port of the [Mibo](https://github.com/AngelMunoz/Mibo) micro-framework from **MonoGame** to **raylib-cs**, designed to allow **F#** developers to write games using familiar Elmish patterns for all kinds of game genres and sizes — no Content Pipeline, no `.mgcb` files.
7+
Mibo.Raylib is a port of my first attempt at this [Mibo](https://github.com/AngelMunoz/Mibo) micro-framework from **MonoGame** to **raylib-cs**, designed to allow **F#** developers to write games using familiar Elmish patterns for all kinds of game genres and sizes.
88

9-
Mibo aims to solve 90% 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.
9+
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.
1010

1111
## What's in the box?
1212

1313
- **Elmish runtime** (MVU loop) with `Cmd`, `Sub`, optional **fixed timestep**, and **frame-bounded dispatch**
1414
- **Input** — raw input (`Keyboard`, `Mouse`) + semantic mapping via `InputMap` / `ActionState`
15-
- **Assets** — texture, font, sound, and model loading with dictionary-based caches (no Content Pipeline)
16-
- **Rendering**`IRenderer<'Model>` and `RenderBuffer<'Key, 'Cmd>`:
15+
- **Assets** — texture, font, sound, and model loading caches
16+
- **Rendering**Command buffer based rendering:
1717
- 2D batch renderer with layers and multi-camera support
1818
- 3D batch renderer with opaque/transparent passes and custom shader switching
19-
- Escape hatches (`DrawCustom`) for custom GPU work
20-
- **Camera** helpers (`Camera2D`, `Camera3D`) with screen-to-world, orbit, and ray casting
19+
- Escape hatches for custom GPU work
20+
- **Camera** helpers with screen-to-world, orbit, and ray casting
2121
- **Layout** — 2D procedural grid layout (`CellGrid2D`) with platformer, top-down, and geometric primitives
2222
- **Layout3D** — 3D voxel-style grid layout (`CellGrid3D`) with terrain, interior rooms, corridors, stairs, and procedural generation
2323
- **Animation** — sprite sheet slicing, `AnimatedSprite` state machines, and grid-based animation definitions
24-
- **Input Mapper** — push-based input mapping via reactive `IInput` observables
25-
26-
## Documentation
27-
28-
The docs live in `docs/` and are the authoritative reference.
29-
30-
| Topic | File |
31-
|-------|------|
32-
| Elmish runtime | `docs/elmish.md` |
33-
| System pipeline (phases + snapshot) | `docs/system.md` |
34-
| Scaling ladder | `docs/scaling.md` |
35-
| Input | `docs/input.md` |
36-
| Assets | `docs/assets.md` |
37-
| Camera | `docs/camera.md` |
38-
| Animation | `docs/animation.md` |
39-
| Layout (2D) | `docs/layout.md` |
40-
| Layout3D | `docs/layout3d.md` |
41-
| Culling | `docs/culling.md` |
42-
| Commands | `docs/commands.md` |
43-
44-
To build the docs site locally:
45-
46-
```bash
47-
dotnet tool restore
48-
dotnet fsdocs build
49-
# or for live editing:
50-
dotnet fsdocs watch
51-
```
24+
- **Input Mapper** — Listen to raw input and map it to semantic actions
5225

5326
## Getting started
5427

5528
Prerequisites:
29+
5630
- **.NET SDK 8** or later
5731
- A working OpenGL setup
5832

@@ -64,49 +38,32 @@ dotnet build
6438
dotnet test
6539
```
6640

41+
To build the docs site locally:
42+
43+
```bash
44+
dotnet tool restore
45+
dotnet fsdocs build
46+
# or for live editing:
47+
dotnet fsdocs watch
48+
```
49+
6750
### Run the samples
6851

6952
**2D Platformer:**
53+
7054
```bash
7155
dotnet run --project samples/PlatformerSample
7256
```
57+
7358
Controls: **WASD / Arrows** to move, **Space** to jump, **R** to respawn.
7459

7560
**3D Platformer:**
61+
7662
```bash
7763
dotnet run --project samples/ThreeDSample
7864
```
79-
Controls: **WASD** (camera-relative), **Space** to jump.
80-
81-
## Project structure
8265

83-
```
84-
src/
85-
├── Mibo.Raylib/ # Core framework library
86-
│ ├── Elmish.*.fs # MVU runtime (Cmd, Sub, Time, Program, System)
87-
│ ├── Graphics2D.fs # 2D render commands + batch renderer
88-
│ ├── Graphics3D.fs # 3D render commands + batch renderer
89-
│ ├── Input.fs # Raw input polling (Keyboard, Mouse)
90-
│ ├── InputMapper.fs # Reactive input mapping (IInput, ActionState)
91-
│ ├── Camera.fs # Camera2D, Camera3D, Ray
92-
│ ├── Animation.fs # Sprite sheets, animated sprite state
93-
│ ├── Culling.fs # Frustum / quadtree culling
94-
│ ├── Layout/ # 2D grid layout (CellGrid2D, platformer, top-down)
95-
│ └── Layout3D/ # 3D voxel layout (CellGrid3D, terrain, interior)
96-
├── Mibo.Raylib.Tests/ # Unit tests (Expecto, 110+ tests)
97-
samples/
98-
├── PlatformerSample/ # 2D platformer sample
99-
└── ThreeDSample/ # 3D platformer sample
100-
docs/ # Documentation source (fsdocs)
101-
```
102-
103-
## Design principles
104-
105-
- **Pure `update`** — keep your model logic functional and testable
106-
- **Declarative `view`** — submit render commands to a `RenderBuffer` rather than calling draw functions directly
107-
- **Ladder of complexity** — start with simple sprites, progressively adopt shaders, lighting, and post-processing without rewrites
108-
- **Zero-cost abstractions** — structs, arrays, `ArrayPool`, and `InlineIfLambda` where performance matters
109-
- **No Content Pipeline** — all assets loaded at runtime from loose files
66+
Controls: **WASD** (camera-relative), **Space** to jump.
11067

11168
## License
11269

docs/index.md

Lines changed: 19 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Mibo.Raylib is a lightweight, Elmish-based game framework built on top of raylib
1616

1717
To get started with Mibo.Raylib, you need the [dotnet SDK](https://get.dot.net) installed.
1818

19+
> **NOTE:** Mibo.Raylib is currently in early development. NuGet packages are not yet available, but you can clone the repository and run the samples to see it in action.
20+
1921
Start by cloning the repository and running one of the samples:
2022

2123
```bash
@@ -42,71 +44,23 @@ You can then start building your game using any of the following:
4244

4345
## Why Mibo.Raylib?
4446

45-
Traditional game engines often rely heavily on mutable state and complex object hierarchies. Mibo.Raylib offers an alternative:
46-
47-
- **Functional First**: Write your game logic as pure functions that transform state.
48-
- **Predictable State**: The entire game state (the Model) is centralized and immutable.
49-
- **Elmish Architecture**: Leverage the robust MVU pattern for clear separation of concerns.
50-
- **raylib Power**: Benefit from the performance and simplicity of raylib.
51-
- **Deferred Rendering**: Built-in 2D and 3D batchers that handle sorting and lighting for you.
52-
53-
## Core Patterns
54-
55-
### The Elmish Loop
56-
57-
Shader-based multi-pass rendering. Every Mibo.Raylib game follows a simple loop:
58-
59-
1. **Init**: Define your initial state.
60-
2. **Update**: Purely calculate the next state based on messages (input, timers, etc.).
61-
3. **View**: Describe what should be rendered based on the current state.
62-
4. **Subscribe**: Listen to external events like keyboard or touch input.
63-
64-
### Semantic Input Mapping
65-
66-
Instead of checking for specific keys in your player logic, Mibo.Raylib encourages mapping keys to **Actions**. This allows for easy input rebinding and multi-device support.
67-
68-
### Deferred Batched Rendering
69-
70-
All rendering is deferred into a `RenderBuffer`, sorted by layer, and executed in a single pass per renderer. This enables efficient 2D lighting and post-processing without coupling render logic to the update loop.
71-
72-
## Getting Started
73-
74-
Run one of the samples, then copy its program setup (composition root) into your own project.
75-
76-
## Documentation
77-
78-
- Architecture
79-
- [Elmish (MVU) runtime](elmish.html)
80-
- [Programs & composition](program.html)
81-
- [System pipeline (phases + snapshot)](system.html)
82-
- [Service composition](services.html)
83-
- [Scaling Mibo.Raylib (Simple → Complex)](scaling.html)
84-
- [F# For Perf](performance.html)
85-
86-
- Rendering
87-
- [Rendering Overview](rendering.html)
88-
- [Camera](camera.html)
89-
- [Shaders](shaders.html)
90-
- [Culling](culling.html)
91-
- [2D Rendering](graphics2d/overview.html)
92-
- [3D Rendering](graphics3d/overview.html)
93-
94-
- Input
95-
- [Input (raw + mapped)](input.html)
96-
97-
- Assets
98-
- [Assets (loading + caching)](assets.html)
99-
100-
- Amenities
101-
- [Animation](animation.html)
102-
103-
- Patterns
104-
- [Patterns Overview](patterns/overview.html)
105-
- [Composable Systems](patterns/composable-systems.html)
106-
- [Background Work](patterns/background-work.html)
107-
- [Pooled Particles](patterns/pooled-particles.html)
108-
- [Layered Rendering](patterns/layered-rendering.html)
109-
- [Pre-computed State](patterns/precomputed-state.html)
47+
Traditional game engines often rely heavily on complex object hierarchies, vendor specific tooling and no specific architecture guidance. Mibo.Raylib offers an alternative:
48+
49+
- **Functional First**
50+
- Write your game logic as pure functions that transform state.
51+
- When you grow enough you adopt mutable state in a predictable way to squeeze out more performance, but you can start simple and keep it pure as long as you want.
52+
- F# inline, compiler optimizations around functions, byrefs, structs and value types allow you to write high-level code without sacrificing performance.
53+
- **Predictable State**
54+
- The MVU architecture enforces a clear separation of concerns with a single source of truth for your game state, making it easier to reason about and debug.
55+
- The unidirectional data flow ensures that state changes are predictable and traceable, which is especially beneficial in complex game logic.
56+
- **Elmish Architecture**
57+
- A well-known architecture in the F# community with a twist for games.
58+
- **raylib Power**
59+
- Built on top of raylib, a simple and easy-to-use library to enjoy videogames programming.
60+
- Cross-platform support and a rich set of features for graphics, input, audio, and more.
61+
- **Deferred Rendering**
62+
- Be ready for efficient lighting and post-processing effects without coupling your render logic to the update loop.
63+
- Be ready for networked games with client-side prediction and server reconciliation without coupling your game logic to the rendering.
11064

11165
## Built on
11266

0 commit comments

Comments
 (0)