Is there any game engine using a functional programming language similar to Scheme, Common Lisp, Clojure or JavaScript?
I've tried Unity3D but their "JavaScript" is not actually JavaScript, is strongly typed and is not functional.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityThere is LambdaCube which is written in Haskell (it's not exactly game engine but more like graphics engine).
You can always use f# or iron python (yes i do know, python isn't functional) or any other .netified language with XNA on .net platform.
http://fsharpgamedev.codeplex.com/ http://www.ironpython.info/index.php/XNA_Example_with_a_Bouncing_Sprite
edit: One more engine, written in Lisp: http://code.google.com/p/blackthorn-engine/
I don't have an answer to the question as written, but I believe you are possibly trying to ask "why aren't there more functional game engines" rather than looking for a specific one to use. If that's correct, you should rephrase the question. If not... ignore me. :)
A pure functional approach is not a good fit for games. Games (and graphics, and physics, and AI) and basically all about state changes. The correct functional approach to these problems would be to compute an entire new state once per loop, which will have a very severe performance penalty compared to coding more directly to how actual hardware works.
It is for that reason that you don't see any functional-style game engines in production. It is simply the wrong programming paradigm for the majority of problems a game engine is meant to solve. It is the wrong programming paradigm for the majority of problems that need to be solved in higher-level scripting and game logic code, too. While it is almost certainly possible to make a functional game engine, it would be slow, difficult and cumbersome to use, and would serve no real purpose other than being a neat demo/toy to show off.
That's not to say that functional programming doesn't have a place somewhere in games. I use a very functional style of coding (where appropriate) in C#, Unity JavaScript, and even C++11. Some very specific problems are best or at least most easily solved with a functional style, and most of the popular languages today support that form of programming, albeit in a more cumbersome manner than "real" functional languages. Usually these problems solved with functional approaches are not in the core engine code, nor in code that runs in the game itself. Functional coding can be quite beneficial for tools and offline data processing (baking models and other assets, for instance). It's also arguable that GPU programming is vaguely functional in how algorithms are written, even though the actual coding is done in a hardware-efficient procedural manner.
Of course it can still be best to avoid functional approaches outside very specific circumstances since you want these offline tools to be as fast as possible. Functional languages excel at parallelism, which is good for some problems, but the abstractions from the hardware tend to lead to very inefficient single-threaded performance. (Languages like LISP do well here because they are not pure functional, and in fact Common LISP is multi-paradigm.) The absolute single worst thing for a game engine or related toolkit is to be a bottleneck for content iteration. A fancy engine with a lot of features that takes artists or level designers hours to do what could be done in 5 minutes (or ideally, near-instantly) will just lead to low quality games or cancellation due to budget escalation.
The Naugthy Dog company used List on its Game Engines and it was called Game Oriented Assembly Lisp.
Some information can be found here: http://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp
Some code samples: http://web.archive.org/web/20070127022728/http://lists.midnightryder.com/pipermail/sweng-gamedev-midnightryder.com/2005-August/003804.html
It is not available for public usage.
var add : Func<int, int, int> = ...
\$\endgroup\$