Monthly Archives: March 2012

MonsterUp wins Swiss App Awards Best Game App award.

Posted by admin on March 22, 2012
Development, Games, Windows Phone / 1 Comment

After a lovely evening at the Marriott Hotel in Zurich, Switzerland, we are proud to say that we are going home with the Best Game App award for MonsterUp. MonsterUp was among the 5 nominees for Best Game App and App of the Year categories for this year’s competition and has won this prestigious award against all odds ;)

MonsterUp is now officially the best mobile game made in Switzerland!

How fast can I get up and running with Windows Phone game development?

Posted by admin on March 09, 2012
Development, Games, PC, Windows Phone / 1 Comment

I was asked the other day by a colleague how easy it would be to start developing a game for Windows Phone from scratch. After explaining him that developing a game for Windows Phone essentially means developing a game for Windows 7, Windows 8 and XBox 360 at the same time, I decided not to describe how easy it is but to actually show him. I also timed myself.  He had seen MonsterUp on the web, and was curious how it would be possible to simulate gravity , so the challenge was to make a ball bounce on the screen. I already had Visual Studio and XNA installed on my computer, but if you want to follow this and see how easy it is by yourself, you can download the free tools here. With a simple installation you will have everything you need including a free version of Visual Studio and a phone emulator. You can use these tools to develop for Windows Phone, XBOX 360 and Windows with little or no changes to the code.

So back to our bouncing ball tutorial. Consider this a “Hello World” for game development in XNA and Windows Phone. I guess I should mention that knowledge of Object Oriented programming is required here as well as some C, C++ or C# knowledge. We use C# for XNA.

Launch Visual Studio and choose to create a new Windows Game (File->New->Project). Name it whatever you want. I named mine “Gravity”.

Download a ball texture. I have one here for your convenience. Put it inside the Content directory that exists in your solution directory (which you created before). Drag and drop it on the Content section, in the Solution explorer of your solution. Your solution explorer should look like that:

If you click on the ball.png you will see that it has been assigned an automatic asset name “ball”. This is how we will recognize it when we load it in the game.

Now double click on Game1.cs on the Solution Explorer. This is the main game file which is automatically created for you. In here, there are a few important functions, which are also created automatically for you. One of them is called “Update”. This is called automatically and as fast as possible by XNA. Another is called “Draw”. Also called automatically, but depending on how heavy your game is, it may skip its run (in the default configuration) if the system it runs on cannot handle the load. This is called frame skipping. The important thing is that within the Update function you update the game logic (sprite movements, AI etc.) while in the Draw function you … well… draw stuff on the screen :)

Anyway, back to our ball thing. After “SpriteBatch spriteBatch” near the beginning of the file, add the following lines:

Texture2D ballTex;
Vector2 ballPosition;
Vector2 ballVelocity;

The first one creates an object which holds graphics (or texture) data. The other two are Vector2 objects, which essentially holds two float numbers. We will use the Vector2 objects to hold the position and velocity of the ball (duh).

In the LoadContent function (which is called once in the beginning of the game to load stuff) add the following line (after spriteBatch = new SpriteBatch(GraphicsDevice);)

ballTex = Content.Load<Texture2D>(“ball”);

With this small line, you have actually loaded the ball texture in the ballTex object. The Content object handles the loading depending on the file type (in this case, a .png file is loaded on a Texture2D object).

In the Update function, before the base.Update(gameTime) add the following lines:

ballPosition += ballVelocity;
ballVelocity.Y += 0.1f;
if (ballPosition.Y > 100)

    ballPosition.Y = 100;
     ballVelocity = -ballVelocity;

These lines update the ballPosition (by adding a Vector2 to another), simulates gravity (by adding a float to the Y component of the velocity – so the gravity pulls the ball towards the bottom of the screen) and also handles bouncing (if the ball moves beyond 100, reverse the ballVelocity and return the ball to the “ground”).

Finally, in the Draw function, add these lines before base.Draw(gameTime):

spriteBatch.Draw(ballTex, ballPosition, Color.White);

I’ve also changed the background color to Black, but this is optional.

Believe it or not, we are done! With 12 lines of code, we have a perfectly bouncing ball. Not really a game, but you get the point. Hit F5 and watch your little ball bounce away on your Windows PC.

And now for some XNA magic. The challenge was to create a Windows Phone game that does exactly that, not a Windows game. No problem! All you have to do is right click on “gravity” (the one with the Windows flag next to it) inside the Solution Explorer and choose “Create Copy of Project for Windows Phone”. Choose Windows Phone 7.1 and click OK. This creates the necessary files for a Windows Phone project but keeps the same source files which are shared between the Windows project and the Windows Phone project. Now right click on the Windows Phone Copy of gravity and select Set as Startup Project. Hit F5. This should launch the emulator and run your game. No code changes (you may need to rotate the emulator using the rotate button on the left to see this properly).

This is just a simple example, but you get the idea of how powerful this stuff is. You can improve the physics (or use the excellent Farseer library), you can include nice visual effects, a way of actually interacting with the game, menus, sprites etc. but if you can create a bouncing ball in 5 minutes you can see how easy this will be.

Here is the final solution if you are too lazy to type 12 lines (or you otherwise get stuck somewhere).


My thoughts on Windows 8 and the future of Microsoft

Posted by admin on March 02, 2012
General / 2 Comments

I’ve written on my previous post that I think Microsoft is the new Apple when it comes to innovation and coolness factor. I would like to elaborate a little bit on that.

Microsoft has earned a bad reputation on many fronts until a few years back. Windows were not cool looking, they used to hung a lot, the blue screen of death became legendary, windows mobile was a mess out of hell. Around 2005-2006, things started changing for the better. The priorities of the company seemed to started shifting (slowly, think about the Titanic trying to steer away from the iceberg). Apparently taking a few lessons from Apple, since they have been taking lessons from each other for years now, cool and fun appeared on the table. Yes, I know Vista was released in 2006, but I never said that all efforts to become the new cool and fun were successful, now did I? The ideas were there though. Vista did introduce cool hardware accelerated glass semi transparent windows. It did try to give access to fun stuff, like Windows Media Center, speech recognition and more. It failed, but the ideas were there, and when they eventually got it right with Windows 7, they showed their potential.

What Microsoft has, that noone else has, is a huge installed user base and huge 3rd party software support on the desktop. It did take them long enough, but I think they did realize in the end that only by utilizing this they could emerge victorious in other market sectors as well. Let’s take mobile for example. Windows Mobile was a disaster. I think we all agree on that. They idea of taking something that works with a mouse and trying to minimize it almost without any innovation was a bad idea. Windows Phone fixed that. It did. The metro was built from the ground up with touch in mind. They did realize that fluid and fast was much more important than showing more leather on the screen (pun intended). It’s a mobile device. The user needs to get to his information in seconds, because he is on the road, he is holding a device with one hand and it’s raining. A chromeless UI that focuses on the actual info is the way to go. But still, Microsoft has not done what I was talking about before, utilizing the Windows stronghold. Actually, they might have tried to do that by naming the phone, Windows Phone. If you ask me, that was a mistake exactly because they had Windows Mobile before that. Even now, more than a year after the initial release, people and more importantly sales personnel, confuse these two. And that is a BAD thing for Windows Phone. If you ask me, the new Phone OS should be called something like xPhone. But that’s just me.

Coming back to today. A few days back, Windows 8 progress was shown. What I find really amazing is the idea behind Windows 8, and not just how nice the OS looks. I’ve heard the argument that Metro is just a launcher or a shell on top of Windows, not unlike Sense is a shell on top of Android for HTC. This is not the case, as I understand it (and I hope I am not wrong). Metro allows Windows 8 to run on a touch device and provide the user everything they could get on an iPad or Android tablet on day 1 of release. Instant on, fast and fluid, looking gorgeous. I also hope that the user will remain in Metro UI for the whole experience and will not be forced to go to a classic desktop app if he does not ask for it. Let me give an example. Back in the old Windows Mobile days, manufacturers liked installing cool looking shells on top of the OS, in order to differentiate themselves from the others, and make their phones look cooler than the next guy. Problem was, that all these were just smoke and mirrors, since at some point, sooner or later, the user was forced to go back to the ugly Windows Mobile interface, be it for accessing a file type the manufacturer did not have a cool viewer for, go to the settings or something along these lines. This was really bad. The experience was fragmented. Let’s go back to Windows 8 now. My idea of awesome Metro experience is that the user always stays on Metro UI for doing all the things we wants to do every day. Read their email? Cool metro email client. Open images and documents? Cool metro file viewer. Twitter? Facebook? Metro apps. Edit a word file? Choice! Both a stripped-down metro app (like the Windows Phone office suite) or the full fledged Word on the classic desktop.

And this is where the double-edged sword lies.

Maybe the biggest strength of Windows 8 against iOS and Android is that it is Windows. It is not a stripped down, mobile oriented flavor of Windows. It is Windows. It runs everything, it supports everything. You have a Windows 8 tablet with you so you can do all the cool things you can do with an iPad on the road. Fast and fluid. Browse the web, read email, play Angry Birds (maybe play MonsterUp in the future) etc. In this usage scenario you should never be forced to leave Metro. This is important. When you reach home though, you can still use your device as a full Windows PC. Connect a wireless mouse and keyboard or use the awesome Wacom digitizer the device featured on the screen to use Photoshop CS6 as a pro. No compromise. Write the next Windows 8 app on Visual Studio. On the same device. When you try to open a PSD file on an iPad, this is where you have reached the stripped-down, mobile-only OS’ limits. If someone did not create a PSD file viewer on iOS, you are out of luck. And even if someone did, you will not be able to edit said file. And if someone actually DID create a simple PSD file editor, it will not be photoshop. On Windows 8 you can have it all.

Now that is clearly a no-compromise experience.

On top of that, Windows Phone 8 “Apollo” will also share the same kernel as Windows 8. This is huge! This can open up amazing possibilities for a unified ecosystem. And if the next iteration of the XBox joins the party, it is clearly a very good implementation of the 3 screen approach by Microsoft. Running the same software everywhere? Maybe not exactly, but there is no need to. Noone wants to run Photoshop on their phone even if the could. But in the background, there are huge advantages. Unified drivers. Unified libraries (we already have that to an extent with .NET but this can be extended with native code). This can be translated as faster and more stable development for all screens and of course, shared software with universal binaries.

In my eyes, no other company can achieve something similar and since Microsoft has finally got their heads out of the sand, it is a golden opportunity to see this happen. Hopefully this year. I’ve said before that 2012 will be the year of Nokia. Maybe it will be the year of Microsoft+Nokia.

So to sum it up, if Microsoft asked me today I would suggest the following:

  • Experience first. When I am on the road, I don’t want to see the classic desktop on my tablet. Ever. I want to be able to do everything I can with an Android and iPad within Metro. Oh, and fast and fluid.
  • Do not let manufacturers ruin the party. Enforce some kind of minimum requirements, at least for tablets. Do not allow bloatware to ruin the good name of Windows 8. Thank you.
  • Allow a more desktop – professional use of the system. This is a complain I see from many people about the current form of Windows 8. I am not saying disable Metro, but I just can’t see Metro tiles flying around in company environments with older hardware.
  • Make sure each part of the ecosystem gets priorities. XBox is a consumption device. The tablet is a mobile device with light creation capabilities. The desktop is more creative. Provide balance (but still keep the experience first). I leave the details to you. :)

One thing is for certain, the Mayas were wrong about 2012 :)

Why I code for Windows Phone

Posted by admin on March 01, 2012
Apps, Development, Games, Windows Phone, Windows Phone / 8 Comments

I am asked this question a lot the past few months. First of all it’s a good thing that people are curious about why someone would choose to code for Windows Phone instead of the other platforms, especially with the knowledge that iOS and Android have a huge market share combined and Windows Phone does not (yet). I have a few reasons, and although they might not satisfy some people, they are enough for me.

Reason 1:

Developing for Windows Phone is fun. I love the SDK, I love the tools, I love the whole experience. I have been developing games since I was a little boy and the reason back then continues to be the reason right now. I am having fun developing games. Back in the day (think: 8bit home computing), almost all of my creations were developed, tested and enjoyed by yours truly exclusively. There was no such thing as a “user base” but even so I was still enjoying developing games. I still do.  But in order for this to be fun, I have to have a fun experience doing it. C#, .NET, VS and XNA give me just that. An interesting example is given on the video below, which shows how the experience of creating a hello world app in the 3 platforms is.

Reason 2:

Making games is not my main activity. This blends a bit with the other reasons. Spending 1-2 hours per day developing games for Windows Phone allows me to go about doing the other things I am doing in my life (finishing my PhD and having a family). I strongly have the feeling that this would not exactly be possible using any of the other two platforms and be dedicated enough to master either of them. I am not saying it is impossible, but I truly feel efficient game developing on Windows Phone, even if I don’t have lots of time to spend. Also, because Windows Phone game development is not my main thing, income is welcome, but I am not going to starve because the market share is smaller than the other platforms. Yes, it is not enough to consider it my full time thing just yet, but exactly this brings us to :

Reason 3:

I have placed a bet with Windows Phone. And not just with Windows Phone, but with the up-and-coming Windows ecosystem. For me right now, Microsoft is the new Apple. It innovated constantly in many fronts and has some amazing successes to show for its efforts. For example, the xbox came late to the party, but managed to level the competition in just a few years. I knew since the beginning of the Windows Phone last year, that it was part of something much greater than just a phone OS. Microsoft’s strategy is to finally put the huge advantage of Windows to good use and win in the other fronts utilizing just that. Windows 8, Windows Phone 8 and the new Xbox platform next year will provide a unified ecosystem that will be unbeatable. My bet is to be involved in this as early as possible and this was last year when Windows Phone launched and I released my first game for the platform, Tetrada. I already have a few games and apps in the marketplace and the codebase and libraries I have developed are fully reusable not only in Windows Phone 8 “Apollo” (compatibility with Windows Phone 7 has been confirmed) but also in Windows 8 (MonsterUp on Windows tablets) AND XBox 360. This is a good investment for the future of the ecosystem on my part and since I can currently afford to not being sustained by the income from this activity, fun and investment for the future come first.

I think these are my main reasons. My current status may differ from yours of course but for me, I think that I am doing the right thing. The games I’ve made have proven quite successful and I am thoroughly enjoying that, so I can’t find a reason to stop doing what I’m doing. And I do believe I am going to win the Windows ecosystem bet. Nokia is in full time, Skype is here, big game and software studios are interested in the platform and it seems to be getting the thumbs up from a lot of tech-blogs, site and media in general.

The future of Windows Phone looks bright!