• Advertisement

Archived

This topic is now archived and is closed to further replies.

Functional programming game development

This topic is 5095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently began uni-studies (computer engineering for the interested) and we had to take a beginners course in programming so everyone would get some programming experience. The first part was something odd called Haskell, a functional programming language! I had never heard of it before..and I can tell you I''ve never seen something like it before. All my experience in other languages just didn''t help (well, maybe a little), it had no similarities whatsoever with anything else. However, as the second part of the programming course, we are to learn java (to counter the functional programming with an oop one). Now..I learnt java some years ago and since my language of choice is c++, I don''t really have any trouble with it. But when comparing java with haskell...well, haskell''s just so bloody much smoother to work with. Now, I don''t want a language war here, that''s my personal impression. I have friends who think java is so much easier to grasp and that they didn''t get the functional programming at all. Now to my real question. Anyone here used functional programming for game development? Considering functionl programs seems to have so much shorter development cycle, is it the same for games? -Luctus
Statisticly seen, most things happens to other people. [Mail]

Share this post


Link to post
Share on other sites
Advertisement
I personally hate functional languages. I had to use OCaml in a class and I really disliked it. There were some cool features but overall it was not "straight forward" enough for me. Maybe my brain is just locked too much into imperative and object oriented concepts? Anyway, you may want to check out this article on gamasutra. You may also want to check out Clean which has it''s own library for 2D platformers. It may be harder to get started in games with Haskell, OCaml, or LISP outside of scripting, I''m not sure.

Share this post


Link to post
Share on other sites
Except in high level AI (usually various scripts are used), this kind of languages are not hardware/CPU architecture friendly enough to be exploited in most ambitious games that rely on high performances (3D, physics, path finding, etc...).

Share this post


Link to post
Share on other sites
I see 2 main barriers to people using functional languages in game development:

1) lack of library support; who knows what might happen if DirectX came with Lisp bindings though. Of course, this partly stems from the fact that the languages themselves are not popular in this sort of development, which in turn comes from them being historically too slow for the task. (NB. This is not necessarily the same as being too slow these days.)

2) a more mathematical way of thinking is required to understand them. Imperative languages have a nice ''instruction/recipe'' feel to them that we are all familiar with. Functional languages require us to think in a slightly different way, and therefore have a bit more of a learning curve. Prefix notation rather than infix notation in Lisp is a massive turnoff for many, for starters.

There is another factor I see here, and that is that part of the power of functional languages comes from them being (at least partly) interpreted rather than compiled. As a result of this, much of what I see done in Lisp, I can also achieve in Python, but without sacrificing the imperative programming style. And nice time-saving constructs like Haskell''s list comprehensions are also in Python. (Spot my favourite language.)

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Share this post


Link to post
Share on other sites
I also did a course on Haskell at Durham uni. It is definately wierd but for some things ridiculously easy. We made a newsgroup app which drew some graphs in HTML of who''d done what on the server.
In terms of doing an algorithm it has uses. In terms of a whole game - no way! Apart from being stupidly slow it just doesn''t work that way really. If you could combine it with c++ maybe... I think our version generated c code which was then turned into an .exe.
It was fun to learn though even if hard and pointless!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Lisp was used on several AAA console games...

There was a post mortem in gamasutra, but I can recall which game it was

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Isn''t it called Procedural? =P

Share this post


Link to post
Share on other sites

  • Advertisement