Game Setup and Libraries

So let’s get started. Using a copy of Visual Studio 2010 (or Express) and XNA 4 for WP7 installed I set about creating a few projects. I found it’s a good way of separating the game code from reusable components.

I created the following Windows Phone Game Libraries:

Controller, Core Library, Utility and a multiplayer library.

Initially, they are empty but it’s a good starting block. Then I created the Windows Phone Game project (with the content project for assets). Making the game reference all the other libraries we’re good to go.

As you can imagine, the libraries are self-explanatary. The controller library will hold the gesture reading code (in the future it can handle controllers and keyboards). I decided that the Core Library will be reusable components for any game and potentially any platform (C# ones that is). I was thinking this library should contain the Gui library, rendering component and object management. The Utility library should contain any maths functions, file handling and especially XML handling. I note this because there is no XmlDocument like in normal WinForms. We have to use XDocument instead, so I thought this needs to be wrapped up.

On opening the game project, I stripped out all the functionality to leave one function.

///

/// This is the main type for your game
///

public class MyGame : GameCore
{
public override void OnPreLoad()
{
GameScreen s = new GameScreen(this);
ChangeScreen(s);
}
}


As you can see I’ve created a class called GameCore and this now hosts all the functions instead. I did this as the code is similar from game to game and almost the same for each platform. The only difference between say 360 and WP7 is the screen resolution and timing line.

In my next post, I’ll talk about setting up game screens and move on to the Gui rendering.


Welcome to Blog @ Diagramatic

This is my first post for my blog where I’m going to kick off by talking about my first XNA game for the Windows Phone 7. It’s not complete and it’s in the early stages, but thought I would like to share the journey with everyone.

So here goes, what kind of game did I have in mind? Well, my thoughts were isometric, futuristic city building experience with WP7 influences.

Having sat down and jotted a lot of ideas down and gone through them over and over. It was a welcome relief to draw tiny sketches of the flow, the screens, the gameplay and how more excited it made me to develop it further. It’s a good way to think about if I was playing the game for the first time how I wanted to be drawn in- the introduction, how to play and placing a building. I will share these designs with you too and turning them into reality.

So here’s the state as of today, a quick glimpse of the progress and it running. But I’m going to take you back to the start now and discuss project creation in Visual Studio, coding approaches etc.

PS: If you’re wondering what the red dots are, they are the preliminary work for people/objects moving around the world.

My next post will talk about getting setup in Visual Studio 2010 and XNA, the projects I created and initial structure.

Catch you on my next post soon…