The helm package

[Tags: library, mit]

A functionally reactive game engine, with headgear to protect you from the headache of game development provided.


[Skip to ReadMe]

Properties

Versions0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.4, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1 (info)
Change logNone available
Dependenciesbase (==4.*), cairo (>=0.12 && <1), containers (>=0.5 && <1), elerea (>=2.7 && <3), filepath (>=1.3 && <2), mtl (==2.1.*), pango (>=0.12 && <1), random (>=1.0.1.1 && <1.2), SDL (>=0.6 && <1) [details]
LicenseMIT
Copyright(c) 2013, Zack Corr
AuthorZack Corr
MaintainerZack Corr <zack@z0w0.me>
CategoryGame Engine, FRP
Home pagehttp://github.com/z0w0/helm
Bug trackerhttp://github.com/z0w0/helm/issues
Source repositoryhead: git clone git://github.com/z0w0/helm.git
UploadedSun Nov 3 13:05:49 UTC 2013 by ZackCorr
DistributionsNixOS:0.7.1
Downloads2119 total (75 in last 30 days)
Votes
0 []
StatusDocs available [build log]
Successful builds reported [all 2 reports]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for helm-0.5.0

<p align="center"> <a href="http://helm-engine.org" title="Homepage"><img src="http://helm-engine.org/img/logo-alt.png"/></a> </p>

Introduction

Helm is a functionally reactive game engine written in Haskell and built around the Elerea FRP framework. Helm is heavily inspired by the Elm programming language (especially the API). All rendering is done through a vector-graphics based API. At the core, Helm is built on SDL and the Cairo vector graphics library.

In Helm, every piece of input that can be gathered from a user (or the operating system) is hidden behind a signal. For those unfamiliar with FRP, signals are essentially a value that changes over time. This sort of architecture used for a game allows for pretty simplistic (and in my opinion, artistic) code.

Documentation of the Helm API is available on Hackage. There is currently a heavily work-in-progress guide on Helm's website, which is a resource aiming to give thorough explanations of the way Helm and its API work through examples. You can ask on the mailing list if you're having any trouble with using the engine for games or working on the engine itself, or if you just want to chit-chat about Helm.

Features

Example

The simplest example of a Helm game that doesn't require any input from the user is the following:

import FRP.Helm
import qualified FRP.Helm.Window as Window

render :: (Int, Int) -> Element
render (w, h) = collage w h [move (100, 100) $ filled red $ square 64]

main :: IO ()
main = run defaultConfig $ render <~ Window.dimensions

It renders a red square at the position (100, 100) with a side length of 64.

The next example is the barebones of a game that depends on input. It shows how to create an accumulated state that depends on the values sampled from signals (e.g. mouse input). You should see a white square on the screen and pressing the arrow keys allows you to move it.

import FRP.Helm
import qualified FRP.Helm.Keyboard as Keyboard
import qualified FRP.Helm.Window as Window

data State = State { mx :: Double, my :: Double }

step :: (Int, Int) -> State -> State
step (dx, dy) state = state { mx = (realToFrac dx) + mx state,
                              my = (realToFrac dy) + my state }

render :: (Int, Int) -> State -> Element
render (w, h) (State { mx = mx, my = my }) =
  centeredCollage w h [move (mx, my) $ filled white $ square 100]

main :: IO ()
main = run defaultConfig $ render <~ Window.dimensions ~~ stepper
  where
    state = State { mx = 0, my = 0 }
    stepper = foldp step state Keyboard.arrows

Checkout the demos folder for more examples.

Installing and Building

Helm requires GHC 7.6 (Elerea doesn't work with older versions due to a compiler bug). To install the latest (stable) version from the Hackage repository, use:

cabal install helm

Alternatively to get the latest development version, you can clone this repository and then run:

cabal install

You may need to jump a few hoops to install the Cairo bindings (which are a dependency), which unfortunately is out of my hands. Read the installing guide on the website for a few platform-specific instructions.

License

Helm is licensed under the MIT license. See the LICENSE file for more details.

Contributing

Helm would benefit from either of the following contributions:

  1. Try out the engine, reporting any issues or suggestions you have.
  2. Look through the source, get a feel for the code and then contribute some features or fixes. If you plan on contributing code please submit a pull request and follow the formatting styles set out in the current code: 2 space indents, documentation on every top-level function, favouring monad operators over do blocks when there is a logical flow of data, spaces between operators and after commas, etc. Please also confirm that the code passes under HLint.

The following is a list of major issues that need to be tackled in the future: