Windows Phone Development

Main menu

Category Archives: XNA

Today, the Wiphug (Windows Phone User Group Belgium) held their 3rd event.
This time it was in Kortenberg, in a big villa which houses the company Proximity BBDO.

Today we experimented with short talks about Windows Phone development.
So we had 3 speakers, of which I was one of them.
Everybody got a max of 40 minutes to cover a subject.
I like the format very much, because you get to see a lot of things, in a very short time, and from a lot of different people.
So no more feeling you wasted your time because you knew all about the subject or the speaker sucked in your opinion [not that we ever would invite sucking speakers, but tastes do differ] – anyway that “torture” (if you will) will only last for max 40 minutes – not that bad, huh.
Above all that it gives the WiPhug the opportunity to have more speakers, so maybe you feel like you need to share a subject ?
If you feel the need to share, please contact board@wiphug.be and we’ll arrange something.

My talk was about how to play sounds and it’s certification requirements, I choose this topic because of an app I recently published called ‘SheepCounter‘. It was an attempt at writing an app without using code… unfortunatly this is a myth… you need to code several behaviours at least, which you then can implement by clicking your way through Blend. While failing at the attempt of doing a no code app, I did learn a lot about playing sounds, and it’s certification requirements.
And that’s what I wanted to share with you all.

It was a very pleasent evening – like all WiPhug get-to-gethers by the way, and the more we’re organising these events, the more we start to get to know our members/followers.

Just like the Game Development Tutorial on the App Hub we’ll start “thinking” about – or as in this case “analysing” – the game.

To get the analysis proses started, let’s begin with answering the question they propose:

What kind of game is it ?
It’s a puzzle game, puzzle’s are solved when the game objective is reached.

What is the game objective ?A player has won, when the house has been destroyed, and all debris is stacked lower than a certain height and the debris hasn’t touched any of the side buildings.
A game is lost if : a side building is touched by debris, or when all debris came to rest and the minimum height is not reached.

What are the gameplay elements ?
A player places bombs on the blocks that form the building. There are several sort of bombs, those that explode in different directions (like up, left or right) or those that generate different sized explosions.

What are the engineering elements ?The blocks fall just like in the real world, that’s what makes the game so much fun. This means that physics are involved… unfortunately we all didn’t really pay attention enough back in school, to remember all rules of physics. But we’re lucky because some clever people did remember everything from their physics course, and implemented those things in what they call a “physics engine”. The most popular for Windows Phone is the open source Box2D implementation called : Farseer Physics Engine.
You will notice that the physics engine is in fact just an “aid”, it’s a bit weird to comprehend this in the beginning – but in fact the physics engine does nothing else than a lot of calculations.
To represent what happens in your game world you need to draw things to the screen… to maintain what happens when, with what object you will set up and use an object model.

What art assets do you need ?We will probably have a several art assets in our game, things like the blocks, the bombs, the user interface, buttons, etc…
I prefer not to use the art assets yet, I want to get the basics up and running before adding all the eye candy.
The Farseer Physics Engine contains what they call a “debug view”, this is a project that is included with Farseer physics XNA Samples projects zip file. You can use this project to visualize what’s going on in your World… later on we will “paste” beautiful graphics over every object in the physics World.
We also might need audio assets, no game is much fun without sounds of bombs, falling blocks, etc

Let’s create a flowchart of the game… take a look at the example on the Game Development Tutorial on the App Hub.
You will see that they use ellipses for program states (launch game, exit game, game, game over), rectangles for game loop actions (main menu, check for input, movement input registered, fire bullet, check for collisions, bullet collides with enemy, player collides with enemy, draw), and rectangles with double side lines for sub-actions (initialize …, increase …, draw …, play <sound>, update …, highlight …).
If you start your Meesoft Diagram Designer, you’ll see all these “objects” too on the right hand side. Drag a Terminator ellipse on the drawing surface. To change the text right-click it, and type “Launch game”.

Let’s do the same for our Implode!XL clone.

When the game start, the user will see a main menu, where he can choose to start the game, or change the audio settings (music on/off and sfx on/off). When he chooses to start a game, he’s presented a level selector first, where he chooses the level to play. Then the game will start.
We’ll first check for user input, for our Windows Phone game it’ll mean check if a user touched the screen. If the user touched (and held) the bomb stock we initialize a new bomb of that type, decrement the bomb stock with 1, and start dragging the bomb around. If the bomb touches a block, and the user stops the dragging motion, the bomb should snap to the block.
If the user touched the trigger, we’ll cut the blocks that have bombs on them, and then we’ll explode the bomb, this will give the impression that the bomb cut the block.
In the next step we will do some collision detection… of course the physics engine will take care of the collision detection itself, but we want to do things when collisions are detected, like playing sounds.
Then we’ll check if the level is won or lost. This is probably the most difficult phase of the game. We need to find out what is the highest point of our debris, then we need to verify if that height is lower than our minimum height that is defined by the level. We’ll check if the blocks are still falling/moving, if they still are, then it might be normal that we’re not below the minimum height yet.
A timer will be set, when the blocks are not moving anymore and/or when the debris height is below the level defined minimum height.
Last but not least, we’ll draw everything on the screen.

This is it for today. I think we now have a good idea of how our game will work.
In the next articles we will be talking about how to “write” the game.

To really get started, we first need to know why we are doing this, instead of just to wait for the official game to show up in the Marketplace.
Personally, I started this series, because:

I like the Windows Phone

I’m a developer, so I wanted to develop something for my phone

I always wanted to create a game

I wanted to learn XNA – it makes creating games accessible for .NET developers.

I wanted to learn more about Windows Phone – Mango

my wife isn’t convinced that I could create a game like Implode!XL

I wanted something to show off to friends and colleagues on my phone

If any of the reasons above applies to you too, I think you’re good to stay for a while !

I don’t have too much time per day to work on this series, since I’m not doing XNA or Windows Phone (yet) as a day job. Above that my 2,5-year-old daughter asks a lot of attention at the evenings from her daddy. But I promise to find some time during the weekends to work on this – like right now.

Because of my schedule, I decided to focus on Mango, I thought it’ll take a few months to get the game finished, so when Mango is officially released my game should be ready, so why not immediately enjoy the fast application switching, XNA and Silverlight integration, more than 30 fps in XNA, and all the other goodies that can be found in Mango ?

If you have inferior hardware, like I do, (4 year old laptop) I recommend upgrading your Windows Phone to Mango too. To do so, you need to be registered developer, you still can register as a developer, Microsoft will then tell you how to upgrade your phone.

To create a flow chart of the game we’ll use Meesoft Diagram Designer, which is a freeware tool. Download and install it, you’ll need it !

Since the game is mimicking real world physics make sure you download the Farseer Physics Engine from codeplex – or use NuGet to download the engine.

This is the start of a new series, which follows the now popular Windows Phone trend of “do it yourself iOS game name goes here>”.
A Twitter friend of mine called Jo De Greef already created a “Making Your Own WP7 Angry Birds” series.
I wanted to do something similar but with a game I played a lot on the iPad, called Implode!XL by IUGO.

I saw in a Windows Phone XBOX Live commercial that this game is coming to our phones too… yes, even the website confirms it. Of course our game won’t be as polished as the commercial game, but it might get very close though…

The goal of the game is to explode a structure – mostly house shaped -and to make sure the debris remains below a certain minimum height, or doesn’t touch another structure which is close by.
Sounds easy, but sometimes it can be very challenging, especially making sure you don’t break the neighbours’ windows.

I will follow the Microsoft best practices guidelines of the Game Development Tutorial, since I think it’s always best to plan before you start developing, above that, the “plan” will guide our development, and by so we won’t forget anything.