4 ms·
This isn't true about games; FP isn't a bad fit for them. Games can be written in FP, and there are some interesting things you can do with it, it's just that i
by the_af 11y ago
This isn't true about games; FP isn't a bad fit for them. Games can be written in FP, and there are some interesting things you can do with it, it's just that it's obviously less explored and more "researchy".
See:
- Nikki and the Robots (Haskell): https://github.com/nikki-and-the-robots/nikki https://github.com/nikki-and-the-robots/nikki
- Frag, a simple 3D shooter (Haskell): https://wiki.haskell.org/Frag https://wiki.haskell.org/Frag
- Clean Game Library, using Clean, an FP language with a different philosophy from Haskell's: http://cleangl.sourceforge.net/ http://cleangl.sourceforge.net/
- For my (abandoned :( ) master's thesis, I was also writing a platformer in Haskell and was doing just fine. I abandoned it because I'm lazy, not because of FP :P
- cousin_it 11y agoI guess the main problem is that FP can encode updatable trees with direct pointers from parents to children, but it can't encode updatable graphs with direct pointers, and in some applications you really want that.
- the_af 11y agoI don't know. I have actually tried writing a game using Haskell. Admittedly, it was an absurdly simple platformer, and I left it unfinished, but it was a joy to write it. FP helped with both high and low-level code organization. I didn't hit any walls writing it (maybe I would have later on, of course). Had I continued it, I would have tried using FRP techniques, which was ultimately the whole point of the thesis, but never got around to trying them. I think it's one thing to argue from theory ("this can't possibly be practical!") and another to actually try your hand at it and see whether it works or not :) My semi-informed guess is that it does. I don't expect to see AAA games done in Haskell any time soon, but that's for completely unrelated reasons! IIRC, Carmack himself seems to be warming up to the idea of using some pure FP techniques in games. Of course, not everywhere.
- tome 11y agoSure it can https://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Monad-ST.html https://hackage.haskell.org/package/base-4.8.2.0/docs/Contro...