Saturday, March 14, 2009

Java games

Been wanting to write a little game for fun. There are lots of ways to do this!

There are good C/C++ cross platform game libraries. One of the best I found is Clanlib. It's well designed and contains everything you'll need. Libraries like SDL provide simple cross platform APIs but extra functionality is via extension libraries which tend to be low quality or not maintained. Clanlib provides more of a coherent framework, and uses OpenGL for all rendering, so there are no platform specific quirks.

Using Python and PyGame means you don't have to recompile per platform. PyGame provide bindings for SDL. High level languages, like Python, are nice for prototyping and knocking experimental games up. You also don't need to worry too much about performance these days since most PCs have more than enough horsepower.

If you want to get your game to the widest audience then probably the best way is to make is playable in a browser. Downloading executables from the web is a lottery. Any program could contain malicious code. Running them in a browser gives people more confidence nothing nasty will happen. Flash is quite popular for this, but I didn't really grow to like it when experimenting with it. Now that canvas has arrived, Flash may be on the way out.

I've never really used Java, I suppose I haven't found a use for it. I use C++ for performance programming and Python for scripted tools etc. An interesting Python variant is Jython, that is, Python written in Java. This allows you to compile Python code into Java. So this seems like a good compromise, and allows you embed your Jython applet in a page to be used.

Using Java and Python also allows me to use Eclipse, which is a great development environment. We'll see how it works out.

No comments: