< Back to Manuals

Metrics

Metrics are used to measure the performance of the players in your game, of teams, and even of your whole game. Normally, you'd setup your metrics to capture and quantify a specific behaviour of your players, so that you can later assess how well your players are being driven. There are four kinds of metrics Playlyfe offers you. These are:

Point Metrics

The simplest form of metrics, they are found in most games. They are just a numerical value which increases/decreases when players perform actions. They are used to keep track of player progress.

Points can be given to a player by performing an action, a task in a process or by executing custom rules.

Point metrics can be used to create leaderboards. You can also model level systems by combining a point metric and a state metric in a level rule.

Use Cases

Point metrics are ideal to capture any kind of progress or for keeping track of any activity.

Related API

Set Metrics

A set metric is a group of unordered items.

While designing set metrics, you need to define preset items.

Use Cases

There are several ways you can use sets.

  • You can use set items as badges to represent a player's progress in various aspects of your game.
  • You can use set items as tags or inventory items on a player.
  • You can combine set items with achievement rules to make player achievements.

Related API

State Metrics

A state metric indicates a particular state which the player is currently in.

While designing state metrics, you need to define preset states, which are essentially the various states that a player can take.

Use Cases

A state metric can be used to associate a state with a player. This could be as simple as active, online, banned, etc or can be combined with our level rules to create a player leveling system.

Related API

Compound Metrics

This a special type of a metric who's value depends on other metrics.

Unlike other metrics, which can be modified directly, compound metrics can never be directly modified (i.e. you cannot add to or remove from a compound metric score). Their value is always computed from an expression.

This metric has a formula constraint, which is the expression that is used to calculate the value of the compound metric, can reference a player's scores along with constants in the formula. Only point, set and compound metric scores can be referenced in the formula.

Compound metrics can be used to create leaderboards and can also be used in rules, similar to point metrics.

Use Cases

Compound metrics work well if you need a consolidated score that represent various factors.

For example, in a sales and marketing team, it would be unfair to judge someone based on a single metric. The performance metric should reflect several factors such as sales, leads, calls made, promotional tweets made and so on.

Compound metrics let you aggregate the effect of all of these into one, meaningful metric.

A screenshot of Compound metric being created
A screenshot of Compound metric being created

Related API

Design Structure

Base Structure

Field Description
id A unique ID for the metric.
name A name for the metric.
description Brief description of the metric.
image An image which represents the metric. You need to send a multipart form POST request to upload the image data.
type Type of the metric: one of point, set, state and compound.
constraints

The constraints on a metric differ depending on what type of metric it is. Refer to the linked sections for each metric type:

tags Array of strings which can be used when querying to get all designs based on certain tags specified

Point Metric Constraints

Field Description
min The minimum value the point metric can have.
max The maximum value the point metric can have.
default The value which will be used in calculations if this metric is not already set on the player.

Set Metric Constraints

Field Description
max_items The maximum number of unique items of the set that a player can have.
items An array of individual items in the set. Click here to see the properties each item can have.

Set Item Properties

Field Description
name Name of the item.
description A brief description of the item.
image An image that represents the item.
max Maximum count of the item a player can get.
hidden Hidden set items will not show up in player profiles if they are not earned. Items can be marked as hidden for surprise/hidden rewards.

State Metric Constraints

Field Description
states An array of individual states in the metric. Click here to see the properties each state item can have.

State Item Properties

Field Description
name Name of the state.
description A brief description of the state.
image An image that represents the state.
max Maximum count of the item a player can get.
hidden Hidden set items will not show up in player profiles if they are not earned. Items can be marked as hidden for surprise/hidden rewards.

Compound Metric Constraints

Field Description
formula The formula which is evaluated to get the metric's value.

Examples

Point Metric

{ "name": "Experience", "id": "experience", "type": "point", "description": "My Players experience within the game", "constraints": { "default": "10", "max": "5000", "min": "10" }, "tags": ["course_1", "game"] }

Set Metric

{ "name": "Badges", "id": "badges", "type": "set", "description": "My Players will get these badges", "constraints": { "items": [ { "name": "Rookie", "description": "Just Starting" }, { "name": "Trainee", "description": "Just Training" }, { "name": "Teacher", "description": "Teaches Others" } ], "max_items": "Infinity" } }

State Metric

{ "name": "Levels", "id": "levels", "type": "state", "description": "The level my player is currently in", "constraints": { "states": [ { "name": "Beginner", "description": "" }, { "name": "Medium", "description": "" }, { "name": "Advanced", "description": "" } ] } }

Compound Metric

{ "name": "Karma", "id": "karma", "type": "compound", "description": "The Karma points a player has", "constraints": { "formula": "$scores['experience'] * 10" } }