Skip to content


Quickstarting game development in Haskell and Ubuntu


Frag — a first-person shooter by Mun Hon Cheong written in Haskell using GLUT and OpenGL.

Quickstart

This tutorial describes a quick overview and steps on how to get started in game development with Haskell and Ubuntu 10.04.

In case you just want to see some examples get the newest Haskell platform package. Just type in console (you may want to update the download URL):

sudo apt-get install ghc6 ghc6-prof ghc6-doc haddock libglut3-dev happy alex libedit-dev zlib1g-dev checkinstall cabal-install
wget http://hackage.haskell.org/platform/2010.1.0.0/haskell-platform-2010.1.0.0.tar.gz
tar zxf haskell-platform-2010.1.0.0.tar.gz
cd haskell-platform-2010.1.0.0
./configure
make
sudo make install
sudo echo PATH=$PATH:~/.cabal/bin
cabal update
cabal install cabal-install

See Hackage games for a list of games written in Haskell. To install and run Frag f.e., type in console:

cabal install frag
cd ~/.cabal/bin/frag
cabal unpack frag
./frag frag/leveleg

This should be sufficient for all other games, some need external libraries however (i.e. “sudo apt-get install lib…”).

Haskell IDEs

If you are used to visual IDEs like Visual Studio or Eclipse (and want to avoid Vim or Emacs) you may consider the following 2 Haskell IDEs (don’t expect too much though @May 2010):

I stuck with EclipseFP. To install EclipseFP, type in console:

sudo apt-get install git-core eclipse
git clone http://github.com/JPMoresmau/scion.git
cd scion
cabal install
eclipse &

(scion from Hackage seems broke (with GHC 6.12.1) so we use the version from JP Moresmau)

in Eclipse do:

  1. Help -> Install new software -> Add -> “EclipseFP — http://eclipsefp.sf.net/updates”
  2. Window -> Open perspective… -> Haskell

Graphics

The Haskell community and libraries are still in heavy development, again don’t expect too much (@May 2010). Basically there are the following libraries available which you might be interested:

  • SDL: libsdl is a very mature and widespread library collection for 2D graphics and input (see also SDL-gfx, SDL-image, SDL-mixer, SDL-mpeg, SDL-ttf). tutorials available at: LazyFooHaskell, Animal-Machine.Com and all original SDL tutorials
  • hogre: Haskell bindings to a subset of the popular OGRE graphics engine, includes 3 small examples, library looks very clean, no documentation. note the version number though (build no. 3, no more activity). Couldn’t get it running on Windows 7 or Ubuntu, even with OGRE 1.6.4 or 1.7.1.
  • lambdacube-engine: pure functional graphics engine, includes some examples and runs out-of-the-box. note the version number though (build no. 2, no more activity)
  • HGL based on book The Haskell School of Expression
  • GLFW, GLUT, GLUT: as a last option, doing the low-level stuff manually

I stuck with SDL (standard in 2D, quite mature, input handling included). To install SDL, type in console:

sudo apt-get install libsdl1.2-all libsdl-dev
cabal install SDL SDL-gfx SDL-image SDL-mixer SDL-mpeg SDL-ttf

Reactive Programming

Reactive programming (or more precise temporal programming with events) abstracts away time and events which is very useful in game development as most games are interactive real-time simulations. Use: Yampa! It’s maintained by the Yale Haskell Group, very mature, the 5th iteration or so of a reactive programming library especially designed for games and there are also some scientific papers available.

Games using Yampa include: cuboid, Haskelloids, SpaceInvaders

Blogs

Also check out these blogs:

  • Antti Salonen: developer of HOGRE, FunGEn and some Haskell games
  • James Hague: former game developer, writing about functional programming and games
  • Luke Palmer: FRP and games in Haskell
  • Just Bottom: developer of minimalistic FRP library and games in Haskell

Tagged with , , , , , , , .


6 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. JP Moresmau says

    Hello, I’m the current maintainer of EclipseFP. What functionality on top of the basics would you like to see? Thanks

  2. magnetic messaging says

    This paragraph is truly a fastidious one it helps new net users, who are wishing in favor of blogging.

  3. mix videos says

    Thank you for sharing your thoughts. I truly appreciate
    your efforts and I will be waiting for your next post thank you once again.

  4. overwatchbetagame.pw says

    It’s what separates them from the rest of the gaming
    pack. Get ready to cast all that aside and take a
    quantum leap forward in MMO gaming. That means we’ll be exposed to
    world Pv – P, 2 new territories, four new instances, and 500 new
    quests we didn’t see in the previous phases.

  5. Nature's Way Ginger pills says

    Niice post. I learn something new and challenging on websites
    I stumbleupon on a daily basis. It’s always interesting to read throygh articles from other
    writers aand use something from other sites.

  6. podhajska says

    If you desire to increase your know-how simply keep visiting this site
    and be updated with the latest gossip posted here.



Some HTML is OK

or, reply to this post via trackback.