Multi-Player Gaming in RS (aka BI Power Hour 2008)

At the traditional annual “BI Power Hour” sessions, several teams that contribute to the Microsoft Business Intelligence platform show off their technology in a fun way.  It is about demonstrating, in perhaps unusual ways, of how business intelligence and various tools of the BI stack can be useful.

In past years, Reporting Services made a number of successful contributions to these events, such as Hangman, report manager as report, etch-a-sketch, mastermind, an executive dashboard (aka tic-tac-toe), and others. 

Throughout last year, we showed several variations of a multi-player game that we shall call “Sea Battle”.  The goal of the game is to sink all of your opponent ships (for example, a Battleship), before the opponent has a chance to find and sink your ships.  The faster you click, the better your chances of winning :)

Game status gauge

The overall theme of the report was about interesting new data visualization features in Reporting Services 2008.  It uses charts with dynamic drill through actions, as well as data point tooltips. Grid drawn as scatter chartFurthermore, a small matrix acts essentially as a data-driven grid control next to the chart to show your own ship positions and the opponent’s hits and misses.  The overall health status of the opponent's ships is shown using a gauge control with a custom pointer with an image to simulate a rising water level, as a ship sustains more and more hits.

Gauges for ship status

Successfully sinking a ship is rewarded with a nice animated explosion.  The really fun part is the multi-player aspect – we use a basic way of matching up two report users so they can play against each other by simply interacting with their report on a report server. 

While Reporting Services was clearly not designed as a gaming platform, this demonstration of the product's flexibility brought out the competitive spirit in the SQL Server BI team.  When I made an initial version available for limited beta-testing on an internal report server, the news spread quickly and we immediately had more than 50 people playing, and frantically clicking on the chart’s drill through links trying to win against their human opponents.  This created quite a bit of load on the report server that is also used by hundreds of other users, and provided a nice stress test scenario :)

Enough said.  I know you want to participate in the fun and play yourself! 

Instructions to setup the demo on your own RS 2008 report server:

  1. Unzip the attachment
  2. Restore the database backup (SeaBattle.bak) on a SQL Server database server
  3. Create a new Business Intelligence Development Studio 2008 report project, add the shared data source (SeaBattle.rds), and the two reports of the zip file to the project
  4. Publish the project to a RS 2008 report server
  5. Use stored credentials on the shared data source.
    I strongly recommend using stored credentials.  That way, only the stored user needs access to the SeaBattle database and you won’t run into any potential integrated security double-hop issues.
  6. In report manager, hide the “SeaBattle” report, so that users just see the “SeaBattle – Start new game” report.  Don’t run the SeaBattle report directly; always use the start new game report.
  7. I recommend playing the game using the https://MachineName/reportserver URL, not through report manager, if you want faster response time and better chances of winning :)
    Better yet, you could quickly build a small Winforms application, using the Visual Studio 2008 ReportViewer control in remote mode and connect to the report server.

Hope you are going to enjoy this Power Hour demo!

Q&A and disclaimers:

  • Multi-player matching is really basic 
    The first user that starts the report establishes a new game, the second user that enters is automatically linked with the first user.  Since there is no concept of game session implemented, you can end up with abandoned sessions if one of the players stops playing, or starts a new game.
  • Reporting Services was not designed as a gaming platform
    This results in some limitations in the game design.  Furthermore, the demo evolved over time with little bits added here and there – if I were to rebuild the backend database and the report from scratch, it would have a somewhat cleaner design.
  • Could this be built using a local mode report viewer control?
    Yes, but it is probably an exercise for more advanced developers.  Basically, you would build a local mode report viewer application with its own data retrieval, and just access the SeaBattle database on a common SQL Server.

SeaBattle.zip