Monday, December 31, 2012

Fixes for PowerPC platform

My kids have a couple of old G4 PowerPC 'quicksilver' PowerMac towers that they use to play on the web, run games, etc. Since they are quite young, and these computers do what they want, I haven't bothered upgrading them to newer (x86) computers.

It always gives me the problem when I create something they want to play... I've kept the version of Xcode around that generates PowerPC for C and C++ ... but the Löve framework v0.8.0 is Intel only. I'm sure this makes sense to the Löve people; supporting platforms is quite a bit of work. Many other things are going the same way.

Anyway, I thought I'd try with Löve 0.7.2. Sadly the sound files caused LibModPlug to stop on PowerPC.

After some investigation (things like paths, etc.) the actual changes I made were:
  1. Change the .wav sound effect files (generated with cfxr Third Cog Software/Joachim Bengtsson's Mac port of DrPetter's sfxr.) to ogg files. They are also smaller in size. There is a strange sound 'artifact' at the start of one the sounds - but not enough to make me not release it. (I'd actually seen a forum post with something about this.)
  2. Apparently when the Platform / Löve starts up the framerate is very low. It very soon (under a second) gets to 60fps (vsync locked I think). The low framerate gives a huge time delta into the movement/update routine leading ultimately to a huge speed and huge fall displacement. Big enough to skip the floor underneath. So I limit the max. jump and max. fall offset to half a tile size (32 pixels / 2).
This second 'bug' I'm pretty sure I've seen when running on an x86 mac as well - not at the beginning but at some random time. Probably requires more investigation.

I actually think that longer term I'd be better limiting the max. time delta to, say, 1/5th of a second (0.2s).

Anyway, you can find it here (with the other versions).

Sunday, December 30, 2012

Platform - a tiny game / demo

So I learnt enough about Love2D to write a little game / demo / test on Thursday evening.

Wrote a tiny python script to make the different builds on Friday morning. Spent some of Friday afternoon tweaking it and letting my 6-yr old play it (one screen, no monsters or things to collect ... and he plays it for ages ... go figure!). Spend a small amount of time on Saturday re-coding the jump/fall.

Anyway pretty fast to develop and the Windows / Mac and (hopefully Linux) builds work as expected.

Screenshot and downloads here: Platform.

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

Newer›  ‹Older