Phil Hassey - game dev blog
Phil Hassey as Snidely Whiplash
"You can't buy awesomeness.
You're born that way."

Seahorse Adventures – Loading TGAs (and more)

Here’s a screenshot.  This is my Ubuntu desktop of my work on a new iPhone game.  Take a look at it nice and big.  Below I’ll explain all of what is going on …


In short, I’m working on porting my pyweek#3 team entry to the iPhone.  Here’s the details:

  • Top left, you see Kate, my text editor.  You’ll notice I’ve got -what appears- to be python.  But that’s actually tinypyC++ code!  My converter still has some rough edges, but it’s starting to get pretty good.  If you weren’t looking to closely you might mistake that for ordinary python code!  (In fact, it should be 100% python parser friendly.)  You can see how I have to use a touch of annotation to make it all go.  But for the most part, the types get inferred.  (The C++ outputted is about 2x as long, so I’m saving a ton of keystrokes!)
  • Top right, you see the level being painted.  It isn’t all working yet, but those are the basic tiles.  Interesting bit about loading the level, when I created this game I used my own level editor and library I made with pygame.  To save on disk and time I save all the levels to .tga files.  Since I’m targeting the iPhone I need an easy way to read the data from .tga files.  I don’t have SDL_image available, so a friend pointed me towards this great site.  It appears to have some awesome bits of code, including very simple and easy to use image loader that can load tga/png/jpg/etc.  I think it has the most painless interface I’ve ever seen for a C-based image-loader.
  • Bottom right you can see me working on tinypyC++.  As I’m working on BSA, I’m always finding new bugs in it.  Lately most of the bugs have been of the “add more graceful error handling” nature.  tinypy will point out what line (and character) an error happened on, but with a bit of extra work I’m able to add in some coherent error messages to tell the user what is going on.  In this case it was to inform the user of an undefined module name.
  • Bottom left you can see the startup of the game.  I’m using irrKlang for all my  game audio now.  It is not open source, but it’s “free” to use for free games, and the price is quite reasonable for commercial projects.  irrKlang is not portable to the iPhone yet, so I have to have a separate driver for my iPhone audio.

And that’s it for today’s report!


6 Responses to “Seahorse Adventures – Loading TGAs (and more)”

  1. Rene Dudfield Says:

    oooh, that std_image.c looks really cool 🙂 tinypyC++ is looking nicer too.

  2. Tenoch Says:

    Just to be sure, you say you’re doing iPhone development on Ubuntu?
    I thought that was not possible. Or are you simply coding something “port-friendly” that will minimize the final glueing you’ll have to do on a Mac in the end?

  3. Shawn Wheatley Says:

    +1 to @Tenoch’s comment. Are you cross-compiling the generated C++ under Ubuntu, or just exporting to the Mac to build under Xcode?

  4. philhassey Says:

    Yeah, I keep my code port-friendly. When I’m ready I still have to build via Xcode to get it on the iPhone. I have a couple ObjC files that give me the audio/video/event info which I use, so that way my game is totally separate from ObjC stuff which is nice for portability.

  5. Jomskylark Says:

    Awesome to see Seahorse coming to iPhone! 😀

  6. Denilson Says:

    Hey, have you thought about using a distributed version control system (DVCS) like Hg (Mercurial) or Git? They allow local commits, which, no doubt, are a lot faster than connecting to the server.

    They have other advantages (you can browse the history locally, among other things). Maybe you would like to see Hg (which is written in Python). You might even use or for Hg hosting.