With VR technology poised to enter the mainstream, I wanted to understand how ITSM data & information could be represented in a 3d structure. I’ve decided to start with the CMDB (configuration management database) as a set of data that is often complex and multi-dimensional. I’ve chosen minecraft to build these structures as it has an open sandbox mode, is extendable with community-written mods, will be supported by the Oculus Rift fairly soon and it was good enough for Octopus Deploy.
In part 1, we’ll get set up and build basic structures programatically. Parts 2 onwards are still being thought about…
Available from http://www.minecraft.net
, you should use the PC/Mac client as the Xbox/IOS/Android client currently doesn’t support the mods we’ll need to install.
First things first. In the vanilla game (without any mods installed) I’ve built a representation of a mock OBASHI Business & IT diagram (minus labels) which can be used to describe / model systems from business process down to base infrastructure:
Placing those blocks only took a few minutes, but if you’re new to the game, follow these instructions:
- Buy & install minecraft and set up an account to log in
- Start a new single player world and in the world options choose creative mode, and in the sub-options menu choose a ‘super flat’ world type. If you’re given the option to choose a template, I usually go with ‘redstone’ as it will give you a clean, flat, sandstone effect ground layer.
- Once you spawn in the game, WASD keys will move you around (use the mouse to look), double-pressing space bar quickly will let you fly (ctrl to descend and space to ascend) and E will bring up your inventory. Pick any block and use the mouse buttons to place and destroy blocks. Most blocks will float in the air one placed, but you need to place them on something first.
Placing blocks by hand in any volume will be too time consuming to be useful. Vanilla minecraft offers a mechanism to automate this using something called a command block which lets you store and replay a single command (in this case a command called ‘setblock’) but this only lets you place one block at a time. You can of course chain multiple command blocks together, but this is nearly as much faff as placing them by hand.
Modders to the rescue
Part of the great charm of minecraft lies in the astounding number of freely-available third party modifications to the game. From automated quarries to nuclear fusion reactors to rockets, pretty much everything is catered for. You can even programme computers inside the game (how meta is that?) and that’s what we’re going to use to automate the build of our CMDB – Computercraft (aka CC) v1.75.
ComputerCraft does many things inside the game, but the bit we’re interested in is the ability to script and execute large lists of setblock commands. You can either do this by placing a standard CC computer next to a command block, or by placing a CommandComputer in the game which combines both.
Installing Computercraft is not so trivial. You have two options: either you can manually install the Forge ModLoader (by unpacking and repacking the JAR java file) and then copying over the CC mod, or you can use a ready-modded client from the FTB or Technic launchers which are free to use once you’ve bought minecraft. For the rest of part 1, I used the FTB Infinity modpack (which contains a lot more than CC). If this CMDB-minecraft experiment proves popular, I’ll look at making a dedicated client with all mods included for a one-click install.
Back to the experiment…
If we now create a small program called cmdb and write the following commands:
and then save and run it, we get the following result:
Now we can programmatically place blocks. Walking through the above script, the first line sets coordinates relative to the block the computer is placed, and Commands.async.setBlock is the syntax to invoke the command to place a block (the async part allows all blocks to be placed simultaneously – though minecraft will struggle with more than 1000 blocks placed at a time) and the coordinates set the position with the very last number, 35 here referring to the block ID to be placed – in this case, grey wool.
In minecraft, x and z coordinates are your north/south/east/west coordinates, and y is vertical (height). In the above example, I’ve offset the z axis by 15 blocks so it doesn’t place the blocks right on top of you. Notice that we haven’t drawn any links between blocks, these are inferred through spatial relationships (above or next to other blocks implies a link).
Building larger structures is now a case of pasting in bigger and bigger scripts, and since we’re incrementally increasing one number at a time (in most cases) and using very similar commands, I’ve used Excel’s fill and concatenate commands to build bigger data sets.
This leads us to one limitation of computer craft, you can’t copy and paste into it. CC does however let you connect to pastebin.com – a free sharing site. Simply go to pastebin, create a new paste containing your commands, note the ID (in the example below the ID is 8iYYj3x5 and use this inside Computercraft with the following syntax:
The pastebin and get are pretty self explanatory. The id is the ID you got from the URL and the program name is the program you want it to be saved inside the computer in minecraft. In this case I used cmdb30 (as I’m iterating quite fast…).
So now we have a repeatable process:
- Build the block list in excel
- Copy the list to pastebin
- Import to CC and execute
With this and some basic excel formulas we can build 3d models fairly easily.
Using data validation and vlookups in excel we can also start to adjust axis offsets to force certain CI classes to specific layers in the diagram, and if we relate time to the Z-axis here as an example, we can start building diagrams comprised of multiple snapshots over time.
Using the example of this script http://pastebin.com/8iYYj3x5
I’ve shown 3 slices of the same 2 layer B&IT style diagram which could represent the same infrastructure and server configuration items over 3 different time periods.
Which brings us to the interesting questions – what do we use the different dimensions for?
A standard OBASHI B&IT diagram for example would be 2d. I’ve sort of envisaged in the diagram above that the third dimension is used for time; as you move forward past the blocks you go back in time. But we actually have more than 3 dimension. There’s rotation, and we can also use extremes of the existing dimensions to add another, for example, if an existing B&IT diagram is 1000 blocks wide, we can move ourselves 1001 blocks away in any of the cardinal directions (minecraft has a 256block height restriction) with a single ‘teleport’ command and start drawing again.
In part 1 we haven’t really done much more than play with placing blocks programmatically, but we have identified a few areas to focus on for future investigations:
- What do the physical dimensions relate to?
- Are spatial relationships enough or do we need to be able to draw lines?
And a couple of practical/technical issues have occurred to me in the course of this I want to try and address in the future:
- Plotting out block lists in excel is admittedly easier than doing it by hand, but will generate a lot of data. Can we be cleverer about this?
- Blocks are pretty dumb, as in they contain no other information (other than their colour). How do we get this information (e.g. server name, IP address) shown in this model?
It would be nice to see this taken further, to the point where it’s showing meaningful relationships between data and possibly provide some stimulus for tool vendors to start thinking about how they’re going to work in the VR space – if at all.
Got something to add or suggest? Post away in the comments below! Part 2 is on its way.