This is a Haskell Space Invaders game implemented using the Functional Reactive Programming library Yampa.
The game has been created for educational purposes, but tries to feature a substantial amount of the complexity often found in real arcade games. For example, differentiated subsystems for physics/collisions, input, rendering/multimedia, logic, etc.
The game is available on hackage and you can install it with*:
$ cabal update
$ cabal install SpaceInvaders
$ export PATH="$HOME/.cabal/bin:$PATH"
$ spaceInvaders
If you want to explore the code and possibly make changes, do the following:
$ cabal update
$ cabal unpack SpaceInvaders # or git clone https://github.com/ivanperez-keera/SpaceInvaders.git
$ cd SpaceInvaders* # Game resources are here
$ cabal install
$ export PATH="$HOME/.cabal/bin:$PATH"
$ spaceInvaders
*Additional notes: For the use of the above installation instructions you need GHC and the command-line interface for cabal. On debian/ubuntu, you can install them with:
$ sudo apt-get install ghc cabal-install
To try and make things as clear as possible, the code includes a much haddock documentation and comments as we could reasonably fit. You can compile those with:
$ cabal unpack SpaceInvaders # or git clone https://github.com/ivanperez-keera/SpaceInvaders.git
$ cd SpaceInvaders* # Game resources are here
$ cabal haddock --haddock-executables
- Paper: The Yampa Arcade, by Antony Courtney, Henrik Nilsson, and John Peterson. Used to explain FRP to new audiences.
- Talks: The Yampa Arcade, Haskell Symposium 2003.
- Talks: FRP Games and Music, 2016 (also available as handout). Makes some comparisons with Cycle.js and XStreams.
- Talks: Lectures on FRP, 2010. Includes SpaceInvaders as an example.
- Projects: Yampa, the Arrowized Functional Reactive Programming implementation created by Henrik Nilsson and Antony Courtney.
- Projects: Haskanoid, a game that uses SDL multimedia, wiimote and kinect. It's cross platform and works in desktop, mobile, and web (compiled with GHCJS).
- Projects: Magic Cookies, a commercial FRP game written in Haskell using Yampa available on iTunes and Google Play for Android.
If you find this game attractive and would like to use it to teach functional programming or other subjects, we'd be very happy to know about it. We can provide extra material that you can show to students (videos, screenshots, etc.).
You can collaborate at least in two ways:
- File an issue.
- Write documentation (send a link and/or a pull request).
We would like to call on Haskell programmers, game developers and anyone with an interest in Functional Reactive Programming and/or Game Programming to review the code, ask for clarification when it is not clear enough, and help us improve the game, and the state of FRP/Yampa programming as well.
- Henrik Nilsson
- Antony Courtney
- Ivan Perez