I am really excited about this (and not only because it means I am going to get an Xbox 360 for FREE). I think this will help show just how powerful Excel Services is going to be.

 

So what exactly does Excel have to do with Xbox 360 you ask? Good question. Apparently our PMs have been hard at work discussing with various partners about what they want out of Excel Services. One of the things that kept coming up from the Xbox 360 partners is the immense hardships in coding various AI algorithms into the games. There was a multitude of issues partners were having – the two most common ones (from the partners polled) were:

  1. Programming AI is just down right hard.
  2. Cost of bringing fixes of AI (and other game algorithms) once a game has been shipped.

 

You can look at the second problem as the extension of the first – if good AI was not that hard to write, there would be less fixes needed, less money spent, more money in the bottom line.

 

And so we have worked hard with the Xbox guys to solve these and other problems. On the second half of 06, we will be supplying a web-service proxy for integrating the Excel Services exposed by the Microsoft Office Sharepoint Server with the Xbox 360. The code name for the SDK is currently GROSS (Game Robustness with Office Sharepoint Services) and it will be distributed with the Aug. 2006 MSDN (if everything goes according to plan).

How does it work

It is very simple – Excel is probably one of the most commonly used tool with which to express mathematical algorithms. The game designers will use it to express game-related algorithms. The workbook will then be used during the game (via Excel Services) to make calculations that will determine the next stage.

And here’s the beautiful part. If there’s a problem with an algorithm, all the designers need to do is swap the workbook with a fixed one on the server and WHAM! The new algorithm will take effect and be used by the game.

Of course, I was talking about AI, but that’s not the only thing Excel Services will be useful for. You could use it for dialog scripts, for character stats calculation (for RPG type games), for behavioral algorithms and for many other things.

Because Excel Services automatically grabs new workbooks that are placed in its Trusted Locations, we expect people to use this mechanism in two ways:

  1. DWEEBDynamic Workbook Engine Execution Bridge – The game will request Excel Services to open the workbook from scratch on each decision point. If a new workbook has been introduced, it will be picked up, fixing the game while it’s being played.
  2. SAP – Static Algorithm decision-Points – The game keeps a session opened against the server and will use that session over and over again, making sure the same workbook is used.

Example – Action Game

One of the most interesting parts of an action game is how the various non-player characters (NPCs) behave. In a lot of cases, this can make or break the game.

In this example, I will show a workbook that supplies the behavior pattern of an NPC when faced with potential enemies. It is important to note that I am keeping the example simple for brevity sake – we expect people to have far more complex workbooks in real-world games.

The workbook has two parts to it – a range of cells corresponding to the game world and a single cell that will contain the behavior prescribed:

As you can see, in this example, the developer needs to make a call to fill the colored area with information about the game world – in this case, place a “1” in each cell where an enemy exists. Once set, Excel will recalculate the workbook and reach a decision – what’s the most dangerous direction. The game will then read that result and cause the NPC to move there. In our case, since the least dangerous direction is south – that’s where our NPC should go.

The following is sample code that will show how to use the workbook:

private void GetMostDangerousDirection()

{

       using (ES.ExcelService excelService = new ES.ExcelService())

       {

              excelService.Credentials = System.Net.CredentialCache.DefaultCredentials;

              ES.Status[] stati;

              string sessionId = excelService.OpenWorkbook(

                     WorkbookName,

                     String.Empty, String.Empty, out stati);

 

              object[] range = new object[9];

              for (int row = 0; row < range.Length; row++)

              {

                     range[row] = new object[7];

              }

 

              foreach (Enemy enemy in GetEnemies())

              {

                     Point pos = enemy.GetNormalizedPosition(7, 9);

                     if (range[pos.Y][pos.X] == null)

                     {

                           range[pos.Y][pos.X] = 1;

                     }

                     else

                     {

                           range[pos.Y][pos.X] = (int)range[pos.Y][pos.X] + 1;

                     }

              }

              excelService.SetRangeA1(sessionId,

                     "",

                     "World",

                     range);

 

              string dangerousDirection = excelService.GetCellA1(sessionId, "",

                     "LeastDangerous",

                     true,

                     out stati);

 

              excelService.CloseWorkbook(sessionId);

              return dangerousDirection;

       }

}

 

As you can see, we are setting up the world by getting each enemy and placing it in its correct location. We then go and call again into Excel Services to get the least dangerous location.

Example – RPG games

Another good example is an MMORPG game – in those, there are only three really important things:

  1. How much damage that new weapon you just got does – Excel Services 2007 can be very useful with this.
  2. How “elven” does your name sound – Less helpful here, but make sure you get either “Moon” or “Lake” in the name and you are gold.
  3. How many people you “cybered” with today actually are of the gender they said they are – Excel 2007 can’t help you here much, but in the next version we are thinking of adding some GIT (Gender Identification Techniques) functions to Excel.

Here’s an example of a workbook you can use to help with determining how much damage a weapon does:

 

In this case, you would fill all the cells with the status of the character being hit (on the left) and the one hitting (on the right) and get the result of the damage in the bottom cell:

 

Final thoughts

Excel Services is going to be a very important part of future Xbox 360 games. Here in the team, we are eager to see what crazy usages game developers are going to come up with for it.