Monday, August 11, 2014

Adventures in

With the Christian Game Dev contest coming up, I decided to use a game engine I've wanted to use for a while.  There's a web game engine called Phaser, written in Javascript that uses Canvas or WebGL for rendering and HTML5 for audio.  The documentations and community is awesome, they even have an IRC chat room where you can get instant community support!

The Competition

For the competition theme this year, you could pick from one of three verses.  I chose the Hosea 6:6 verse which says something like, "For I desire mercy, not sacrifice, and acknowledgment of God rather than burnt offerings."

Yer a pirate yarg!

In my game you're player is a pirate and you go around collecting treasure and fighting while running from the King's men.  At one point you get caught, told the truth and are given the option to be pardoned and join the King's men or be banished.  After you join the King's men you are given a new sigil, clothes and a mission to recover the King's treasure/keep the peace and offer the same deal to any other pirates you encounter.  Get it?  I know, I'm no C.S. Lewis, but it's one of my favorite CDN game ideas so far.

I spent too much time on creating assets and just figuring out how to work with Phaser, and then went on vacation half way through the allotted time, so I never finished it.

Pirate sprite sheet

I used Tiled for making the levels, photoshop for all the art and did my coding in Sublime.

Custom props!

In the end I would say that Phaser is a good engine for creating a web game.  It has just about every kind of example you need to make your 2D game.  The downside of Phaser, for me, is that it is written in Javascript and I have yet to find an editor that I really like for Javascript.  XCode has ruined me with it's code completion and super easy navigation.  With Phaser, I was constantly flipping back and forth between the API in browser and Sublime, where as in XCode I would use auto-complete or cmd+click my way to the header files for whatever I was working on and rarely have to use my web browser for anything.  Sooooo much faster!

If you have to chose a platform for a web game, I'd say Phaser is one of the best I've seen, but if you don't really care so much about open source and not needing any plugins you can always join the herd and head over to

Tuesday, April 1, 2014

3D Puzzle Game "PZL" Released!

Back in, oh, last year I threw together a game for Ludum Dare 26 called "Puzzle Cube" that was built entirely on Ogre3D.   Shortly after, I ported that game to iOS and showed it to a friend who really encouraged me to develop it into a full-on mobile game with levels, scores, and everything. Since then I've made 30 code commits and added a bunch of features and levels and released it on the iTunes Store  under the official name PZL.  Dayum.
Well actually, in PZL you control a glowing blue orb that starts at the base of the puzzle tower.  Each level of the tower can be rotated so you can move the blue orb up till you reach the end of the level - and eventually the top of the tower.  Along the way you'll discover tunnels through the puzzle, prizes, and monsters to evade.

The Journey.

So how did a game that started out looking like this:

Ludum Dare 26 - PuzzleCube
Get to this?

First of all, porting to an iOS mobile device when you start out with a Windows build isn't a walk in the park.  In Windows your render loop is probably some endless while loop or frame listener.  On iOS you have an Objective C app that sets up a CADisplayLink callback on a frame interval.  The callback then manually instructs Ogre to renderOneFrame.  Then there's the matter of getting input from the keyboard, touch input, outputting audio, not to mention any kind of networking or saving to disk you might need - ouch!

Let's talk bout some of those -


I used the OgreDemoApp/OgreFramework for iOS as a base so I had to refactor my initialization code so it worked with the OgreFramework.  I had to pass down some things like the scene manager, camera and window handle to my main game class.  I also decided to make my Game class a singleton mainly referenced through the OgreFramework so I could easily pass down frame render events and input events from OIS, but I probably could have architected it all differently and merged my main game class with the OgreDemoApp class.   The downside of merging would have been that I would have a lot more code in that merged class that wouldn't get used on say the Windows version.

Also, I had to remove all the OgreBites tray code and the majority of the camera manipulation so my game could control it instead.


Things got a bit hairy when I needed to expose some things to C++ code that were only available in Objective C, namely audio, keyboard input and session data (stored in NSUserDefaults).

I chose to use the SimpleAudioEngine for audio which comes from CocosDenshion (Cocos2D also uses this).  It's a really simple audio player that easily handles background and event audio.  So how do you access an Objective C class from inside game code which is written in C++?

What I did was create a GameAudio Objective C class:

The implementation file for GameAudio (named has my functions that call the SimpleAudioEngine class like so:

To call those GameAudio functions from C++ I provide another header file called GameAudioInterface.h with headers for the functions in

Keyboard Input

WARNING HAX.  I created a GameKeyboard Objective C class with an invisible UITextField added to the main UIWindow.

Inside the implementation file I provided functions to show/hide the keyboard and called functions in my main game code when a key was pressed.  Because the game code used OIS I had to map every character to the OIS equivalent. YUCK.

Lastly, I exposed the keyboard show/hide functions in a header included in the C++ game code called

Hopefully that code saves somebody some time.

Other  Objective-C Stuff n' Thangs

OK besides audio and keyboard libraries I used NSUserDefaults to save some basic settings and the excellent Scoreoid API for saving player scores.  For those who are unaware, Scoreoid lets you save scores for free using their platform agnostic API so this means if I port the game to Android I can access the same score data in the future.

Lastly, I implemented the Chartboost SDK to serve ads.

Technology Used

Graphics Engine: Ogre3D
GUI: Gorilla
Input: OIS
Audio: SimpleAudioEngine (CocosDenshion)
Scores: Scoreoid
Animation: CppTweener
Network: AFNetworking

That pretty much about sums things up as far as the development goes.  I do plan on adding some more gameplay elements in the future if the game has enough of an audience to warrant updates.

You can download PZL via the iTunes App Store on your mobile device or click the link here:

Thanks and enjoy!

Saturday, January 11, 2014

My Fav Games 2013

Before the game list I'd like to say the obvious - I've been really busy being a dad and running a business ( and that has left me with little time to play or make games this year.  I've have done a TON of iOS development and a good bit of web dev and am about to release a small puzzle game for iPhone/iPad soon - will post about that when I do. With that out of the way -

A new year is upon us. Again.  So what games were awesome in 2013 for me?

Natural Selection 2 -

I spent a good bit of time playing this, mostly because I don't have enough time to commit to an MMO and I like to be able to jump into a quick game and out.  The dev team has also been putting out some impressive updates to the game that have kept it interesting and fun.  Also, the e-sport aspect of this game is immensely entertaining as well, and the matches have made appearances on front page often for good reason.

Mass Effect 1 - 3 -

This game was the most compelling single player game that I played in 2013 - I had to buy it after it went on sale and after hearing how much the ending upset so many people.  Load of fun and graphics are pretty good.  If and when this franchise continues I will be watching to see if I want to continue my characters.

Minecraft -

My 4 year old son loves this game and because of that I have gone through the hell that is minecraft mod setup on multiple machines and servers.  It has been worth it though, and has provided us a ton of fun multiplayer gaming and I would even say it has taught my son how to use a mouse and keyboard.

Civilization V -

This game has remained on my favorites list because it is so casual and addictive and sometimes I don't want to get my heart rate up trying to shoot things in a twitched based game.  For casual and still awesome I recommend Civilization.

As for honorable mentions,  I also tried Borderlands, various X3 expansions and a few mobile games, but nothing really kept my attention for long except those listed above.  Hopefully I'll have more to post soon after releasing this mobile puzzle game I have in the oven.