11. Game Progress

For analyzing player engagement, or providing incentives to the players,
game developers are adviced to report players' game progress to the platform.

※ This function is available since SDK version 3.0.4

11.1. Report game progress

Developers report the players' game progress, such as level-up, stage cleared, or achievement unlocked to the platform by calling the API function gameProgress() with details of the specific event.

※Beware that occasionally calling this function will cause rewards dialog being popped-up, or player being redirected to the reward collecting page, which in turn causes player to leave the game. Please avoid calling this API during intensive game-play. Also developers should save the game data before calling this function, if necessary.

11.1.1. Description

The API allows developer to report event_id and event_data, where event_id can be one of predefined events or custom strings; optionally passed in event_data containing relevant event details or custom values.

The reporting function is executed asynchronously and return a Promise object.

11.1.2. Report game progress API

wakool.gameProgress(event_id, event_data);

Parameters:

name type description
event_id string Either a predefined event ID or custom string.
event_data object Details relevant to the event, optional. Should be a data object contains predefined event datas or custom values.

Predefined event IDs

event ID description
LEVEL_UP Player leveling up. Consider provides level in event_data.
STAGE_CLEARED Stage cleared event. Consider provides stage, score in event_data.
ACHIEVEMENT_UNLOCKED Achievement unlocked event. Consider provides achievement in event_data.
GAME_CLEARED Game cleared. Consider provides score in event_data.

Predefined event details

name type description
level int The current level of the player
stage string The current stage of the player
achievement string The id of the achievement that player achieved
score int The current score of the player
server_id string The current server id of the player

Example

wakool.gameProgress('ACHIEVEMENT_UNLOCKED', {
    level: 100,
    achievement: 'king_of_the_world',
    description: 'First player to reach level 100',
}).then(function(result){
    if(result.exit_game) {
        // about to redirect the player to collect rewards 
        // and leave the game page. Here's the last chance to 
        // save the game data.
    }
});

results matching ""

    No results matching ""