A 3D Game Frontend for the SAP HANA SHINE Demo Content
Have you ever wondered what would happen if you took software used for business processing and somehow combined it with software used for 3D games? Something like this:
Well wonder no longer. This article describes how to fit a 3D game front-end on top of the SHINE (SAP HANA Interactive Education) demo content available in your SAP HANA system. The 3D game client runs on your Mac or PC and connects to your HANA server. The client reads Purchase Order (PO) information from the HANA system and creates PO “creatures” in the game that you can then hunt, analyse and shoot to approve or reject them in the HANA system. There is also a reporting element, where 3D bar charts can be climbed on to give you a different perspective on your data – OLTP (of sorts) and OLAP in a single 3D world.
Have you ever wanted to actually shoot your data? Well now you can 🙂 . Details on how to install and run the client yourself, along with its source code are given later.
This video gives you a better idea of how it plays out. This shows a Rev72 system having POs approved and rejected and some bar charts analysed, occasionally showing the SHINE Web interface for comparison:
The cardboard boxes are the POs, with images of their contents from the Rev72 system. Here are some screenshots:
A PO is Rejected
A PO is Approved
A Bar Chart
As you can see, if you reject a PO in the game it explodes, whilst approved POs zoom upwards to their (religion-neutral) “PO Heaven”. These changes are reflected in HANA before the graphical effects happen in the game. If you stand on the switches near the bar charts you control what the charts display, and these are showing the same data as you see in the SHINE web reports.
You may well ask “why on earth would I want to connect a 3D front-end to HANA?” That is a very valid question, and one I’ve asked myself more than once. Think of it as a Proof of Concept showing what sort of things are possible with a 3D interface over HANA. It is arguably a form of “gamification“, and this article is the “Making of” companion to another article posted over on the SCN gamification area which looks more at the gameplay aspects (such as they are) and how the PoC could be developed further. It is interesting to see that a company that make 3D Virtual Reality goggles, called Oculus Rift. were recently bought by Facebook, so 3D may be becoming more mainstream in future.
You can install the client on your PC or Mac and connect to any HANA server that has the SHINE content installed (it is there by default now if you are on a recent revision). There is no backend install required on the HANA system, you just need the local client. A big thanks to Aron MacDonald for his input to this work, helping with testing and providing valuable feedback and ideas. To try out the 3D Game Client for yourself follow the next section:
1) How to Install and Play HANA SHINE 3D
If you don’t have access to one already, you can get your own HANA system. The following versions are supported: Rev 60 / SP6, Rev 70 / SP7 and Rev 72. SP8 is not tested yet, but will work if the SHINE content is similar.
IMPORTANT: for Rev 72 you must make sure that your user id has a default Session Client set. If this is not in place the 3D game client will not detect your HANA version correctly and charts won’t work (the setting is needed for the SHINE currency conversion). To make the setting, in HANA Studio, Systems tab -> Security -> Users, make sure your user has its, like this:
To check that you’ve got the SHINE content installed, you can check that you can see data in the PO Worklist application using these links:
SHINE PO Worklist Entry Points
|Version||URL to PO Worklist
|Rev 60 / SP6||<server ip address>:80<instance>/sap/hana/democontent/epm/ui/poworklist/WebContent/poWorklist.html|
|Rev 70 / SP7||<server ip address>:80<instance>/sap/hana/democontent/epm/ui/poworklist/poWorklist.html|
|Rev 72||<server ip address>:80<instance>/sap/hana/democontent/epmNext/ui/poworklist/poWorklist.html|
The above links take you to the web front-end for the SHINE PO Worklist. There you can check data, and see POs changing their status to Rejected and Approved.
There are some front-end prerequisites. You need one of: Windows XP with SP2 or later; Windows 7 with SP1 or later; Windows 8; Mac OS X Snow Leopard 10.6 or later. Windows Vista is not supported. You also need a graphics card with DirectX 9 level (shader model 2.0) capabilities. Any card made since 2004 should work. The front-end does not work on the CAL remote desktop PC on AWS, it does need to be run locally.
How to Install Front-end Client
To download the client go here: https://www.dropbox.com/s/wda5ae2h5dfbeeq/Epm3d_Windows_x86.zip
To install, just unzip it into any folder, there is no actual installer.
Windows 64 bit
To download the client go here: https://www.dropbox.com/s/x6iut2p65itk7ti/Epm3d_Windows_64.zip
To install, just unzip it into any folder, there is no actual installer.
To download the client go here: https://www.dropbox.com/s/4jzm9snfawi6ox3/Epm3d_MacOS.app.zip
To install the client see Aron’s document, you have to skip past a couple of screens during start-up.
How to Play
- Run the executable.
- On the first popup enter your HANA system details, and press check connection:
- If the check connection fails, error messages telling you why will appear in the box at the bottom of the screen. See also the troubleshooting section below.
- Then press Start.
- There is help displayed in-game, press F1 to toggle it, but for completeness the help is here too:
- Once in the game, use mouse to look around and the keys WASD or cursor keys to move around. Stand on the buttons nearby the charts to interact with them (refreshing charts and changing their type).
- With a PO box highlighted, click left mouse or press Y to approve the PO in the system. Click right mouse or press N to reject a PO. These approvals or rejections are reflected in the HANA system (in fact they won’t appear in the game until they are successfully posted to the HANA system). You can check the data in HANA has changed using the links to the SHINE PO Worklist given above.
- If the client does not start at all, it is most likely your PC is too old (>10 years old wont have good enough graphics card).
- If the client starts but the connection check fails, make sure system details and user details are correct. Make sure user has rights to view and change the SHINE content, which you can check using the SHINE PO Worklist Entry Points links above.
- If the client does not detect your version as Rev72, and you know you’re using Rev72, this is almost certainly because your user id does not have a default client set, see Back-end Prerequisites section above.
For Advanced Players
- Hold down the Shift key (Windows) or the Alt key (Mac) when you start the executable and an additional dialog appears. This allows you to specify screen resolution and graphics quality, and also to edit the controls.
- To invert the mouse press “m” during gameplay. This inverts the up-down axis for the mouse when you are looking around, some people find this easier to use.
2) How to Create a 3D HANA Client
So with all that out of the way, finally we can get to the “How to” part. The game client was built using a product called Unity. Unity was designed originally for developing 3D games, but is also used for 3D visualisation like walk-throughs of buildings. There is a free edition which has a few advanced features removed, but all the heavy lifting of 3D development is done for you. Lighting, physics, input, cross-platform builds and much more are either done for you entirely or at least are well supported by the Unity engine. All you need to do is some C# or JS scripting to control the behaviours of objects and glue stuff together. I chose to use C# as most tutorials tend to use that, although you can mix scripting languages if you wish across different objects.
The communication between the client and HANA is all done using oData and XSJS services, the same services that are used by the standard SHINE web frontend. To find these I used the web frontend (see the links in section “SHINE PO Worklist Entry Points” above) with Fiddler running, and that way I could see all the oData and XSJS calls that were being made. With that, it was easy to generate the necessary URLs.
Trivia: SP6 used UPPERCASE for field names, so oData service calls are eg “PURCHASEORDERID”. SP7 changed this and used TitleCase for fields, so oData service calls became eg “PurchaseOrderId”. Then Rev72 went back and used UPPERCASE again, so URLs are back to saying “PURCHASEORDERID”. What will SP8 bring, back to TitleCase perhaps?
The source code and assets are all available in GitHub. Unity is easy to use, but not so intuitive that you can dive in immediately and follow it all. At least do the intro videos tutorials provided the Unity team to learn the interface or you’ll quickly get pretty lost (at least I did).
To help orientate yourself if your looking through the Unity project files, the various objects in Unity link together like this:
Unity Client Architecture Diagram
The boxes in the above diagram are mostly C# scripts in the Unity project. Most of the communication between objects is event driven (you’ll see lots of On* event handlers in the scripts, for example when collisions happen, or when an oData query returns). There are also per-frame calls made by the Unity engine, so every 1/50th of a second (or thereabouts) the Update() method is called, which is used to handle drawing things and collecting user input.
I hope this article proves interesting, the source code is there to pull apart and reuse, any feedback is welcome.