Categories
Uncategorized

Counting Down to Seven: “Platformer” Running on Windows Phone 7

Welcome to another installment of Counting Down to Seven, a series of articles about mobile app development that I’m writing as we count down the days to MIX10, when we reveal more about the up-and-coming Windows Phone 7 Series.

In my last article in the Counting Down to Seven series, I showed you Platformer, the game starter kit that comes with XNA, the toolset/framework for developing games for Windows, XBox and Zune:

image

Let me now show you this – Platformer running on Windows Phone 7:

That’s Microsoft’s Eric Rudder, Senior VP Technical Strategy demoing Platformer at the TechEd Middle East conference. Not only does Platformer play on Windows Phone, Windows, XBox and Zune, but he also demoed saving the game state on the phone and resuming it from the saved state on an Xbox 360.

Eric also showed that even though Platformer runs on a number of platforms, it’s based on a single codebase with slight platform-specific tweaks for the platforms it targets. This isn’t new: XNA has been about targeting Windows and Xbox 360 from the very beginning, and with version 3.0, the Zune was added to the set of target platforms.

Take a look at this screenshot of the Solution Explorer from Visual Studio 2008 with XNA 3.1 with a Platformer solution loaded. Note how the solution has three projects, one each for targeting Windows. Xbox 360 and Zune:

image

All three games share the same sounds, but the Windows and Xbox 360 versions use a set of higher-resolution graphics while the Zune version uses a lower-resolution set.

XNA also makes use of compiler directives to handle the differences between platforms. For example, here’s a code snippet from Platformer from the Player class, which manages the player’s character in the game:

#if ZUNE
        // Constants for controling horizontal movement
        private const float MoveAcceleration = 7000.0f;
        private const float MaxMoveSpeed = 1000.0f;
        private const float GroundDragFactor = 0.38f;
        private const float AirDragFactor = 0.48f;

...

#else
        // Constants for controling horizontal movement
        private const float MoveAcceleration = 14000.0f;
        private const float MaxMoveSpeed = 2000.0f;
        private const float GroundDragFactor = 0.58f;
        private const float AirDragFactor = 0.65f;

...

#endif

Note how the Zune version has scaled-down values of those used in the Windows and Xbox 360 versions. That’s to account for the Zune’s smaller screen.

XNA on Windows Phone 7, with the ability to save game state on one platform and resume playing on another opens up a world of “ubiquitous gaming” possibilities. I hope that this will bring about some interesting mobile games and bring some attention to the XNA, which I always felt was underappreciated.

This article also appears in Canadian Developer Connection.

3 replies on “Counting Down to Seven: “Platformer” Running on Windows Phone 7”

Saved state, will certainly make those bathroom breaks more, um.. ‘productive’ :) but watch out for the guy trying to finish off level 43 while driving to work.

Saved state was something that I think relates to Live Mesh by syncing data between devices.

I’m definately looking forward to getting to grips more with Silverlight+XNA

Top marks to the commenter who said Live Mesh was the machinery behind the syncing of state – though I was the only one that noticed that :)

Live Mesh + XNA + Silverlight + Visual Studio. Awesome!

Based on the YouTube video – does the “desktop” (i.e. game background) scroll to the right when the player moves to the right ? I noticed that some of the level on the right appeared to be missing on the phone. Will it scroll, natively, to provide the same dimensions as the PC/Xbox 360 version or has it been explicitly trimmed ?

Either way – this rates a 10 out of 10 on the cool scale…

Comments are closed.