I have plans to write a game in Python and probably some SQL. I'm concerned about how versatile my program will be when I finish it, ideally I'd like it to run on Windows, Mac, Android, and iPhone... however I have a feeling the phones would be off-limits for this sort of thing. How would I go about writing a program that runs on multiple platforms? Is this even feasible for a beginner programmer?


Python is pretty portable in itself (runs on many platforms), but you have to take into account the following:

  • What are the limitations of the platform you're targeting? Do you want to sell through a mobile store?

    For instance, the WP7 marketplace only allows to sell apps written in managed code (.NET). The AppStore is pretty locked down too and only allows native application written in Objective-C. Android allows running both Java and native code through the NDK. People have developed workarounds to allow running for instance JavaScript in native apps in iOS or converting Web apps to native apps

  • How portables are the libraries you want to use?

    Here's an example: Cocos2D is a Python library with an Objective-C port. You can build your game in Python for desktop platforms and rewrite it in Objective-C, keeping most of the structure thanks to the library. But then you only have support for desktop + iOS.

Overall, Python is not an easy fit for mobile platforms, because of lack of support. Here are three workable alternatives:

  • XNA was created to make games for Windows, Xbox 360 and Windows Phone 7. There are two projects (MonoGame and ExEn) that allow to turn those games, with almost no modification, into iOS apps (through MonoTouch), Android apps (through MonoDroid). MonoTouch and MonoDroid have license costs though.

  • Unity is very portable and allows targeting almost all platforms (though there's no Linux support yet)

    It's free for desktop games. They have a Pro version but for most games you can do just fine without it. There's a chart comparing the various editions for each platform: http://unity3d.com/unity/licenses

  • Web applications (so-called HTML5) with the Canvas 2D API or WebGL run on recent browsers and smartphones. The support will only get better over time. There are many engines like the aforementioned ImpactJS or Three.JS for making 3D stuff.

  • \$\begingroup\$ would like to add that Unity supports 3 languages: C#, Javascript and Boo which is very similar in syntax to Python \$\endgroup\$ – George Profenza Nov 5 '11 at 23:20

PyGame says this in their About page:

Truly portable. Supports Linux (pygame comes with most main stream linux distributions), Windows (95, 98, ME, 2000, XP, Vista, 64-bit Windows, etc), Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX. The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64, RISC OS, SymbianOS, and OS/2, but these are not officially supported. You can use it on hand held devices, game consoles, and the One Laptop Per Child (OLPC) computer.

Python itself is extremely portable, and easy enough to port to new platforms (assuming someone hasn't already done it for you). Things will get "interesting" whenever you need to access some platform-specific bits, which is where PyGame can help you, if it supports the platforms you're looking at, or you can port it.

A semi-related issue is that some distribution methods (app stores) might not allow applications that can run unknown third party code. You'll have to lock down your Python and its scripts so they can't access anything outside of the application, and possibly prevent it from running scripts that you didn't provide as part of the game.


I'm not sure about Android, but Python can't run on iPhone. Currently the best tools for deploying a game on Windows, Mac, Android, and iPhone would be to use HTML5 or Unity3D. There are a bunch of other tools that are lesser known and thus less vouched for, like Ideaworks Gamestudio.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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