# \[ANN\] 2nd release elm\_playground (a game engine for beginners)

**URL:** https://discuss.ocaml.org/t/ann-2nd-release-elm-playground-a-game-engine-for-beginners/18552
**Category:** Learning
**Tags:** announce
**Created:** [September 22, 2026, 2:04pm UTC](https://discuss.ocaml.org/t/ann-2nd-release-elm-playground-a-game-engine-for-beginners/18552 "2026-09-22T14:04:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![aryx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/aryx/32/2356_2.png) [@aryx](https://discuss.ocaml.org/u/aryx)
#### Post date: [September 22, 2026, 2:04pm UTC](https://discuss.ocaml.org/t/ann-2nd-release-elm-playground-a-game-engine-for-beginners/18552/1 "2026-09-22T14:04:46Z")

</div>

It is my pleasure, again, to announce the second release of `elm_playground`, an OCaml package that allows you to easily create _pictures_, _animations_, and even _video games_ in a portable way using an API that really simplifies how to view the computer and its devices (the screen, keyboard, and mouse). The library offers a native backend to run the games from a terminal and a web backend to run the games in your browser.

This is a port of the excellent Elm playground package  
[GitHub - evancz/elm-playground: Create pictures, animations, and games with Elm! · GitHub](https://github.com/evancz/elm-playground) to OCaml.

You can install it via OPAM via

`opam install elm_playground; opam install elm_playground_native`.

The main changes are most of the bugs in the first release have been fixed (mostly by Claude Code), and that now the native and web backend are fully working on all the examples and games. Here is for instance how to play Tetris compiled by jsoo:

[https://aryx.github.io/ocaml-elm-playground/games/Tetris.html](https://aryx.github.io/ocaml-elm-playground/games/Tetris.html)

Here are a few examples of code using the library.

First a “picture” app:

```auto
(* from https://elm-lang.org/examples/picture *)
open Playground

let app =
  picture [
    rectangle brown 40. 200.
      |> move_down 80.;
    circle green 100.
      |> move_up 100.;
  ]

let main = Playground_platform.run_app app

```

 ![example-picture](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/7/76fc1990fe116911097764df986f64fed41c28a4.png)

Then an “animation” app:

```auto
(* from https://elm-lang.org/examples/animation *)
open Playground

let view time = [
    octagon darkGray 36.
      |> move_left 100.
      |> rotate (spin 3. time);
    octagon darkGray 36.
      |> move_right 100.
      |> rotate (spin 3. time);
    rectangle red 300. 80.
      |> move_up (wave 50. 54. 2. time)
      |> rotate (zigzag (-. 2.) 2. 8. time);
  ]

let app =
  animation view

let main = Playground_platform.run_app app

```

 ![example-animation](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/e/e91563cbb6a0863570bbb19b057f5e8dae7164bf.png)

And finally a “game” app:

```auto
(* from https://elm-lang.org/examples/mouse *)
open Playground

let view _computer (x, y) = [ 
  square blue 40.
   |> move x y
 ]

let update computer (x, y) =
  (x +. to_x computer.keyboard, y +. to_y computer.keyboard)

let app = 
  game view update (0., 0.)

let main = Playground_platform.run_app app

```

 ![example-keyboard](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/2/24e8ffe672cda66c6a49e02013347cda0640f771.png)

Note that you can write more complex games. For example here is a screenshot of a toy tetris app:

 ![game-tetris](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/4/4ded1d55c9994935c5ec3786ae549ba3a71b8eb6.png)

For more information, follow the README at [GitHub - aryx/ocaml-elm-playground: Port of the Elm playground package to OCaml to make pictures, animations, and even video games easily. · GitHub](https://github.com/aryx/ocaml-elm-playground)

See also the code of some classic examples and try them online thx to jsoo: [index](https://aryx.github.io/ocaml-elm-playground/games/)
