Tuesday, March 15, 2011

Interactive Fiction Games On The Ultimate Development Platform: Dynamics CRM 2011

OK so I may be exaggerating a little about Dynamics CRM being the ultimate development platform but for those that recall my ‘hangman’ blog:


I set a challenge for the readers to use dialogs to create an Infocom-like game (we used to call them ‘Adventure Games’ in the UK). Apparently the Wikipedia name for them is Interactive Fiction. For those too young to remember these gems, this was in the days when computers had a keyboard, no mouse and no graphics. The screen (possibly green or yellow) would describe your situation and you would type in commands. Occasionally you chanced across a command the computer understood and something happened. Part of the fun was discovering the criminally limited vocabulary of the game and the other part was trying to match wits the programmer and solve the game.

Classic titles include the Zork series, ‘The Hulk’, ‘Hitch-Hikers Guide to the Galaxy’, ‘The Hobbit’, ‘Lord of the Rings’ and the less serious ‘Bored of the Rings’.

The last generation of interactive fiction games were probably MUDs, the pre-cursor to MMORPGs.

Given the post was about five months ago I thought it was time to step up and do my homework.

The Result: An Interactive Fiction Game Using Dynamics CRM 2011 Dialogs


It really works. There are actions to perform (Goto, Get, Use, Help and Inventory) and a text box to apply the actions to e.g. Goto 33. As the protagonist you move around the Microsoft Campus at Redmond (well five buildings of it) trying to find a way back to civilisation (or, in this case, Seattle).

The Entity Structure

The game has two entities: players and locations. Locations are, as expected, the places you can go in the game.


Player records are the launch pad for the dialog (a dialog has to be run from a record) and stores the current location of the player and their inventory.


The rest is dialogs.

The Dialogs


Each action gets its own dialog (the main reason for this is to give the asynchronous update step a chance to update your player record while you read the text). “Lost in Redmond” is the beginning dialog that launches the game.


Similarly, “End Game” is the end.


The main ‘screen’ is “The Game”.


This displays the current location and requests the user enter an action and an object to apply it to. “Goto” applies to a building number, “Get” and “Use” apply to an physical object in the game and “Inventory” and “Help” do not use an object.

“Help” simply displays a text message on how the game works.


“Inventory” uses the values on the player record, constructs a text string, stores it in a variable on the dialog and then displays it.


This is one use for variables. They allow you to store values and manipulate them via the “Assign Value” step.

The input variables are exclusively for child dialogs. “Goto” uses the input variable to pass through the location object from “The Game” dialog.


“Get” and “Use” also use input variables to work out what they being applied to and what to do.



So When Will This Excellent Game Be Available On Marketplace?

While I have packaged the dialogs and entities into a solution, there is a shortcoming with solutions. This being you cannot add records to a solution so the location records cannot be added in and be auto-installed on applying the solution. I have thought of including an on-demand workflow which could be manually run to create the locations but then there is the complication of linking the new records to the dialogs. Perhaps solutions will be expanded in the future to allow for this functionality.

Until then, if anyone can think of a way to package in the location files, let me know and we will make a fortune packaging text-based adventures to bored CRM users.

1 comment:

Unknown said...

I believe this is something that is in the works at MS. The hands on labs in the SDK have a similar issue where they have the various sample solutions to install for the lab as well as some sample data (in CSV files). Currently you have to install the solutions then use the import functions to import the data (not to hard). But they also include a zip file that contains the solutions, the CSV files, and a SolutionInstallerManifest.xml file that defines the elements in the zip and what they are. It's not currently supported, but I recall reading somewhere that this is something that is coming (who knows when?).