This is a special case of this question that I feel is particularly pertinent.

I'm working on a game for Android, and I'm planning on using Scala with libgdx. I'm planning on making a performant game, but not necessarily hyper-performant game. I saw libgdx's documentation on Garbage Collection, and this makes me think:

  1. Functional programming implies lots of immutable objects.
  2. Therefore, mutating an object requires making a new object.
  3. Thus, lots of objects get garbage collected, which degrades performance.

Is this an insurmountable problem? Are there any other significant problems with functional style on Android?


2 Answers 2


You can be fine with Scala, but you really do not want to allocate new objects too frequently. GC without pauses are still no more that a myth (on Android), and gamers don't like when your game glitches. But this doesn't mean that you cannot take any benefit from using more serious language - indeed, you can. And you'll be OK with "functional style" that doesn't take place in the main game loop. Also, Scala on Android itself requires to fight with some extra build problems, but once you learn it, it's bearable. And it's not very precise to name Scala a functional language, it have some features related to functional programming, though.


For gaming? Avoid functional languages. Their entire paradigm fails to mesh well with games. Procedural, OOP languages better fit with games' needs for frequent state changes, explicit memory and resource management, abstraction of data and model useful in many places, data-oriented design in some systems, and so on. Functional elements are one thing, a true functional language is another.

The best performing functional language for Android will still give a worse development experience than Java or C++. Not because those are better languages all around, but because they're better for the specific task at hand. Right tool for the job and all that.

This is true on mobile, PC, consoles, and so on. Nobody uses functional languages for games. Naughty Dog uses LISP for scripting, but not the core game code. They can't. It wouldn't work if they tried.

The closest most people get are shaders, which are functional in some ways but written in highly procedural languages like HLSL or GLSL.

  • \$\begingroup\$ >For gaming? Avoid functional languages. Interesting that the 2010 Google AI Challenge was won by a Lisp bot. Might be no good for writing games, but it's apparently pretty handy when it comes to playing them. semanticweb.com/… \$\endgroup\$
    – user26022
    Commented Feb 6, 2013 at 21:34
  • \$\begingroup\$ Sure. Different use case. LISPis common for real AI, which has little to do with game AI. Game AI is all about efficiently making choices that fool the player into seeing intelligence and making a fun game. Real AI is about making actually intelligent decisions, human opinions be damned (smart can and does look dumb sometimes, as human observers often don't see the whole picture like the AI does). \$\endgroup\$ Commented Feb 7, 2013 at 3:15
  • 2
    \$\begingroup\$ For gaming? Avoid functional languages. Their entire paradigm fails to mesh well with games. Actually I've read some articles from high profile game developers expressing an intrest in functional programming. There was one by Tim Sweeney scribd.com/doc/5687/… and John Carmack seems to have an active intrest in evaluating functional languages and is currently doing a port of Wolfenstein 3d in Haskell, tinyurl.com/cnzx57u \$\endgroup\$ Commented Jun 3, 2013 at 2:56
  • \$\begingroup\$ Also do you have citation for Naughty Dog only using Lisp for scripting? I was under the impression that they had a custom in house dialect of Lisp, with a custom compiler targeting the PS2 hardware and that they had written the majority of the Jax and Dexter series in it. EDIT: Never mind found it, gamasutra.com/view/feature/131394/… Practically all of the run-time code (approximately half a million lines of source code) was written in GOAL (Game Object Assembly Lisp) \$\endgroup\$ Commented Jun 3, 2013 at 2:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .