Trials and Errors with Cross-Platform Game Libraries

A little disclaimer: the programmer art is crappy and the code is even crappier. Those with delicate sensibilities should look away.


Some Lessons Learned

  1. Making the horrible magenta color on a sprite sheet alpha did not do what I thought it would in GIMP. Instead of making the background transparent, it seems to have made the entire channel transparent. Observe the sickly green and see-through Viktor in the screen shot.
  2. Iterative/Fly-by-the-Seat of Your Pants Design has the potential to get ugly really quickly. This is a whole list in itself of stuff that came back to bite me.
  3. For a walking animation you need 3 frames when moving horizontally across the screen or it will not look right. The legs need to be together for the middle frame, but it looks fine without them for vertical walking.
  4. Although it drove me nuts, the tearing is not really noticeable (to me anyway) with a 4 or less pixel scroll.
  5. C induced brain damage. I keep reverting to writing C in Python, especially when I'm just experimenting. Unless I'm trying really hard not to, then I just write Lisp in Python.

Without smooth scrolling: Attempt 1

With smooth scrolling that tears horribly: Attempt 2

The controls are hinky as well in the second one because the player's position and the camera's position aren't tied together as in the first attempt.

(py)OpenGL and Pygame

This works, but everything I know about OpenGL (not much to begin with) has been deprecated. I'd have to pick up the latest redbook, invest lots of time and then make everything from scratch.

After experimenting with the other options, it doesn't seem like such a bad idea. Which is probably why there are ≅8 million half-assed OpenGL 2D tile engines floating around. It only takes a couple of hours to throw one together.

Just draws a bunch of tiles, no animations, and the arrow keys pan around: The beginnings of something with OpenGL


I thought maybe a newer version of SDL might have vsync so that I could get rid of the tear while scrolling or perhaps there would be stuff that the python bindings were hiding from me. Nope.

The exact same as Pygame but with binaries. Distribution is not a small issue with Python.


After a big production of trying to get it to run, I only got as far as building the tutorials and modifying one of the sample apps to use an orthographic camera.

This is the original:

 virtual void createCamera(void)
            mCamera = mSceneMgr->createCamera("PlayerCam");

This puts the camera directly overhead looking down at the terrain.

 virtual void createCamera(void)
            mCamera = mSceneMgr->createCamera("PlayerCam");
            mCamera->rotate(Vector3(1,0,0), Degree(-90));

Then came time to put my own models in. I ran smack into the Blender and kept running to any 2D libraries I might use instead.


more later


Panda2D - Orthographic 2D tile maps using Panda3D

I admit, not a very varied and impressive tile map.


more later


more later


It wouldn't build. It wouldn't build on Ubuntu. It wouldn't build on Gentoo. It wouldn't build directly from the tarballs. The maintainer was a jerk about it. It can rot.

October 26, 2009