After eventually upgrading to an Intel-based Mac and purchasing a second-generation
iPod Touch I was eager to start developing games for it as quickly as possible. My
first project had to be something that looked good while relying only on the most
basic iPhone/iPod Touch functionality. No OpenGL 3D stuff or networking, because that
would take too long to learn. I decided on a Soko-Ban clone. That was a
game I knew how to build, but it had never felt challenging enough on other platforms.
It needed a gimmick. I got into iPhone development a bit late and too many
other people had built straighforward Soko-Ban adaptations already. It occurred to me
that the game might be a little more interesting if it had different block types.
At least if they were made of chocolate. (And a natural protagonist of a chocolate-based
game is of course the Easter Bunny.)
The game controls presented a bit of a problem. My first instinct was to go with
a completely event-driven user interface. You'd drag the rabbit around on the
screen with your finger. I even came up with a pretty neat algorithm that made the
rabbit "smart" enough to walk around corners by himself (because there'd be a lot of
obstacles) and gradually catch up with
your finger if he had to take a little detour. (You can try a demo below. The
red square represents the rabbit.)
But I had to give up that idea when I realized that some levels might have to be bigger than
the screen, and scrolling and dragging at the same time is too ambiguous.
There are ways around that, I suppose, but no matter what, controlling the rabbit near the
edges of the screen would become unnecessarily complicated or frustrating for the user.
Instead I settled for an interface where you clicked and dragged on the piece to move,
or clicked on the spot you wanted the rabbit to walk to. That freed up general dragging
for panning the view. The only tricky part about that was developing a path-finding
algorithm for the rabbit ... which wasn't very hard at all, since I had
done that before.
Of course, when I later ported it to mobile devices that have control keys and joysticks,
the user interface became trivial. (Except that there was no obvious way to scroll
the screen, but I skipped that part.) Building an entirely new set of code in J2ME based on
the remaining parts of the Objective C original took just a little over a weekend.
And as usual I also built a version of the game that runs in the web browser. Recently
I put together a little library that lets me compile J2ME code directly into a J2SE
applet. There are plug-ins you can use for that, but I prefer my home-made solution.
It's less buggy.