Reward your players with achievements for reaching certain goals in your game and to give them more incentive to keep playing your game. More...
Import Statement: | import Felgo 3.0 |
Inherits: |
Achievements are another way to increase player retention: they motivate players to return to the game, until they have unlocked all achievements in a game. Examples for game achievements are:
You can define these achievements in QML and they get uploaded to the Felgo Game Network server when you run your application on Desktop. This is a key advantage over other gaming services where you are required to leave the code environment and define the achievements in the web - with Felgo Game Network you can fully create and change your achievements in QML code and they are then synced with the server!
This image shows how the GameNetworkView displays the achievements in ChickenOutbreak Demo with the AchievementView.
The only required Achievement property you need to set is the key property. To make an achievement more valuable than the other, use the points property. And for displaying an image in the AchievementView also set an iconSource, name and description.
You can modify the progress of the achievements with FelgoGameNetwork::incrementAchievement() or FelgoGameNetwork::unlockAchievement() until they are fully unlocked.
This is the FelgoGameNetwork::achievements definition for the three achievement examples mentioned above:
FelgoGameNetwork { achievements: [ Achievement { key: "5opens" name: "Game Opener" iconSource: "../assets/img/achievement_5opens.png" target: 5 points: 10 description: "Open this game 5 times" }, Achievement { key: "bossLevel2" name: "Obsessed Collector" iconSource: "../assets/img/achievement_bossLevel2.png" target: 1 points: 5 description: "Defeat boss enemy of level 2" }, Achievement { key: "level3" name: "Third Level Master" iconSource: "../assets/img/achievement_level3completed.png" target: 3 points: 15 description: "Reach level 3" } ] }
See also Achievements, FelgoGameNetwork::achievements, and GameNetworkView.
counter : int |
Read-only property that gets modified with FelgoGameNetwork::incrementAchievement() and FelgoGameNetwork::unlockAchievement() until it reaches the target property.
description : string |
The description shown in the AchievementView or when posted to Facebook.
iconSource : url |
Set this property to use a custom achievement image in the AchievementView or in GameNetworkView. The image size should be 512x512 pixels. On low-end devices with sd resolution the achievement image is displayed as a 54x54 pixel image in the GameNetworkView, so design your achievement image with little details that are still visible in such low resolutions.
Note: The path to the achievement image is relative to your qml file that contains the FelgoGameNetwork component.
key : string |
This property holds the key for calling FelgoGameNetwork::incrementAchievement() and FelgoGameNetwork::unlockAchievement().
This is a required property.
Note: If you also connected your game with GameCenter, set the same key for the achievement in Felgo Game Network and GameCenter.
localData : variant |
Use this property to store any data you would like to set locally for this achievement which does not get uploaded to the server.
For example set it to an internal point value that gets used to increase the LevelStore::playerCredits if a player unlocks this achievement after a call of FelgoGameNetwork::onAchievementUnlocked.
name : string |
The name shown in the AchievementView or when posted to Facebook.
points : int |
The points represent how valuable the achievement is compared to other achievements. In other words, this property describes how difficult it is to earn the achievement. It represents the points for gaming networks like Facebook, GameCenter and Google Play Game Services.
The default value is 5
.
Note: This property has no connection to the target property, although in most cases the bigger the target value is, the more valuable this achievement is and the more points it is worth.
To support multiple networks with a single API call, stick to the following rules:
Note: Distribution in this context means that achievements with higher points get displayed more prominently in the social graph of the Facebook user. This means the higher the points are, the more likely other users will see a post in their timeline about the user who reached the achievement.
Achievement Guidelines for supported (or in future supported) game networks can be found here:
If you like to award the player for example with LevelStore::giveCurrency() with a different value than the points value used for the server, you can store this internal reward value in localData.
target : int |
The counter
value needed to unlock this achievement. The default value is 1
.
unlocked : bool |
Read-only property you can connect to for checking if the achievement was already unlocked.
See also FelgoGameNetwork::unlockAchievement(), FelgoGameNetwork::incrementAchievement(), counter, and target.