Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to make a 2D game with one codebase that runs on iPhone, Android, and web (any flavour of web -- HTML5, Flash, Silverlight, etc.)

What are my options? I should be able to write my code once, and run it anywhere. I also absolutely need the ability to write unit tests (or write a unit-testing framework) -- I cannot make sizable games without testing.

Unity is good, but unity is 3d; even with hacks, the graphical assets will still be 3d. I'm after 2d, not 3d.

(If you need a Mac or separate licensing for the Mac part, that's okay.)

share|improve this question
Possible dupe of… – ashes999 Nov 12 '11 at 1:36
Can't you just use HTML5's native functions? – jcora Nov 12 '11 at 10:04

There really is no such thing as WORA (write once, run anywhere). Seriously. That's the big dream of HTML5, but due to the number of browser vendors even that dream will be tainted by the time it becomes realised in the larger sense. Tainted not just by functional differences (compositing is one extant example) but also by performance differences. In the meantime, these issues already exist.

For now, for a simple 2D game, you really still can't do much better than Flash/AS3. It has ASUnit, based on JUnit.

Java's another option, and while I love the language itself, Java deployment, particularly to the web, is depressing and was one of the reasons Java, which had all the potential Flash had and far, far more, never made it big on the web games scene. Also, Android uses Dalvik, which is a proprietary version of the JVM -- not really the same thing. So Android at least would be out of the picture, unless you ported your Java code across platforms... which is what you wish to avoid. ;) Java obviously has JUnit (the unit testing framework). If going for Java, check out PulpCore for a fast software renderer; the scene graph / display list approach they use is almost identical to using the AS3 core.

Silverlight's a joke in this sense, it's not even near universally cross-platform.

You can also check out SDL -- I believe it's not a half bad option in this regard. I'm using it but I haven't gotten as far as cross-platform deployment yet. However, writing cross-platform C/C++ code is not quite the same as a Flash or Unity codebase which is totally platform-agnostic, for those platforms it does support (most).

You can see why whenever this matter is brought up, people suggest Unity. The fact is, it's probably the most cross-platform solution out there, being even better in that regard than Flash (iOS).

share|improve this answer
A lot of your points really miss the mark of what I'm asking. Essentially, if Corona SDK supported a web deployment, that would be exactly the kind of thing I want. Flash doesn't run on iPhone and Android, does it? – ashes999 Nov 11 '11 at 23:37
@ashes999 Yes, it does. On Android. Flash Player 11 final update press release 5 hours ago. iOS, no. And please describe then what you are asking, since the question appears very clear. – Arcane Engineer Nov 11 '11 at 23:48
You can use Adobe Air. it is working on iOS and Android. – Ellis Nov 12 '11 at 0:00
@Ellis please add your comment as an answer and explain a bit more. – ashes999 Nov 12 '11 at 0:49
That forces the user to first install Adobe AIR, which is not present by default on those devices. – Arcane Engineer Nov 12 '11 at 0:54

Try Adobe Air. With the end of mobile Flash, Adobe recommends to use it. With Adobe Air, you can develop standalone apps for many platforms (Android, iOS, BB, ...). I'm not a great fan because of performance...


  • Cross Platform
  • It's Flash


  • Your standalone app asks to install Air
  • Performance (It's flash)

Exemple of game using Air: Dillo Hills

Ps: i don't use it.

share|improve this answer
You can share code between Flash and Air so you only need to write it once? – ashes999 Nov 12 '11 at 12:06
@ashes999 Yes you can. AIR simply enables some desktop features like filesystem access and dialogs, OS-Menus, direct DB connectivity etc. Apart from that, you use exactly the same classes. You can write a thin abstraction layer to handle these cases.. for the web you would use a server for storage, on the device and desktop you use the filesystem. When it comes to performance, flash is pretty much on par with Java (at least on the desktop), so that's not so bad I'd say. – bummzack Nov 12 '11 at 13:03

Exen is not bad. It uses XNA, so it deploys to web (Silverlight), iPhone (MonoTouch), and Android (MonoDroid) -- albeit that you require a $400 for each of (MonoDroid, MonoTouch).

Unity runs the same price, and also supports all three platforms; but it doesn't support 2D too well.

share|improve this answer

You should try Corona SDK, it is amazingly simple to use LUA but that would only be to fulfill your urge to program on mobile devices. You can program it in html5 plus javascript and theoretically it could run on all platforms, but personally doing games in HTML5 + javascript using the canvas element doesnt sound fun at all

share|improve this answer
Hence why Corona doesn't cut it :) see my comments in Nick's answer. – ashes999 Nov 12 '11 at 4:21

Have you tried PlayN? It's a cross-platform library that compiles to Flash/HTML5 (web), and Android; iPhone is in the works. I haven't used it, but it looks promising. (Be warned that the Android bindings are also very new.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.