Monday, 21 February 2011

XNA Challenge starter Kit 2011 – Getting started

Ok the first thing to note is that the starter kit is only deployable for a Windows 7 Mobile solution developed in VS 2010 under XNA 4.0 on a Windows 7 machine. If you want to run this version in the Windows 7 mobile emulator or deploy it on an actual WM7 phone I recommend you.

  1. Have Windows 7 installed on your PC.
  2. Download the XNA Windows Phone Developer Tools RTW
  3. This has a a bundle of stuff including the emulator needed to run the starter kit as is.
  4. You will also need VS 2010 express or upwards that you can get from Dreamspark.
  5. If you have Vista you may have driver issues with wddm 1.1 driver which the emulator needs along with Direct X 10. At the time of writing I’m installing updates for my NVIDIA 8600M Graphics card. But I’m not sure how this will go so…

If you want to develop the starter kit to deploy a windows and/or XBOX solution you need to

  1. The first thing to do is create a copy of the project for Windows.
  2. Then unload the Win 7 project from the solution.
  3. The solution has been developed on a Windows 7 machine and as such if you compile it you will get an error on the long file name of the project name. So change the name to something shorter.
  4. If it still complains about running because of D3D problems, then edit the properties of the windows version and make sure the HiDef settings are off.

windows_game_properties

The input manager is also only wired up for gesture input from the Windows Mobile. So you have to figure out what controls you are going to use on the XBOX controller and then have a look at the Input Manager and then edit the input manager to allow for these. The engine is well coded in general with State maintained quite well. Input enum values give rise to changes in game state in the game engine.

Here is an alternative Keyboard manager function – only up and space are programmed to react here. Space changes the game engine state represented by

public enum GameState { Splash, Play, Win, TryAgain, Loading }


see Engine.cs



private Input HandleKeyInput(Game.Engine.GameState gameState)
{

Input input = Input.None;
keyboardStateCurrent = Keyboard.GetState();
if(KeyJustPressed(Keys.Up))
input = Input.Up;
if(KeyJustPressed(Keys.Space))
input = Input.Select;
keyboardStatePrevious = keyboardStateCurrent;
return input;
}


 



and here is the appropriate change to the PlayerInput to switch from the gesture managed code to keyboard managed



public Input PlayerInput(Microsoft.Xna.Framework.GameTime gameTime)
{
Input input = Input.None;
//#if !WINDOWS || !XBOX
//input = HandleTouchInput(XNAGameStudioIrelandChallenge.Engine.Game.Engine.GameState.TryAgain);
//#endif
input = HandleKeyInput(XNAGameStudioIrelandChallenge.Engine.Game.Engine.GameState.TryAgain);
return input;
}


This game engine and scene manager are well written. The tile editor concept you have covered with Neil. With minor changes you should be able to load your own content and change the behaviour of the game.



An amended copy of the engine code with the changes detailed above can be found in XNAGameChallange2011ModifiedByPPVS2010.zip here. You will have to logged in to windows Live and a member of the year 2 Games Group to access this folder.



There is nothing in this project that you cannot do in XNA 3.1 I think. To import it you’ll need to open up a new project and import all the folders and code into the VS 2008 project with XNA 3.1. It’s a pain but doable.



I will blog more on the structure of the Game in a later post.

No comments:

Post a Comment