Category Archives: Windows Phone 7

The end of XNA?

If you are just starting with XNA game development, than you should probably read this post before you invest too much time in XNA.

Mind, this is no official statement from Microsoft, so there is still hope, but i agree with Promit. It is most likely, that we never see another big XNA update.


Read here:


Nokia Windows Phone 7 Device and Lync for WP7

Nokia presents Lumia 800:

Nokia presented it’s new windows phone 7 device today. It is based on the successful lifestyle phone N9. The Nokia Lumia 800 is a scaled down version of the N9 in regards to CPU and Ram … and of course intern memory.

Read more



Microsoft Lync for Windows Phone 7 is coming to marketplace:

WPcentral shows a version of the business communication software for windows phone 7.

Have a look here.

Send inkCanvas content with TCP

An inkcanvas can be serialized so that you have a byte array to send over a network.

For the client, in this case the canvas someone draws on, you create a TcpClient.

Fortunately this is handled by the .Net framework for you.

TcpClient client = new TcpClient(“”, 42000);

Next you create a MemoryStream to save your StrokeCollection on the inkCanvas to. The Networkstream doesn’t support this. But you can send the byte array without problems.

MemoryStream memstream = new MemoryStream();

Get the Networkstream form the TcpClient.

NetworkStream netstream = client.GetStream();

In a real application you should put this in a separate thread, but for this example let us simply assume this is running in the Window with the inkCanvas. This saves the inkCanvas Stroke Collection to the memory as a byte array.


The byte array can be send to the networkstream and with that to the TcpServer on the other end of the connection.

netstream.Write(memstream.GetBuffer(), 0, memstream.GetBuffer().Length);

Some cleaning up and the client is complete.




Please note that you need to at least catch some exceptions before using this in any real application.   #


The server looks pretty much the same.

Create the Server in the form of a TcpListener. The framework handles this for you.

TcpListener server = new TcpListener(42000);

Start the server. server.Start();

Tell the server to Accept a waiting connection from a TcpClient and save this client. This will freeze the Thread till a connection is established. So better put this in some other thread that is dedicated to communication.

TcpClient client = server.AcceptTcpClient();

Grab the Networkstream the client is writing to.

NetworkStream netstream = client.GetStream();

Fortunately the StrokeCollection Class has a constructor that take a stream as parameter. StrokeCollection p = new StrokeCollection(netstream) ;

The usual cleanup.




And don’t forget to pass the information somewhere. If you are sure, that nothing will happen with the object you can save the Clone(). But it is more secure to make a copy of the data for the gui. Otherwise you might get into troubles with the next update.

this.inkCanvas1.Strokes = p.Clone();

Workshop: Windows Phone 7 Game Development Lesson 3 coming up next week

We will display some 2D stuff and move it around.

How to Display Text in your XNA Windows Phone 7 game

First thing you need to do is add a SpriteFont object to your code.

Done like this: SpriteFont myFont (or whatever name you want to give it).

SpriteFont mySpriteFont

Add SpriteFont

Next you need an actual font you can load. For that you go to your solution explorer and right click your content project. Select add -> new item -> SpriteFont.

Add new item

Add SpriteFont to content project

Maybe you should select a better name, that the default one. But it doesn’t really matter much.

Select SpriteFont

Add SpriteFont

You can edit how your font looks like in the .spritefont file. It is a XML like format. Most stuff you find in there should be pretty much self-explanatory. At the bottom you find tags specifying a character region. Please note, that not all fonts can display all characters. If you happen onto a bug resulting from some character display problem or exception, have a look here, if your font can display all your characters. The rest describes size, text decoration and stuff.

spritefont file

The font description

For this post, I leave everything like it is and go on to actually displaying something on the phone.

First we need to load our SpriteFont1 in the ContentLoad()-method of our game class.

myFont = Content.Load("SpriteFont1")

All we have to do is display some text now.

We go to the Draw-method and beginn the spriteBatch draw with SpriteBatch.Begin().  The spriteBatch-Class offers us a DrawString-mehtod we use to display text. It first parameter is our SpriteFont. The secont the String you wish to display. This could of course come out of some Sting variable. The third is the position of the text on the screen and the last one, the color in the text is drawn in. We complete this with a spriteBatch.End() in the next line.

And see the result here: I made the Font bigger and red for this example. The size is controlled in the .spritefont file, the color can be selected in the DrawString-method.

Text on WP7 emulator

Display Line Number in Visual Studio 2010 Express

The standard setting in Visual Studio 2010 Express is to display no line numbers. To activate them follow the steps below.

Go to Tools -> Options on the toolbar.

Check the box ‘show all settings’

Go to ‘All languages’

Check the box in front of ‘Line numbers’ in the Display section.

Display Line Numbers

Skype integration for Xbox360, Kinect, Windows Phone 7, Outlook and MS live coming

  • Microsoft plans to bring Skype on new plattforms like the Xbox360 with Kincect support.
  • On windows skype gets an integration into outlook.
  • Support for WP7 devices.
  • The clients for Mac OS X, Linux, Android, iOS, Blackberry amd Symbian will still be supported in the future.
  • It is possible that Skype will replaces the ‘Windows Live Messenger’.
  • Does that mean there could be XNA support somewhere in the future? Hopefully.


Building the best game development computer under $500

I spend the last days hunting down cpu benchmarks and conducting my own tests for a customer. The aim was to build a computer with the maximum power for compiling C# source code with only minimal costs.

As XNA Games are written in C# (at least in the most cases) i thought this would be something i would like to share with you.

Basics about building a XNA Game Solution in Visual Studio 2008

First a few things you need to know when building a XNA Game Solution in Visual Studio 2008. I know Visual Studio 2010 is out there buu the XNA support is still missing. Only XNA 4.0 and the windows phone development tools run in Visual Studio 2010 Express. I did not yet upgrade my project from XNA 3.1 to 4.0 so it was clear that i needed to use Visual Studio 2008. Back to the point. Things you need to consider when building XNA Game Solutions in Visual Studio 2008.

  1. The build process runs only on one core. Usually you have dependencies between the projects in a solution and they have to wait on each other to finish building before the next one can be build.
  2. The build process runs through different stages and different stages challenge different parts of your system.
  3. The build process might run for a long time and you might wish to work on something else why building.
  4. You are probably not buying a dedicated build system.

1. Builds run only on one core:

This lets me believe that clock speed is more important than many cores. I let the build of my project run on a i7 920 and the CPU load stayed constantly at 11 to 14% for the devenv.exe process. A quick calculation reveals that the i7 with 4 real cores and 4 virtual cores thanks to hyperthreading has a total of 8 cores. So a 100% cpu load means that every core is running under full steam. But if the process can only use one core, the overall cpu load should be around one eighth. 100% divided on 8 cores gives you 12.5%. I think the short peaks of 13+ can be attributed to some Visual Studio background processes and measuring inaccuracy.

So clock speed is really all that matters? Yes of course … wait … sadly no, it isn’t. While clock speed is a big factor in this, it is not the only one. You have to consider the processor architecture. While a Pentium 4 with 3.6 GHz is not a bad choice for building a i7 will still be faster. But not by much.

I let my project build on:

Intel® Core™ i7920 Processor (8M Cache, 2.66 GHz, 4.80 GT/s Intel® QPI) with 8 GB memory (DDR2) => 6 to 7 minutes (with a MySQL instance running but idle)

Intel® Pentium® 4 Processor supporting HT Technology 3.40 GHz, 512K Cache, 800 MHz FSB with 1.5 GB memory (DDR2) => 11 to 12 minutes

Intel® Core™ Duo Processor T2300 (2M Cache, 1.66 GHz, 667 MHz FSB)  with 3 GB memory (DDR2 Notebook) => 10 to 12 minutes

Intel® Pentium® D Processor 820 (2M Cache, 2.80 GHz, 800 MHz FSB) with 2 GB memory (DDR2) => 11 to 13 minutes

The order is more or less what i expected. I think with a memory upgrade to 2 GB the Pentium 4 could beat the Pentium D and the Core Duo T2300 by a minute or two. And this is what really suprised me. The Pentium 4 is as good, sometimes even faster, than it much newer brothers. Actually only the Pentium 4 used all the available memory at some point. Please consider that the test is not completely scientific. These are some computers i have access to. They do not run clean installtions. On some of them other services are running. I tried to get them as idle as possible but it isn’t a completly objective test. They do not even run the same Windows versions. The T2300 and the Pentium D are running Windows XP Professional, the rest Windows 7 Professional or Enterprise.

So this test is useless? If you are looking for scientific data, than yes, it is useless for you. But i still think it shows something quite suprising. The difference between a $40 computer (i bought the Pentium 4 used from a business next door that gave up for that sum) and a $1500 computer (the i7, new) is not factor 1000 like the price suggests.

Just out of curiosity i visited some webshops selling used computers. You can get a used workstation with a 64-bit Intel® Xeon® Processor 3.60 GHz, 2M Cache, 800 MHz FSB with 2 to 3GB ECC memory and a 160GB hdd for just $190 plus shipping. Sometimes even with 2 cpus or 4 to 8GB ECC memory for just a little bit extra power. These things are build to run forever so you have your perfect build server. Just put some the code changes via a repository on it and let it build one solution after the other.

2. Builds challenge different parts of your system:

To simplify this i will break the building process down in three parts:

  1. Getting data from drive.
  2. Compiling source code.
  3. Writing output to drive.

The ressource manager of Windows 7 shows the following for each step:

Getting data from drive:

  • CPU – mostly idle
  • Memory – working some
  • Harddisk – 100% load

Compiling source code:

  • CPU – 100% load. At least the one core used.
  • Memory – a nearly constant amound is used. In my case about 200MB. Not as much as i expected.
  • Harddisk – idle.

Writing output to drive:

  • CPU – mostly idle
  • Memory – working some
  • Harddisk – 100% load

So switching from a conversional harddisk drive to a ssd should give you a huge boost? Not really. I tried this with a SSD, a hybrid disk and a traditional hdd. Made next to no difference. The reason for this i quickly explained. Compared to the compile time the time spend reading and writing the data to the disk is so negligible that even a large performace boost in this area is not really noticeable.

So why do i read the advice to use a ssd for compiling so often? I don’t really know. I have a few theories about this. As we established above, the build process uses only one core, so when building in the background you should be bothered by it much… except for the few seconds large amounds of data are pushed from memory to disk. So what is the first thing you do? Look what ressources are taxed to the maximum by building you cool new awesome project. And suprise, you see the harddrive is the bottleneck. So of course you advice everybody to buy a ssd. Every reliable source told me the same. Visual Studio starts faster. The overall experience is faster, better, greater. But the build was running at the same speed as before. My own tests confirm this. A ssd ist great, but doesn’t help with build time. The hybrid disk is a cheap alternative and brings a slight boost but i in no way compareable to a ssd.

Please note that i am writing here about building a single XNA Game Solution in Visual Studio. There are of course cases where a fast harddisk is a huge speed boost.

3 + 4. You usually build in the background and do something else in the meantime if you have no dedicated build server / system.

What i want to tell you here ist, that it makes probably no sense to invest in a system you cannot use while building. For a dedicated build server it would be best to have one core (even hyperthreading is not really needed) with maximum speed, fast memory and a quick harddisk (or small ssd).

So our system should have at least decend power for stuff outside of coding games.

So what do i buy?

If you are one of those people who have their reserved parking lot at the local computer store, you can stop reading here. From here on i will focus on getting the best hardware for your money while staying under $500.

Let us start with the most important part, the CPU.

A quick glance at some benchmarks show us what a good cpu is for our problem. If you search for benchmarks on the internet be careful. Most benchmarks out there are for multithreaded applications. You need to look for ‘benchmark cpu single thread’. A good one is the ‘SPEC-Benchmark CPU2006‘ or the ‘Cinebench 11.5 (Singlethreaded)‘.

At the time i am writing this the winner in the category under $300 is the Intel® Core™ i5-2500K Processor (6M Cache, 3.30 GHz) already on the new socket 1155. It costs today $255. If you have a few dollars more to spend on this get the Intel® Core™ i7-2600K Processor (8M Cache, 3.40 GHz) for $365.

Of course you need mainboard. This is where the flamewar usually starts. A good, reliable, expensive one with a long list of features and great driver support for the next decade ist the way to go here …. wait what? … No! Get a cheap one. You might need a new one in a few years because it broke down or doesn’t support something or whatever. Who cares? You are building a $500 computer not a $15000 server here. Let me tell you a secret. If you spend the whole $500 on a fancy mainboard, even that won’t do much without a cpu, power supply and memory. So we are simply getting a nice $85 entry level mainboard. If you can get SATA\600 support for a little bit more, do it.

That brings us to memory. Memory is important. Really important. Really, really important. Okay, so you got that? Good. I think 4GB is a good compromise. There is a recogniseable difference between cheap and expensive memory. But we are on a tight budget, so get some cheap one from a manufactor that gives you at least a one year warranty. Should cost you about $45 (2 x 2GB DDR3 – 1333). If you have the money you can go for 4 x 2GB or 2 x 4GB whatever your mainboard supports. Should be about $85.

That leaves us with $115 for the case, power supply, a DVD drive and the harddisk. Wait! And the graphics card if you have none on your board. The graphics card is a problem. You are developing games on the computer. Games require good graphics cards. The point is moot. You cannot get a good gaming graphics card in $500 computer. A acceptable solution would be a nVidia GeForce GT 240 or GT 430. But they cost you an addition $100. If you want to use the computer for the newest blockbuster games in full hd and maximum details you need to spend $300+ on a GeForce GTX 560.

A case and powersupply are available for $60. Don’t get the cheapest stuff out there. Get the dealer to show you some quite ones with a good efficiency factor.

A DVD drive is $25.

The last decision would now be what hdd to buy. We have $35 left. I have seen the ‘500GB Western Digital 7200rpm 16MB Cache Serial ATA/600’ for $48.

Plus keyboard and mice ($8.50 each). Get something good. Logitech, Microsoft, Cherry. They have good sturdy devices. Just forego the multimedia keys and stuff.

Now the moment of truth. To be honest i di not add all the stuff up beforehand.


It’s $535. So you just have to get a 7% discount and we are under the promised $500. Agreed, it’s without a graphics card.

If you are not already on your way to the computer parts dealer of your trust, subscribe to my blog and have a nice weekend.

What Windows Phone 7 (WP7) Device (mobile phone) to buy?

Currently i am wondering about buying a new Phone.

As an enthusiastic game programmer with some years of experience with XNA and C# my choice would be WP7.

I could now spend some time discussing the pros and cons of WP7 vs. Android vs. iOS, but i won’t. The short answer is, that iPhone is too expensive and i do  not know enough about Android programming. That might change in the future but right now i feel that i simply want a WP7 device. No hard reasons for that, just curiosity and the great price of course.

So after browsing some friendly electronic discounter around the corner i narrowed it down to two possibilities.

The Samsung Omnia 7 and the LG Optimus 7.

The cheapest WP7 phone at the moment is the HTC 7 Trophy. You can get it a low as $238. But this phone is not available worldwide. It seems to be aimed at the european market. So if you can get it for such great price where you live, it is an alternative. It is just a WP7 phone, that meats all requirements and does nothing really wrong, but at the same time nothing really amazing.


Please note, that these are not the prices but the cheapest offer i found around.
Samsung Omnia 7: 318$
LG Optimus: 253$
The difference in price is about 65$ in favor of the LG Optimus 7. So one point to the Optimus 7.


The Omnia comes with 8GB or 16GB. I am talking about the 8GB version here.
Samsung Omnia 7: 8GB
LG Optimus: 14GB
The next point for the Optimus 7.


Okay, here wins the Samsung Omnia 7 Super AMOLED display, no arguments: Point to Samsung.
I could write more about how good this display is, but let me say just this: If the display is the most important part for you -> Buy the Omnia 7.


138g and 122,6mm height for Samasung.
158g and 125mm height for the LG.
I carry my phone around in my pocket so this is a point for the Samsung Omnia 7.

Special features:

The LG is to this time the only WP7 phone that has augmentet reality features implementet. So if you like this stuff it is a pretty good reason to get the Optimus 7.
The Omnia7 is lacking here. It has got its really great display, and a slightly better camera that the LG (at least that is what tests show).
As all of this is a question of personal preferences i will not award a point. You should decide for yourself what is important to you in a mobile phone.


It’s a draw. Well of course i knew it would end like this. If one of the phones would be the obviously winner there would be not need for this post.

And now? Well in the end everybody have to decide for oneself but i would certainly appreciate your input on this. Do you own a WP7 phone? Are you planning to buy one? Leave your input in the comments.
Currently i am leaning towards the Omnia 7.

72 hours weekend challenge at

You have a free weekend and a great game idea?

If you know some programming and want some fun developing a game, than paticipate here.

Prices to win!

New Challenge!

Update: Theme is announced

In the immortal words of MC Hammer, “U Can’t Touch This”. Take it literally, figuratively, or sideways

%d bloggers like this: