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 Platform” by 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.
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
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
]
}
]
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 |
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.
4. Navigate to the tab PLAYERS. Verify the player JIRA_USER as shown in the screenshot below.
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“
}
]
}
]
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.
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
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
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
Hi Greg,
Thanks for pointing this out 🙂 .
Best Regards,
Anuj