Writing My 1st Zune HD Game – Inertia

All RIGHT! Today is 9/17 and my Zune HD is out for delivery. Naturally I’ve already started making a game for the thing. Well, actually, I’ve started writing the blog post – i’ll keep the post going as I build the game.

Because I don’t have a lot of brainpower left for creativity, I’m going to make the first app anyone builds for a device with an accelerometer, which is the one where you move the ball through a maze and try to avoid going down a hole. Now there are not many kid-friendly titles that you can make with the words “balls” and “hole,” so I am going to tentatively call this game Inertia.

The first thing I’m going to do is make the game project in Visual C# 2008 Express.

Prerequisites (install in this order)


Creating The Zune HD Game Project

  1. Open Visual C# Express 2008
  2. File –> New Project –> Zune Game (3.1) (as shown)

OK, so that was really easy. Now I’m going to create some content.

Making Content

I’ll make a ball, and a background. My thought process at this point is how am I going to make the maze? And the answer to that is to make a tile-based game. Tiles are squares, and the Zune HD’s screen resolution is 480x272, both of which have a common factor of 16. So my tile grid will be 30 tiles by 17 tiles. Kind of an odd number but OK.

First I’m going to use a graphic design tool to make a background of some sort. Maybe something cool and icy. I’ll make a new folder called Textures under the Content folder and save it as background.png.


Next, I’ll make a ball. This should be really easy. It has to fit in any given tile at any time, so it has to be less than 16 by 16. Let’s make it 14x14 just so it stays an even number.


Now I am going to make a single block which I will use as my walls. I will use transparency to make this less ugly in the game.


Remember that we have a grid of 30 by 17 tiles. So let’s mock up a quick level, which we will make into a readable format later. I printed off my grid of 30x17 and penciled in a quick level. The X’s represent holes. The S and E are start and end tiles. I will actually rotate this 90 degrees so that it’s easier to draw on the screen and it overlays the background nicely.

image image

Next I am going to put this into a text format that can be parsed by a content processor. I will use certain characters to denote elements for the tiles:

  • _ : blank space
  • X : hole
  • * : block
  • S : start
  • E : end

The result looks like this:


I saved it as Level1.dat under my content folder in a subfolder called Levels.

In the next post we’ll start bringing a lot of this content together. But before we do that I want to do one last thing: create a Windows copy of the project so we don’t have to deploy to Zune all the time.

Creating a Windows Copy of the Game

The purpose of the Window copy is really to verify layout and other things that are not device dependent. Obviously we can’t very well test playability on a PC, but this will definitely come in handy.

  • Right-click the Inertia Zune project (not the solution) and choose Create Copy of Project for Windows.
  • Go to Game1.cs and find the constructor for Game1. Add the code on lines 6-8. This will force the Windows game to be the same dimensions as the Zune game.
  •    1: public Game1()
       2: {
       3:     graphics = new GraphicsDeviceManager(this);
       4:     Content.RootDirectory = "Content";
       6:     graphics.PreferredBackBufferHeight = 480;
       7:     graphics.PreferredBackBufferWidth = 272;
       8:     graphics.ApplyChanges();
      10:     // Frame rate is 30 fps by default for Zune.
      11:     TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);
      12: }


That’s it for now – next post, we’ll make a little more progress on this game.

Comments (8)

  1. Andrew says:

    I’m just getting started doing some zune hd xna programming as well.  It’s really a great piece of hardware.  Can’t wait to see more of your work. Also, really looking forward to MS releasing some more tegra hardware access to us devs via the xna!


  2. help says:

    Hey bro,you seem to have a lot of experience with xna and c#…can you tell me how and where can i start to learn ms visual stdio c#..?i need to spend my time,got kicked out of school recently…u know 🙁

    my email – president.msn_exe@hotmail.com

  3. Triplesticks says:

    An interesting game idea.  Just received my new ZuneHD and I’ve been looking for games and tutorials on game development for it.  I was wondering when your next post on this topic might be?

  4. balog says:

    Really looking forward to the next article in the series Dan!!

  5. Geo Massar says:

    Have you completed the project yet? I’d like to see it done so

    that I could merge my old maze game into it. Mine will generate

    a different maze randomly every time a player starts a game.

    Email: kawageo@charter.net


    Geo Massar

    PS: Just finished reading your book re: Zune Game Development.

  6. Brock says:

    Great article. Looking forward to the next one in the series? Any idea when that will be?



  7. Wayne says:

    What happened to your next post? Were you sucessful in creating and deploying the Zune game?

    I am extremely interested in your work.

  8. ProtheonX says:

    Hey Dan just wondering if you ever did anymore with this game.  

Skip to main content