This is exploration platformer game written in OCaml. It was done as an experiment to train my functional programming skills and create a non-trivial interactive application in a fuctional language. Also contained is a full featured level editor. It was my final project for the Functional Programming course during 2014/15 at Univerity of Wrocław.
Prerequisites:
OCaml (4.01.0)
withocamlopt
,ocamlbuild
,ocamlfind
- OCaml packages:
core (111.28.01)
,ocamlsdl (0.9.1)
SDL 1.2
withSDL_ttf
andSDL_image
.
If you install OCaml packages using opam
, make sure you have the SDL library, along with the addons,
already installed before you start installing ocamlsdl
. The version numbers provided in brackets
are the ones I used on my machine, some older verstions may or may not work.
To compile, use the shell script make
, i.e., to build the game application, invoke ./make game
(not to
be confused with make game
), to build the editor, use ./make editor
. To build everything and clean
the intermediate files, you can invoke ./make game editor clean
.
On systems other than Linux or OS X, you may peek inside the make
script and try to figure it out yourself.
This shouldn't be complicated, but I didn't try it on, e.g., Windows.
The key bindings in the game are as follows:
- Left/Right arrows: Move around
- Space: Jump
While in the editor:
- WASD keys: Change the active tile stamp
- Up/Down arrows: Change the active layer
- Shift + Up/Down: Reorder layers
- E: Display only the active layer
- Return: Show terminal
- Right mouse button: Place a tile
- Mouse move while RMB down: Drag backgrund image
- Shift + Mouse move while RMB down: Drag camera
Most operations in the editor are available only through the built-int mini terminal. The terminal is activated with Return and the commands are confirmed with Return or rejected with Esc. The following commands are recognized:
new <room_name> <row_cnt> <column_cnt>
: Create a new roomload <room_name>
: Open an existing room filesave [<room_name>]
: Save the room. Uses current name if none specified.mode obj
ormode world
: Switch between editing of objects (mobs) and world (tiles, bg, etc.)show tiles
orhide tiles
: Show or hide the physical layeradd uniform layer <r> <g> <b>
: Add a background layer with a uniform coloradd image layer <image_name>
: Add an image background usingdata/backgrounds/<image_name>.png
add tiled layer
: Add a tiled layerrem layer
: Remove active layerset repeat <repeat>
: Set the repeat pattern of an image layer; ca be:xy
,x
,y
, or-
set parallax <number>
: Set parallax of an image layeradd obj <obj_kind>
: Add an object of the specified kind. The kinds are roughly the names of the files residing insrc/minds
without the.ml
extension.set name <name>
: Set the name of the active objectedit init
: Edit the init structure of the active objectrem obj
: Remove the active object
Some command work only if in certain mode (obj or world) or for certain kinds of layers.
The game is autosaved. If you want to start from the beginning, just remove the continue.save
file from
data/saves
.