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!
There are a lot of advantages to functional programming in terms of concurrency, using persistent data-structures makes it cheaper (as well as much simpler in terms of code) to maintain old copies of game state which is very important if your game is going to feature a multi-player component.
C++ is a high performer when compared to other languages used for game development. Other popular game programming languages include Python, Java, C, and C#. While C is another low-level language used to program games, the focus of our comparison will be the higher-level languages in the running against C++.
Functional programming is a programming paradigm in which we try to bind everything in pure mathematical functions style. It is a declarative type of programming style. Its main focus is on “what to solve” in contrast to an imperative style where the main focus is “how to solve”.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With