Universe Library for OCaml

December 30, 2018

News

1  What is the Universe Library for OCaml?

Racket has a wonderful universe teachpack for writing interactive games. For quick introduction, see a draft but wonderfully written textbook How to Design Worlds (for non-communicating games). For thorough introduction, see the 2nd edition of How to Design Programs.

The Universe Library for OCaml provides similar interface in OCaml, so that one can enjoy writing interactive games in OCaml.

2  Environments

We are developing the Universe Library using the following environments:

3  Setting up

You need to have X11, gtk2, gnomecanvas, lablgtk2, and OCamlMakefile. We do as follows:

4  Installation

Via OPAM:
opam pin add universe https://github.com/kenichi-asai/Universe.git
Or you can do it manually:

5  Module interface: English, Japanese

6  Sample games

Non-communicating ball game (source: ball-game1)
Click balls to make them all smallest.
Communicating ball game (source: ball-game2)
Click the others' balls. When your balls all become smallest, you lose.

7  Create your own games

non-communicating games
communicating games

8  Create a toplevel with the Universe Library

If you installed the library via OPAM:
ocamlfind ocamlmktop -package universe,findlib -linkpkg -o universe.top
and you will obtain universe.top. To launch the toplevel, simply type:
./universe.top
and then in the toplevel:
#require "universe" ;;
Otherwise,
ocamlfind ocamlmktop -package cairo2-gtk,unix -linkpkg -I ../../library socket.cma color.cma image.cma world.cma -o universe.top
To launch the toplevel, you need to specify the library path:
./universe.top -I ../../library
(But currently, the argumet -I ../../library is interpreted by World module and does not work. Hmm.)

9  Known issues

10  Papers

11  Members


This document was translated from LATEX by HEVEA.