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 VPlay 2.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 V-Play 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 V-Play 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 VPlayGameNetworkView 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 VPlayGameNetwork::incrementAchievement() or VPlayGameNetwork::unlockAchievement() until they are fully unlocked.

Example Usage

This is the VPlayGameNetwork::achievements definition for the three achievement examples mentioned above:

 VPlayGameNetwork {

   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, VPlayGameNetwork::achievements, and VPlayGameNetworkView.

Property Documentation

counter : int

Read-only property that gets modified with VPlayGameNetwork::incrementAchievement() and VPlayGameNetwork::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 VPlayGameNetworkView. 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 VPlayGameNetworkView, 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 VPlayGameNetwork component.


key : string

This property holds the key for calling VPlayGameNetwork::incrementAchievement() and VPlayGameNetwork::unlockAchievement().

This is a required property.

Note: If you also connected your game with GameCenter, set the same key for the achievement in V-Play 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 VPlayGameNetwork::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 VPlayGameNetwork::unlockAchievement(), VPlayGameNetwork::incrementAchievement(), counter, and target.


Videos

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support