Tankster.GamePlay is a Web Role. The only worker role is Tankster.WorkerRole. Tankster.Core is a class library. There are interesting code at Tankster.Common: Azure utilities to access repositories, a job engine; all its code is game-agnostic.

These are my first short comments about the code and implemented features (remember, is a beta! Some of these features/implementations could change in the next release):

– Client technology: HTML5, Javascript, EaselJs (for canvas programming).
– Server technology: ASP.NET MVC 3, some Razor test views (interesting topic: how to test the game without the REAL game), WCF Web API (another interesting topic to discuss: alternative technologies to received the game activity)
– There is a client game model and entities in Javascript. See src/model, src/game.

– There is a server game model (see Tankster.Core class library project)

– You can play in single player mode, but you can choose multi-player online. Then, the game uses ACS Portal to login using Federated Authentication:

There are a lot of points to comment and discuss, feed for upcoming posts. Surely, the solution will evolve and new versions will be published (this week? next week?). But it is interesting to have a published game online AND the code to analyzes it.

June 22, 2011

The past two weeks I was working in a proof of concept application for a customer of mine, implementing OAuth2 using ACS (Azure Access Control Service). These are the principal links I used.

First, links about what is OAuth, its history, etc:

OAuth http://en.wikipedia.org/wiki/OAuthOAuth (Open Authorization) is an open standard for authorization. It allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site without having to hand out their credentials, typically username and password.

CommonJs http://www.commonjs.org/The CommonJS API will fill that gap by defining APIs that handle many common application needs, ultimately providing a standard library as rich as those of Python, Ruby and Java.

June 13, 2011

My weekend code kata was something I was thinking since last year: run AjSharp in Azure Worker Roles. The idea is: a worker role instance can receives text via queue messages containing AjSharp code, and execute it. The output is send as a message to other queue.

The result was committed in my AjCodeKata project: you must download trunk\Azure\AzureAjSharp AND trunk\AjLanguage (where AjSharp projects reside).

Azure.AjSharp: the class library. It contains Processor class. The constructors need a cloud account and the names of: requests queue, responses queue and blob container. The request queue has messages with AjSharp code to execute. Response queue has the output text of such executions. The above processor.Start() command initiates the read and process of AjSharp code.

AzureAjSharp.Console: it reads lines from console, and when it reads a “send” line, the text is converted to a cloud message, sending it to the request queue. It has a thread that reads the response queue and prints the results.

AzureLibrary: auxiliar classes.

AjSharpVS2010, AjLanguageVS2010: AjSharp implementation.

When I run the console application, I can send AjSharp code to worker roles:

And more: AjSharp supports Include(“filetobeincluded”); where the file contains AjSharp code. I modified the launch of AjSharp machine to have an Include subroutine implementation that reads the content from a blob container.

A graph:

Then, I uploaded some simple code (the files are in Examples folder in Azure.AjSharp project) to ajsfiles blob container (DevStorage in this test):

This is the test running (using Include) HelloWorld.ajs, and ForOneToTen.ajs:

Next steps:

- Write more utilities in AjSharp, to be included if they are needed: file and directory utilities, download and upload of blobs, send and receive message using queues, broadcast messages to all worker instances, download and load of assemblies, etc. Sky is the limit! ;-)

February 15, 2011

In January, I reimplemented my Fractal application, now using Azure (my Azure-related posts). The idea is to calculate each sector of a fractal image, using the power of worker roles, store the result in blobs, and consume them from a WinForm application.

Note the use of .Invoke to run the drawing of the image in the UI thread.

This is the WinForm app, after click on Calculate button. Note that the sectors are arriving:

There are some blob sectors that are still not arrived. You can drag the mouse to have a new sector:

You can change the colors, clicking on New Colors button:

This is a sample application, a “proof-of-concept”. Probably, you will get a better performance if you use a single machine. But the idea is that you can defer work to worker roles, specially if the work can be do in parallel (imagine a parallel render machine, for animations). If you run these an application in Azure, with many worker roles, the performance could be improved.

I’m using the PartitionKey as the primary key, filling it with a Guid. The RowKey is the empty string. In a less simple application, I could save the invoices of a customer using the same partition key, and identifing each invoice with its RowKey.

Note the Attach using ETag (third parameter) of “*” (any). This way, I can update the customer attaching the “in-memory-created” one to the data context, without retrieving it from the database. This approarch is viable if I have all the data of the customer. In most application you change only some fields, so you should retrieve the object, change it, and then, save the changes.

Note: it’s a sample application, simple and direct. A real application should separate the view model from the business model, and maybe, use an ASP.NET MVC front end. I will write this example, using MVC. In another series (out of Azure), I want to write an app using ASP.NET MVC AND TDD.

Next steps in Azure: a distributed fractal application, a distributed web crawler, implement a distributed genetic algorithm, using worker roles.

Then, the worker role is launching a fixed number (12) of MessageProcessor. In this way, each instance is dedicated to process many message. I guess that this is not needed in this example. But it was an easy “proof of concept” to test the idea. Part of Run method in worker role;

October 31, 2009

Yesterday, I was talking with Fabio Maulo (@fabiomaulo) about many things, related to software development, teaching programming and, of course, NHibernate. We are living in Buenos Aires, Argentina, and it was a pleasure to talk with him, as usual. Í’m following Fabio in Twitter, and I’m a suscriber of his blog. Fabio is collaborating with NHibernate project for years, and he is a recognized developer in the .NET software community.

He told me details about a site built using NHibernate, and running on SQL Azure. You can see it online (Spanish content, Mexican site):

Fabio and his team worked hard to write this site, in less of a month (I’m waiting the team posts, with more detailed info, so, I’ll write only about the public parts here).

Curiously, the site is running using WebForms, but without ViewState, and without form tags embracing the full body inner HTML. All we are waiting Maulo and his team, explaining the implementation details. The code is based on using Model View Presenter, and it was build using tests, mocks and stubs, from presentation to persistence. Hey, Fabio! Please, write about the process and architecture decisions! :-)