Thursday, 4 October 2012

More Than Just a Lunar Landar (Got Game #2)

Description: \\van-web2-vm\w$\FWIC_Web\Portals\3\MBS_AvatarHead.pngAfter deciding to create a game for Windows Phone, I needed to come up with a way to make it “different”.  Lunar Landers have been done to death.  There were at least 6 “lander” games in the Windows Phone Marketplace and countless numbers for other platforms.  I did start out with the simple goal of landing a ship on the moon.  I looked at what others had done and invariably found them too difficult, not great looking or simply not fun (meaning one and done for play).  I freely admit that the too difficult might just be that I am a really terrible gamer, but that is an entirely different subject and am sticking with the “it’s just too difficult” excuse.

Physics Follies

So I began.  The only real hurdle (not discussed in the previous blog, Geek’s Got Game Too!) was the physics.  Making something fall just right and move just right when you fire engines requires math…  I always thought that’s why we had computers so I wouldn’t have to do that stuff…  However game require math.  Not simple math, but math that makes your brain hurt.  So I wacked my head against the keyboard a few times while using every search engine on the planet trying to re-learn my high school physics on gravity and Newtonian physics.  My brain hurt.  Then I found Farseer Physics at codeplex.  This was a free, nifty little library that mostly did the heavy lifting math for me.  Woo Hoo!  After a minor bit of learning I had things plummeting to the moon service in seeming slow motion and was ready for the next phase, making it interesting. 
Tip: Download and learn the Farseer Physics Engine @ http://farseerphysics.codeplex.com/

Make it Fun and Interesting

Generally in development, one of my associates likes to think in terms of non-traditional development phases:
  1. Make it work.
  2. Make it work right.
  3. Make it work fast.
In gaming, I would add one more rule, which is
    4.       Make it fun and interesting.
Tip: Get all the basic stuff working before getting fancy or you could fall down the rabbit hole and never come out.

Custom Landing

In my lunar lander (now named Fusion Invasion) I had made it work and made it work right (fast is relative to the gravity applied I learned) and it was now time to make it fun and interesting.  We brainstormed a bit and came up with adding some flexibility in gravity, surfaces and quality of the lander (how tough a landing could it take) but that just wasn’t enough.  Then, I believe it may have been our CTO, aka “The Houbenator”, that came up with a social media hook.  What if, he posited, you could use the phone's camera to take a picture of any location and then have the lander land in that location?  Then, what if you could share that picture and brag with friends about your magnificent landing?  That would be FUN!
I spent the next few days working it out.  Besides the standard landing surfaces of Earth, the Moon, Mars and Titan I added a custom landing mode where you could select a picture or use the camera to take a picture and then land in that spot.  Learning the interaction with the built in camera was actually pretty easy.  The WP7 SDK has built in functions to make it happen.  The first thing I did with it was land on the Houbenator’s desk. 
Of course, just landing on the desk wouldn’t do a lot of good unless I could take a screen shot of this.  I found a nifty way to use the XNA media library to store a capture of the screen to the “Save Pictures” library on the device, basically changing the device output for the Draw function to draw to the picture library.
Tip: There are some great examples in the App Hub Forums.  Search for “Screenshot XNA Medialibrary” and you will get all you need!

Social Media

The hook that really drove us from Lander to Lander++ was social media integration, after all, that’s what Windows Phone 7 Mango was all about.  So we excitedly setup a facebook page (http://www.facebook.com/FusionInvasion) and then went to work using the nifty Windows Phone integration with facebook…  Or not!
That didn’t work out too well after all and brings us to the tip of the day.  Because of licensing and privacy issues between Microsoft and Facebook (at least as far as I could tell) you can’t access that pipeline from your application to post things.  Same for Twitter.  If you want to post stuff to facebook you have to write your own integration with the Facebook API.  When the player uses your app, they will have to provide Facebook logon information and agree to privacy sharing stuff (again, even though they did it for the phone once already).  I wish it weren’t so, but…
As time was running out on our development schedule, we implemented the custom mode invasion using the camera or camera roll and implemented the screen shot, but the posting of your fabulous landing locations ended up being left to the user for now.  It's pretty easy to do from the Pictures hub!
Tip:  Social media integration is important!  Learn the facebook API and Twitter API and plan the time it will take to integrate your App!

Sound Effects and Fun

When developing games use any and all resources you have available.  I have a 10 and a 14 year old in my household who served several purposes.  The 14 year old boy contributed many of the comments provided by the game when you land successfully or crash and burn.  It enabled the game to sound much cooler than it likely would have.  They both play tested the game for me, and did a far better job than I did.  And lastly, when you land successfully you get cheering in the background.  I had the kids cheer into a microphone and then with a little sound processing using “Power Sound Editor Free”, I had a fun sound effect to use when a successful landing takes place.  Wherever possible, I think a sense of humor is just a good thing.  My flag is an ode to Bugs Bunny and a fondly remembered short where Daffy has a flag for a tail (drawn by Bugs).
Tip: Use all resources available.  Have kids you know (and their friends) try the game; you will learn much and possibly, if lucky, release your inner teenager!