About MariOCaml
MariOCaml was created at Cornell University by Matthew Hsu, Liam Bui and Ashley Xue as a final project for a functional programming course, and it grew into one of the most popular OCaml projects on GitHub.
The whole game — physics, enemies, items, the camera and the renderer — is written in OCaml and cross-compiled to JavaScript with js_of_ocaml, so it runs in a normal web page. Underneath is a “director” that owns the game state and runs the main loop, while a procedural generator builds each level on a grid, taking care to keep it playable.
The result looks like a SNES-era Mario game with a twist: every time you load it you get a different arrangement of brick towers, coin clouds and Koopa troopas. Some layouts are elegant, some are chaotic — that is the charm of a random level.
Controls
| Input | Action |
|---|---|
| ← → or A D | Move |
| Space, ↑ or W | Jump |
| ↓ or S | Duck |
Features
- Written 100% in the functional language OCaml
- Random level generator that places blocks, coins, enemies and gaps
- Score, coin counter, game over and game win screens
- Particle effects when blocks break and enemies are stomped
Tips
- The counter in the top-left corner is the frame rate, not a timer — take your time.
- Shells can be kicked into other enemies for a chain of points.
- If a level generates in an awkward way, reload the frame with the restart button for a new layout.


