A demo video game written in Haskell
用 Haskell 写一个图形游戏 demo
2010-08-03

Introduction

Haskell has become my first choice of general-purpose programming languages since 2008. Until now, I used that only for modules and calculations, which input and output data with files, consoles, or network sockets.

In my current project, I am considering to use Haskell for an interactive diagram plotter. Before that, the usage and implementation quality of the Cairo/GTK binding has to be checked. For this purpose, I wrote a small game with Cairo/GTK using Haskell.

I have already expected that the IO of a UI or canvas is not quite straightforward with the Haskell language. It turned out to be even worse than I thought. Nevertheless, the graphics API works with sufficient features.

The rules of the demo game can be simply explained as follows. The player controls a "celestial object", which casts certain gravity forces on the other objects. The goal is to avoid any collision of "celestial objects" within a given time.

Download binary and source

The source is available: src.zip. A makefile summaries the compilation steps.

A binary demo program can be found in the external link.