Achievements #
Achievement systems are a great tool for game designers to use to create a sense of progression and reward for players. It can be used to unlock new content, provide a sense of accomplishment, and reward players for their progress.
An “achievement” represents a player task which can be completed and, on completion, can unlock a reward. The reward can be in-game currency, collectables, energy, energy modifiers, or consumables.
Achievements can be configured to repeat on a schedule, or to repeat automatically when the player completes the task. They can also be one-off achievements which are only completed once.
For increased player engagement and larger sense of progression, achievements can be configured to have a precondition. This means that the achievement cannot be completed until one or more other achievements have been completed.
Achievements can also be configured to have any number of sub achievements. Sub achievements are nested, hierarchical achievements that can be used for progressive rewards.
Customization parameters #
The following JSON represents the customization parameters you can use to configure the default user experience for the achievements system.
|
|
The JSON schema defines an achievements
object which must contain an individual object for each achievement you wish to define in the system. You can configure as few or as many achievements and sub-achievements as needed for your desired gameplay.
Each achievement is keyed by id and may define the following:
Property | Subproperty | Description |
---|---|---|
auto_claim | Whether the achievement reward should be given automatically upon completion. | |
auto_claim_total | Whether the achievement total reward should be given automatically upon completing this and all sub-achievements. | |
auto_reset | Whether the achievement should reset after completion. | |
name | The display friendly name of this achievement. | |
category | The category name for this achievement. | |
description | The description for this achievement. | |
count | The initial count towards progress for this achievement. | |
max_count | The number of times this achievement can be progressed before it can be claimed. | |
duration_sec | How long (in seconds) this achievement is available for progression after creation. Used for limited time achievements. | |
reset_cronexpr | The reset interval in CRON format. | |
precondition_ids | An array of achievement ids the user must have completed to qualify for starting this achievement. | |
reward | An object that defines what rewards a player should receive once they complete this achievement. | |
sub_achievements | An object with the same Schema as the root achievements object, used to define nested achievements. | |
total_reward | An object that defines what rewards a player should receive once they have completed this achievement and all sub achievements. | |
additional_properties | A string:string dictionary of key value pairs that can contain additional context. |
Initializing the achievements system #
The achievements system relies on the Nakama System and the Economy System, both must be passed in as dependencies via the constructor.
|
|
Subscribing to changes in the achievements system #
You can listen for changes in the achievements system so that you can respond appropriately, such as updating the UI, by implementing the appropriate interface.
|
|
Refreshing the achievements system #
To ensure the achievements system has the latest information from Nakama you can refresh it.
|
|
Listing achievements #
You can list all achievements for the user.
|
|
You can also list all repeatable achievements for the user.
|
|
As well as list achievements by category for the user.
|
|
Listing available achievements by category #
Similarly to above, you can list achievements by category for the user, including only achievements the user is currently able to complete.
|
|
Updating achievement progress #
You can update the user’s progress for achievements.
|
|
Claiming achievement rewards #
You can claim rewards for an achievement. You can also specify whether you would like to claim any available total rewards (e.g. if the user has completed all sub-achievements) as well as whether or not to refresh the Economy System.
|
|