May 6, 2007 will

PyGame Runtime?

Pygame is a wonderful API for creating games and rich media applications, but the diffulty in distributing PyGame creations may be holding it back from the big time. When you write a game / application / demo, the first thing you want to do is have your friends and family play it, then you want to launch it on the internet, and perhaps even profit from it. To distribute a PyGame app you currently have two choices. You could ask people to install Python and Pygame, plus any other modules you may have used. Which is fine for other Python programmers, but your grandmother may find it tricky - "Are you sure I should click on the snake, dear - what if it has a virus?". The other option is to build a package with Py2exe or similar tool, which works great but requires a little effort to get working and will generate a large bundle of files - and then you are left with the tedious task of making an installer.

I think this lack of easy distribution is preventing many amazing PyGame creations from getting 'out there'. What I would love to have is the ability to zip up a bundle of .py files and assets, rename the zip to .pyg then have a PyGame runtime launch the game. This runtime would be available on the net somewhere and have install packages for all the major platforms. So .pyg packages would be "write once, play anywhere" games.

No-doubt there be a number of challenges in implementing something like this, but I'm sure it is doable. The runtime may have to support multiple versions of Python; at least 2.4 and 2.5. It would also have to contain a number of modules that are popular in games, and know how to get modules that aren't installed - possibly with import hooks and cheeseshop.

I know what you are thinking; if it is such a good idea then why don't you do it yourself? I may eventualy try it, but I'm still working on other good ideas at the moment. I guess I was hoping that some inspired individual would pick it up and go with it. Looking at Movable Python may be a good starting point.

Ultimately there may even be profit to be made from such a thing. Make the runtime a free download, but sprinkle the site with a few google ads, and perhaps even charge for some of the more professional games. Casual games are big right now, and PyGame programmers would have a big advantage over the poor schlobs working on C++!

Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
gravatar
Jeremy

I don't find Py2exe produces too many files. Nor do I find it hard to use. Using the -b1 command tag to bundle stuff into the .exe makes it a lot tidier.

gravatar
Will

Fair enough, but the exe is still rather large. Admitedly a runtime would be larger, but then end users would only need to download it once.

gravatar
Alex

Have you looked at setuptools' eggs? All the other requirements for single-file packaging, dependency resolution and automatic downloads are there. A pygame.egg would let you distribute games without any dependencies and anyone who has installed setuptools (or its lighter-weight companion ez_setup) can run the egg directly.

A simple windows/mac installer including Python and setuptools could be a good idea though, equivalent to your proposed runtime but more generic.

gravatar
Paul Boddie

Take a look at makeself for a single-file solution that works on UNIX-like platforms:

http://www.megastep.org/makeself/

It does behind-the-scenes archive unpacking, but together with cx_Freeze, it seems like a good approach for some platforms.

gravatar
Sindisil

For free games, what you're asking for might be OK. However, it is most emphatically *not* the right thing for indie and casual game distribution.

The setup you're describing is pretty much what we have today with Java, and is the reason that Java has not been a runaway success in the indie and casual market. You don't dare trust that the runtime the user has will run as well as the runtime you tested with, so you really want to ship what you tested with.

In the case of Java, that's 7-16 MB of baggage, barring taking advantage of Sun's apparent disinterest in suing JRE redistribution license violators. With today's more widespread broadband, that in itself isn't a big deal, but if your competitors aren't using Java, they can include that much more music, graphics and game code and still have a download size to match yours.

Python/Pygame/&c. is tantalizing because it'll add only about 3MB of overhead, and will give more rapid, less painful, more flexible development to boot! Python/PyGame-ctypes/PyOpenGL-ctypes/Pyrex FTW!!!!!1one

Sorry ... got carried away there!

Now that Java has been open-sourced, it will eventually allow for trimmed down private installs of the JRE, allowing for only 3-8 MB of overhead.