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:

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:

Swift

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

#ifZUNE

// Constants for controling horizontal movement

private const floatMoveAcceleration=7000.0f;

private const floatMaxMoveSpeed=1000.0f;

private const floatGroundDragFactor=0.38f;

private const floatAirDragFactor=0.48f;

...

#else

// Constants for controling horizontal movement

private const floatMoveAcceleration=14000.0f;

private const floatMaxMoveSpeed=2000.0f;

private const floatGroundDragFactor=0.58f;

private const floatAirDragFactor=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.

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 ?