Thursday, December 27, 2012

A post about a Platformer

I thought on Xmas eve I'd read, learn and play with programming. I wanted to write a tiny platformer, one that would take a couple of hours to design/write at most. The idea being it wouldn't take much time away from Gulpman remake that I was going to work on and finish real-soon-now.

I also wanted to program it using Python or Lua - both languages I know well, and are fast to write and develop and much more fun (IMHO) than the (sometimes) very manual and explicit programming of C or C++ (we use C++ for the Gulpman remake).

Part of this is the quick platform game I hacked up back in the 80’s on my beloved Sinclair ZX Spectrum and wished to recreate. However printing things on the screen involves slightly more nowadays and the barrier to entry to not tiny. Also a conversation with Chris Brind about Ludum Dare (and reading about similar competitions).

What actually happened before Xmas...

Anyway - Last weekend (the one directly before Xmas eve) and Xmas eve were really busy. Fixing Xmas lights, wrapping presents, tidying the house, food shopping, visiting people, etc. And Xmas day and Boxing day are always write-offs - well at least in terms of actually using your computer to actually DO stuff. (Enjoyable otherwise … food, presents, excited kids and playing with real-world things are good for me)

Learning and other dangers…

I’m a fan of learning new things. Too much sometimes. That’s probably danger number one. Second danger is that learning takes ages. Reading, learning APIs, evaluating, reading other people opinions, checking similarities and making decisions all take lots of time.

That’s not to say you shouldn’t do it. But sometimes there are faster ways based on your existing knowledge. It’s always a trade off.

If you never learn, read, try new things you will be outpaced. If you do it constantly then you will never get anything done … and sometimes a few percent slower or faster doesn’t matter … the best thing to do is keep making stuff.

Thoughts about long term usefulness…

Normally I default to Python to do quick hacks - because it it bells-and-whistles from the get-go. Also the number data-types are larger and more flexible that Lua … although ‘tables’ (=associative arrays/dictionaries) as a default data type is good.

But the other thing I thought about was that Lua is trivial to embed and, although it’s possible to embed Python. Lua is simpler. This is part of the reason why so many games use it as the scripting engine. My next project might well use it (even maybe the Gulpman remake has a reason to use some standardised loading strategy…).

What maybe I should have considered…

The Gulpman remake ‘runtime’, although in the same project as the application, is relatively well separated. I could have used this and maybe got a basic platformer with a jumping player, monsters and room in a couple of hours.

What I did learn…

For a start, there are loads of Python and Lua game and multimedia frameworks. I’m not going to cover any significant fraction here.

I looked at Lib SDL bindings for these languages (knowing SDL very well) … but none attracted me, and some of the slightly higher-level frameworks looked like they offered enough to make the effort (and sometimes pain) of a more complex framework (both for development and deployment) worth it.


I’ve used PyGame before … it’s a thick framework on top of SDL. However, PyGame require installation of X11 on the Mac - which is not standard on Mountain Lion. It’s trivial, but still acted as a barrier to entry.

Pyglet looks cool and I almost got further into this. I wasn’t sure - based on the online docs - how simple a simple 2d game would be. This put me off learning more - at least for the moment.

Cocos2D … I’ve played with the iPhone version, and the standard version uses Python. It’s built on top of Pyglet.


This review was interesting but it actually lead me to use Love (against the opinion of the article). Also I prefer open-source language runtimes and frameworks - everything else being equal. I thought Love2D was a cool name and the Moai method naming was a tiny bit ugly.

Love2D … the downside is that it only targets Linux, Mac and Windows (no mobile platforms). The advantage is that it looks like a clean API with a lot of facilities that would be useful, without having extra stuff I wouldn’t use. It’s also got an impressive demo in “Journey to the Centre of Hawkthorne”

Final Thoughts

Generally it’s nice to see such choice and health in frameworks - even if it does mean you have the problem of make choices.

I didn’t consider web based (e.g. html5, java, Cocos2D HTML5, etc.) options … maybe I should have based on the fact that lots of casual games are now web based. I also didn’t look at 3D frameworks at all.

Further reading…

“If you’re looking to do 3d games, you’ll definitely want to take a look at Panda3d It has excellent documentation and, from what I understand, it’s quick to get up and running with.”

P.S. This list-of-lists could be close to infinite :-)

Love2d Web player!

Ludum Dare notes about running games easily explicitly notes Love2D and


Post a Comment

<< Home

Newer›  ‹Older