Alex Rivera | Logout

Good resources on using functional programming in game development?

Asked 2009-07-30T20:20:27.583
44

I'm quite new to that functional programming paradigm, but so far I like it. Since I'm into game development, I want to try it out in writing some games in purely functional programming style. I don't mind the language - be it Erlang, Haskell, Lisp, or even Ruby (I found out it supports functional programming traits).

Well, it is obvious that to learn functional programming (in fact, anything) the best advice would be just to learn functional language and program a lot in it. But what I'm looking for are some resources on using functional programming in games and game engines (2D or 3D).

So, do you know of any functional programming articles/books/blogs/whatever about using it in actual games, or designing simple game engines with functional programming languages, and all the interaction between the game and game engine in this functional environment?

Please, don't suggest something like "just start programming simple stuff in functional and gradually it will come to you". As I said earlier, it is obvious, but what I'm asking here are some resources on the topic, if there any. Thanks!

Edit
Report

2 Answers

24

Well, you could do worse than studying the code of some of these haskell games.

Some of these use FRP (functional reactive programming), which some people are working on as a pure, high-level technique for games and other things. But most are a typical haskellish mixture of effectful and pure functional code.

Bloggers with relevant content include James Hague.

Note FunGEn at the first link - though not actively maintained it is a 2D game engine with working examples.

There's also the Clean language with it's game library and nice screenshots.

answered 2009-07-30T20:38:48.077
7

Well I am mostly a Haskell programmer so I can only suggest to try Haskell libraries such as Gtk2hs. Its mostly for 2D applications and for user interfaces but its good to get you started :) An even easier library is HGL but its slightly bugged and outdated. If you want to try out messier (but cooler!) stuff then go for Haskell's OpenGL library which can be found here. I never tried working with Haskell and OpenGL but if you check out the answer submitted by Simon Michael there are example games in Hackage's Game Section which use OpenGL.

Sorry about not linking all the libraries but I'm a new user and I'm not allowed more than one hyperlink. If you google them they should come up easily though.

answered 2009-07-31T09:56:53.163

Your Answer