ChainPop: Fun with games and Windows Azure

As is the tradition for me I got some for-fun coding done during the Christmas holiday. While playing Minecraft with my 7 year old son we discussed how it is actually possible for a single person to make a game (which got him excited). I therefore decided to follow this up with some game making of my own (the offspring helped out with play testing when I could drag them away from Minecraft). I took some old collision detection code I had experimented with before and proceeded to turn it into a game. Getting into playable condition was quite fast. Polishing it up and play testing it took a while longer which is why I’m presenting it here in February.

ChainPop

ChainPop

As I currently work on projects involving Windows Azure I decided to add an online scoreboard which you will find here: http://chainpop.azurewebsites.net. You can also download the game directly here. The scoreboard is an extremely simple Web Application / REST(ish) api built with NancyFx. Scores are stored in and retrieved from an Azure Table Storage table and the nancy module serving as an entry point is all of two dozen lines long (see below).

public class IndexModule : NancyModule
{
  public IndexModule()
  {
    var configuration = ServiceConfiguration.FromConfigurationManager();
    var scoreRepository = new ScoreRepository(configuration);
 
    Get["/"] = pm =>
    {
      var application = configuration.Application;
      var version = configuration.Version;
      var mode = configuration.Mode;
      var topList = scoreRepository.GetTopList(
        application, version, mode).Take(100).ToList();
      return View["index", topList];
    };

    Post["/api/score/"] = _ =>
    {
      var score = this.Bind<GameScore>();
      var gameScoreValidator = new GameScoreValidator();
      var validationResult = gameScoreValidator.Validate(score);
      if (!validationResult.IsValid) 
        return Response.AsJson(
          validationResult, HttpStatusCode.BadRequest);
      var result = scoreRepository.Add(score);
      return result;
    };
  }
}

Note that ChainPop is a WPF application and requires .NET Framework 4 to run. Try it out and tell me what you think. More is sure to follow.

One thought on “ChainPop: Fun with games and Windows Azure

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.