Skip to Content

As described in the the master document of this blog series, the first blog post is to implement game mechanics for JIRA.


Prerequisites:

You need to sign up for a free SAP HANA Cloud Platform developer account and enable HANA Cloud Platform Gamification Service. For this, refer to the blog post “Try out Gamification Service on SAP HANA Cloud Platformby Michael Ameling.


Game mechanics are constructs of rules or methods designed for interaction with the game state, thus providing a gameplay [1].                                                                                                                                               [Wikipedia]

In order to implement a game in SAP HANA Cloud Platform gamification service, you need to configure its game mechanics using gamification workbench.

Gamification Workbench:

It is an online development and administration environment for easy implementation and analysis of gamification concepts. It is part of SAP HANA Cloud Platform gamification service.


How to launch the workbench?

Navigate to gamification workbench from HANA Cloud Platform cockpit by clicking Services->Gamification Service (BETA) -> Go to Service.

(Bookmark it as you will be using this in subsequent blog posts.)

A sample implementation JIRA_App (Part 1).zip containing game mechanics has been provided. You can import this file to configure these game mechanics in your gamification workbench.

In the sample game, a player is assigned points for every issue created. The game mechanics is packaged in an app named JIRA.

This app contains two entities:

  • A Point named Experience Points and
  • A Rule that assigns 2 Experience Points to the player when an event issueCreated is received.


More information on how to configure game mechanics using gamification workbench can be found here.

Implement game mechanics:


1. Open the gamification workbench as described above.

2. Import the file JIRA_App (Part1).zip using gamification workbench as described  here.

3. Verify that the app was successfully imported. Select JIRA in the top most right corner.Navigate to tab GAME MECHANICS. Verify that the contents of tabs Points and Rules are as shown in the screenshots below.

Blog1_1.png

Blog1_2.png

 

Test game mechanics:

In order to test the game mechanics first you will create player named JIRA_USER for your app JIRA and then you will send a test event issueCreated to the gamification service and verify that 2 Experience Points have been assigned to the Player JIRA_USER. You will use the API Terminal to create player and send the test event.

Create player in app JIRA:

1. Navigate to API terminal in gamification workbench by clicking GAME MECHANICS->Terminal as shown in the screenshot below

Blog1_3.png

API Terminal allows you to execute one or more gamification service API calls.

2. Provide the following as JSON Input by replacing the contents:

[

   {    “method”:”createPlayer”,

        “params”:

        [  “JIRA_USER@mail.com“,

            “JIRA_USER”,

            true,

            null  

         ]

    }

]

Blog1_4.PNG

This API is used to create new player by invoking method createPlayer() of gamification service. Following are the input parameters of this method.

Input parameter

Description

JIRA_USER@mail.com

The unique id for the player to be created.

JIRA_USER

Name of the player

true To show the player’s name to others
null Profile image of the player

3. Click Execute button to execute the API call and you will get success message as shown in the screenshot below.


Blog1_6.PNG

4. Navigate to the tab PLAYERS. Verify the player JIRA_USER as shown in the screenshot below.

Blog1_7.PNG

Send events to gamification service:

1. Provide the following as JSON Input by replacing the contents:


[

   {

       “method”: “handleEvent”,

       “params”:

     [

         {  “type”: “issueCreated”,

             “playerid”: “JIRA_USER@mail.com

          }

       ]

    }

]

Blog1_8.PNG

This API is used to send event issueCreated to the gamification service by invoking method handleEvent() of Gamification service. The method handleEvent() is used to submit events that need to be processed by the Gamification Service. Here, player id and type are the input parameters of this method.

Input parameter

Description

type

issueCreated (Type of the gamification relevant event)

playerid

JIRA_USER@mail.com (The unique Id of the player)

3.Click Execute button to execute the API call and you will get success message as shown in the screenshot below.

Blog1_9.PNG


4. Now that the test event has been triggered, you can verify the points assigned to the player. Navigate to the tab PLAYERS.

You will see Experience points with 2 points as shown in the snapshot below


Blog1_10.PNG


Note:

If you execute the test event again, the Experience Points for this player will be advanced by 2 points.

Hurray!! Part 1 is complete.

In the next blog, you will install the Atlassian SDK and create a JIRA plug

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Gregory Tutt

    Hey mate,

    Very nice blog…

    One of your JSON is actually not correct (to raise the event), here is the correct one:

    [

       {

           “method”: “handleEvent”,

           “params”:

         [

             {  “type”: “issueCreated”,

                 “playerid”: “JIRA_USER@mail.com

              }

          ]

        }

    ]

    Cheers

    Greg

    (0) 

Leave a Reply