Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Achievement

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:

QtObject

Properties

Detailed Description

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:

  • Open a game 5 times.
  • Defeat enemy boss of level 2.
  • Reach the third level.

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.

Example Usage

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.

Property Documentation

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:

  • Each game gets a total of 1000 points to distribute across all their achievements.
  • Each game gets a maximum of 1000 achievements.
  • Maximum point value for an achievement is 100.
  • Achievements which are scarcer and have higher point values will receive more distribution. For example, achievements which have point values of less than 10 will get almost no distribution. Apps should aim for between 50-100 achievements consisting of a mix of 50 (difficult), 25 (medium), and 10 (easy) point value achievements.

    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.

  • The points value of achievements must be a multiple of 5 to adhere with other gaming networks.
  • One user can achieve a particular achievement for a game only once.

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.


Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded