Jump to content


Functional Game Programming?


9 replies to this topic

#1 chot

    New Member

  • Members
  • PipPip
  • 28 posts

Posted 10 November 2005 - 05:30 PM

Anyone here who have tried coding a game in a functional programming language?

if there is: how did it go? is it possible to create a realtime 3d game client, or is the overhead to large? what language did you use, and where there enough librarys and tools? if you were to do it again, would you use the same language or would you use any other language, and which language in that case?


In school we read Haskell and ever since i just feel frustrated at c++ whenever i try to write something :/ fells like just getting it running is about the same amout of code, but when you are at that point in a haskell project you can be pretty sure it works, in c++ you'll have a lot of bug fixing and safety code (ie checking for null pointers and such things..) left to write.


for those of you who dont know what a functional language is: http://en.wikipedia....nal_programming

/chot

#2 eddie

    Senior Member

  • Members
  • PipPipPipPip
  • 751 posts

Posted 10 November 2005 - 05:58 PM

First off, to answer your question: I have not.

That said, reading what your post seems to be lamenting about C++, you seem to not be complaining about the state-machine type programming that comes with C++, but rather a few of the causal side effecgts of memory management and such (perhaps there's more, I'm only going on a hunch here).

If that's the case, have you tried a higher level language that offers a mix of both (functional-ish programming and no memory management issues?). Python springs to mind (it has some functional programming and alleviates memory management woes.).

Just a suggestion to check out, if you haven't already. :)

#3 chot

    New Member

  • Members
  • PipPip
  • 28 posts

Posted 10 November 2005 - 06:45 PM

eddie:
no i havent tried Python yet, ill have a look at it. but isn't it too slow to code the client in it?
although, im using lua for about as much as i can in my game right now, not so much for client side stuff though, mainly for game logics and such

#4 eddie

    Senior Member

  • Members
  • PipPipPipPip
  • 751 posts

Posted 10 November 2005 - 08:28 PM

It's not really slow at all. While C/C++ are much more "to-the-metal", Python is pretty much right up there as well.

Check out http://www.pygame.org/news.html.

I'm using Lua myself, and it's quite a blessing for making things runtime-configurable and not wasting too much time on compiling.

Keep in mind that very rarely does a language itself impose a tonne of speed concerns, it's moreso the usage. At least in hobby PC-coding, where you might not be pushing the same thresholds as some of the more commercial to-the-metal games.

#5 SamuraiCrow

    Senior Member

  • Members
  • PipPipPipPip
  • 459 posts

Posted 16 November 2005 - 05:19 PM

If you ever find out that Python is too slow for you. Just translate it into C using PyPy. :yes:

#6 opcode-foo

    New Member

  • Members
  • PipPip
  • 17 posts

Posted 19 December 2005 - 03:47 AM

I have used Scheme as an embedded scripting language. Interpreters can be too slow for real-time, algorithms like A* etc, but there do exist native-code compiling Schemes (Chez and MIT-Scheme) but I never tried them to see how they performed.

#7 GroundKeeper

    Valued Member

  • Members
  • PipPipPip
  • 110 posts

Posted 22 December 2005 - 09:54 PM

What about the title? Does anyone know any game programming attempts in functional programming? =) There is always some Haskell hacker out there!

#8 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 23 December 2005 - 12:00 PM

http://www.geocities...monadius_e.html

I find it pretty unhealthy to write such a game in Haskell, but I have to say that I'm not a big Haskell fanboy.

Another thing, wings3d (a relative well-known and neat 3d modelling app) is written in Erlang, I don't know anything about that language, except that it is a functional language too.

#9 GroundKeeper

    Valued Member

  • Members
  • PipPipPip
  • 110 posts

Posted 23 December 2005 - 02:47 PM

Erlang was according to my knowledge developed by and for Ericsson (mobile company) and their developers to many their phone switches more intelligent and easy to handle.. Erlang I have been told have a very strong kernel which actually is so strong that you can modify code while running the application.

#10 zavie

    Member

  • Members
  • PipPip
  • 91 posts

Posted 23 December 2005 - 10:29 PM

Caml here. ^^b





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users