Jesper Niedermann's .NET Blog
about .NET and related technologies RSS 2.0
# Thursday, 28 July 2011

When making the WP7 game Photo Challenge we quickly agreed that we needed leaderboards. The problem is that is time consuming to build a scalable high quality leaderboard service tailor made for our game and secondly we would have to pay for server storage for a game that statistically won’t make a dime anyway. This meant that we searched for a ready to use leaderboard service. It wasn’t easy to find. But then a miracle happened. We found the amazing is an incredible fit for our game.


  • Most importantly there is great support from the developer Karl Seguin when you run into trouble (which we did – actually one of our problems led him to find and fix a bug in the service).
  • It has an easy to use API. The basic API is Rest based with data transferred in JSon format. This means that is possible to access the leaderboards from any application. I am currently working on an ASP.NET MVC / JQuery based web page to access our leaderboards on the web.
  • On top of the REST API there is a WP7 API which you can reference from your game and it looks like an Android API is currently under development.
  • When you register an account you gain access to adding any number of games, to each of these games you can add a number of leaderboards.
  • Furthermore supports achievements and even has some Facebook integration which I haven’t looked into yet.
  • There is also statistics. A cheap way to see the popularity of your game. On the AppHubs you can see number of downloads, but on you can actually see how many are playing your game.
  • For accessing a leaderboard from your game you use a gamekey a  leaderboardkey and a secret. Each of these are Guid like Id’s. You can fetch pages of 50 scores at a time, and you can get the Rank of a specific user.
  • The leaderboards can be defined as High-to-low or low-to-high. Meaning if it is preferable to have a low or a high score.
  • Each score is associated with a username, a rank and the date&time at which the score was added.
  • In the WP7 API there are a number of ways to define a user in terms e.g. one uses your liveid and another the deviceid combined with a username. The last one is the one we use. This means that 2 users with the same username but different phones will be two distinct users on the leaderboard.

To get started you should download the code from Github and look at the samples there. Furthermore I found this nice blogpost to help me get going

In you can see a screenshot of the graphical look of the leaderboard we came up with in Photo Challenge.

Thursday, 28 July 2011 23:35:35 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
Games & Puzzles | Windows Phone 7
# Tuesday, 26 July 2011

I and a team of 1 graphic artist and 1 sound engineer just finished our first game for Windows Phone 7 called “Photo Challenge” a few weeks ago. We planned this pretty simple game to get experience before going for the big hit. The concept has been seen before. A Puzzle Slider where you have to solve a square puzzle with 2x2, 3x3, 4x4, 5x5 or 6x6 squares with one square missing. The Puzzle can be made from you own photos or from some build in ones. Here is a few screenshots:


The point of the game is to solve the puzzle as fast as possible to make it to the leaderboards. We used the great service for the leaderboards. I plan to cover that aspect in another post.

We are very satisfied with the style and feel of the final game. Even for such a simple game details are important. Similar competing games seems to have been made in Silverlight and thus are more limited with regards to graphics and sound than our XNA game.

Some of the learnings from making the game are:

  • XNA is a fantastic framework and my own framework for XNA developed over time for PC and XBox could be used directly with very few changes.
  • WP7 has a fantastic developer platform. IMO better than the iPhones.
  • The WP7 API’s still lacks a lot of functionality that is present in the iPhone API’s but slowly catching up.
  • If you use some of the build in “Tasks” like the PhotoChooserTask or the MarketplaceReviewTask you cannot play sounds on the device if it is connected via USB to the computer. Sounds like a small thing but it means you cannot debug on the device ! Really horrible. My solution was to not play music and sound effects in the DEBUG edition.
  • On the other hand you can debug on the emulator. On the iPhone it is extremly important to debug directly on the iPhone because the iPhone simulator cannot be trusted. I have often experienced that code working in the iPhone simulator was not working on the device. This never happened once for the WP7 emulator and my Samsung Omnia 7. Still it is important to be able to debug on the device since there are things not available in the emulator.
  • As mentioned the API is somewhat lacking. E.g it is impossible to send images in emails via the EmailComposeTask. It is not possible to integrate facebook in an XNA app and so forth. The last one is supposed to be fixed in the Mango update since it has opened up for mixing Silverlight and XNA. I have not tried it yet. But hope it will be possible. Facebook integration in games is almost a must these days.
  • Despite being extremely happy with the developing experience for WP7 the iPhone is still an overall better smartphone experience in my opinion (seen from a user perspective). I hope and think WP7 will catch up in time. Competition is good.
Tuesday, 26 July 2011 23:47:58 (GMT Daylight Time, UTC+01:00)  #    Comments [5] -
Games & Puzzles | Windows Phone 7 | XNA
# Sunday, 24 July 2011

When we were to publish a free version of our new Windows Phone Game Photo Challenge I wanted to maintain both the free and paid version in the same Repository. I wanted the solution file and project file for the new free app to use the same source files as the paid app. This gave some headaches because there needs to be a physical WMAppManifest.xml file for each App. I googled various approaches but I finally made up an entirely different approach which I thought fitted our project best. Here is the steps I took:

  • Copied the solution file PhotoChallenge.sln to PhotoChallengeFree.sln – placed in the same folder
  • Copied the project file PhotoChallenge.csproj to PhotoChallengeFree.csproj – placed in the same folder
  • Changed PhotoChallengeFree.sln via notepad to refer to PhotoChallengeFree.csproj
  • Copied AssemblyInfo.cs to two new folders. One for the paid app and one for the free app.
  • Deleted AssemblyInfo.cs from both PhotoChallenge.csproj and PhotoChallengeFree.csproj
  • From PhotoChallenge.csproj I linked to the new Paid version of AssemblyInfo.cs – using Add –> Existing File, but choosing Add As Link instead of Add.
  • The same in PhotoChallengeFree.csproj. But this time linking to the Free version of AssemblyInfo.cs
  • Changed the following properties in the free version of AssemblyInfo.cs: AssemblyTitle, AssemblyProduct and Guid.

I actually wanted to manipulate WMAppManifest.xml in the same way as I did AssemblyInfo.cs. But this turned out to be impossible. The WMAppManifest.xml file has to be physical – not a link. Instead I did this:

  • Made a project folder in PhotoChallenge.csproj called PropertiesPaid
  • Made a project folder in PhotoChallengeFree.csproj called PropertiesFree
  • Copied WMAppManifest.xml to the new folders and added the relevant one to each project.
  • Deleted WMAppManifest.xml from the properties folder.
  • Opened the project files in Notepad (actually I chose “Unload Project” in Visual Studio and then “Edit PhotoChallenge.csproj”). And changed this:

To this:


Then I reloaded the project in Visual Studio, and did the same for the free project. But now refering to the PropertiesFree folder.

In the free version of WMAppManifest.xml I changed the Title and TokenId to match the AssemblyTitle and AssemblyProduct of AssemblyInfo.cs. Furthermore I changed the ProductId to match the Guid of the AssemblyInfo.cs.

The actual differences between the free and paid version in the source file I maintain using a new compilation symbol I made called “FREE” so I can make statements like this:

#if FREE
//Some code

Altogether my approach seems to work extremely well to minimize maintainance of the two versions of the same app.

One small problem: For some reason which I have not bothered to find out I cannot use the Compilation symbol Free in the PhotoChallenge.csproj project itself, but I have some other referenced projects where it is no problem. So I just have a class in the referenced project which I can use where ever I have to check if the current version is paid or free:

public static class Edition
public static bool IsFree
#if FREE
return true;
return false;
Sunday, 24 July 2011 19:46:58 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
Visual Studio | Windows Phone 7
<2018 August>
About the author/Disclaimer
I am a software architect with focus on Microsoft Technologies. I have been working with these in different large companies since 1995. I am currently employed at UVdata A/S.
Here is my View Jesper Niedermann's profile on LinkedIn

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Privacy policy
The privacy policy of this site.

© Copyright 2018
Jesper Niedermann
Sign In
Total Posts: 28
This Year: 0
This Month: 0
This Week: 0
Comments: 32
All Content © 2018, Jesper Niedermann
DasBlog theme 'Niedermann' created by Jesper Niedermann, based on 'Business' created by Christoph De Baene (delarou)