Phil Hassey - game dev blog
Phil Hassey as Wolverine
"What kind of
arrogant jerk
has a website like this?"

Archive for February, 2009

Beast for iPhone / iPod Touch

Monday, February 23rd, 2009

Hey!  We got a new game for you to check out!  It’s called Beast!  Beast is a really cool re-make of an old MS-DOS text-mode game that I used to really like.  (It’s similar to Galcon in that sense.)  It also has a slick retro-graphics feel to it that I’m pretty happy with.

Buy it now – Only $0.99!!

One of the most fun things I added into the game was the beast images.  They are based on creations by the Bungled Jungle which is located in Salida, CO.  This store sells amazing monsters that they create in their studio.  If you haven’t seen their stuff before, be sure to check it out.  Tell ‘em “Phil Hassey” sent ya :)

P.S. If you are a software developer, or are interested in knowing more about the design decisions that went into this game, check out my dev blog.

Beast for the iPhone / iPod touch

Monday, February 23rd, 2009

Today marks the release of my first iPhone game release in five months.  It’s about time I got going on dev again.  I’ve been in the midst of many transitions in both of my businesses, so I decided to start out with something short-n-sweet.  The game is called Beast.

Beast is a re-make of an ancient MS-DOS game that I played ages ago (and I’ve re-made several times).  The original is here.  You may have followed my progress on twitter.  Here are some interesting “factoids” about the game dev.

The original game is pretty tough to play, if you have dosbox and have all the proper slow-down settings going, you’ll find it can be a challenge to surround the beasts and crush them with blocks.  The iPhone doesn’t have a D-Pad, so moving a character around the screen is a bit tricky.  I had to make several modifications to the original game so that it would work with the touch interface:

  • You can move the player around the screen by pushing your finger around.  However I had to make the player unable to move diagonally as I found the resolution of your finger movement made it near impossible to play and quite jumpy if I allowed diagonals.
  • You can touch any point on the screen and warp to that location.  The controls were still a bit tricky, so I had to add this feature so you could do quick movements to escape from a beast, or to attack it quickly.
  • I disabled the beasts so they can’t move diagonally, made the super beasts spawn into only 4 instead of 8 normal beasts, and slowed down the beast movement by about 50%.  These changes were all required to make the game playable.

All these changes turned an impossible to play on the iPhone into a reasonably fun diversion.  I also added a notable element of speed into your score.  This gives the player a good bit of replay value, since even after they beat a level, they can try again and try and “master” a map they are playing.

Overall the main point of this whole exercise was to get myself back into iPhone dev.  Really last year when I worked on Galcon I threw myself violently into that project for 3-4 months and came out a bit burnt out.  I knew this time I needed to do a small scale project to get going again.

I’m pretty pleased with the results of this project.  For some more interesting factoids about the game project, check out my game blog announcement.

Excuse to post this to the python planets: I actually made a python version of this game a few years ago.  It contains some really bizarre pure python sound-synth for both the music and sound effects.  Check it out.  Not only all that, but the whole game is a single 18k python file!  I ported from this code for the iPhone version.  Again, another great example of python prototype -> C++ final product!

(Silly side-note, actually the python code was a port of some C++ code I made ages ago.  So this is a great example of C++ code that was ported to python and then later ported back to C++.  I won’t bother you with details about my even earlier Java and C versions of the game.)

Bundling SDL_image.framework and SDL_mixer.framework

Saturday, February 21st, 2009

So if you are trying to build a SDL + SDL_mixer + SDL_image + OS/X + Xcode game .. well .. when you build it using the SDL Application Templates, you’ll find that it includes the SDL.framework in the application bundle but it does NOT include the SDL_image.framework and SDL_mixer.framework in the bundle.

Which means, it will work on your computer if you’ve installed the SDL_image and SDL_mixer frameworks in /Library/Frameworks .. but it won’t work on any computer that does not have those frameworks installed.

The error they will see if they happen to run your app from the command line will look something like:

 

dyld: Library not loaded: @executable_path/../Frameworks/SDL_image.framework/Versions/A/SDL_image

  Referenced from: /Users/phil/tmp/ibeast_osx.app/Contents/MacOS/ibeast_osx

  Reason: image not found

This blog has some instructions on how to deal with this.  However I still found it confusing that I had no idea where these “New Copy Files” rules were being placed.  Especially since I knew the SDL template had one already and I wanted to just modify that rule, or duplicate it.
Here’s where to find those rules from your SDL template project:
Groups & Files > Targets > (name of your project) > Copy Frameworks into .app bundle >
And you can drag your SDL_mixer and SDL_image frameworks onto that list.

Can’t do everything ..

Wednesday, February 18th, 2009

Alas, I’m not going to be able to make PyCon this year .. Because I’m a finalist in the IGF Mobile competition 🙂  And the GDC is happening the same week as PyCon.  Oh well, can’t do everything.  I wish I could go to both, PyCon was a blast last year!

That said, some of us tinypy folks might do a tinypy sprint at the same time as the PyCon sprints.  So if there are any people at PyCon who want to sprint on tinypy, get in touch and we can all work together in #tinypy somewhere.  Further news about this sprint will be available in the tinypy mailing list.

tinypy has progressed a bit since I last posted about it.  It’s probably sandboxed and it now has meta methods.  If there are some serious smart VM coders who are interested, we could use a hand.  tinypy is as fast as python for some tasks, but for other things it is around 1/2 the speed of python.  It also uses more memory than python.

From python to C++

Saturday, February 14th, 2009

I think I wrote an article a few months ago comparing C and python.  I’m doing some new iPhone games now, and this time I’m using C++.  I found not having classes was getting to be too painful for me, so I’m trying out C++.  Here are a few things I’ve observed:

(As a side note – I’m writing my games /almost/ the same way I’d write them in python.  So if you’ve seen my game code, I’m doing almost the same stuff, except in C++.)

  • As usual, not having memory management is a bit of bother.  Fortunately, I’ve found there are only a few places where I actually need it.  The main thing I had to do was write some basic reference counting code for my state engine class.
  • I’m using structs instead of classes, since I have no use for private variables or methods.
  • Having separate .h and .cpp files is a drag.  But them’s the breaks .. It sure would be swell if C++ was a wee bit smarter about that.
  • For my in-game objects, I just define a single struct that has all the possible variables I need.  This is pretty much how I did things in python anyways.  I’ve never been a big fan of using much inheritance.
  • For writing my GUI classes, in python I was able to get lots of magic into them.  In C++ it isn’t so easy to get magic, so I’m doing without most of it.  It seems that most of the magic was gold-plating anyways.
  • Having written all this code in python before, getting clean C++ code seems pretty natural.  I know what I WANT my code to look like, so I try to get my C++ to be as close as possible to that. 
I think the bottom line of this post, is that my code is coming out pretty pythonic.  Maybe?