Gamifying fitness

Can we apply gamification techniques to a fitness app to increase user engagement, making it more fun to workout in the process? I gave it a go.

When developing Sukuwatto I wanted to create something more than just a workout tracker.

Motivation is often cited as a factor in adhering to a fitness program. To increase motivation when using the app I worked on two axis: The social aspect, with social network features part of the core of the program; and the gamification aspect, where game elements were integrated with the activities the user performed. In this post I expand my thoughts on the latter.

But what sort of players are there anyway?

Richard Bartle is an author, professor and game-designer. He created the first Multi-User Dungeon in 1978, the MUD1. MUDs are multiplayer real-time virtual worlds. Usually text-based, MUDs offer various distinct game elements from role-playing games, action games, interactive fiction, online chat and more.

With his experience creating and observing the world of MUD1 and seeing how players interacted with one another he came up with a taxonomy of player types.

In his proposal he argued that there are four types of players:

  • Achievers: For the achiever, the aspect that they enjoy most out of a game is points-gathering and rising levels. They give themselves goals related to the game and go out to achieve them;
  • Explorers: These players are more interested in roaming the world, figuring out how game mechanics work, eventually find out what features or bugs a game have that can be exploited. For them discovery is the prime motivator for play.;
  • Socialisers: They enjoy communication with other users the most. They are interested in people and what they have to say and role-playing or gameplay are simply a means to forge bonds with the rest of the players;
  • Killers: Moved by their desire to impose upon others, the killers like to attack and distress the rest of the players and take great joy in doing it.

Amy Jo Kim, a neuroscientist and programmer with a degree in experimental psychology, expanded on Bartle’s ideas with her Social Action Matrix talking about players who are Competitors, Collaborators, Expressers or Explorers, and associating action verbs with each type to define what they usually do most in a game:

  • Competitors: These users usually want to fight, compete, win, challenge, showoff, compare, taunt;
  • Collaborators: They prefer to like, comment, greet, collaborate, help, share, contribute;
  • Expressers: Like to build, create, express, design, decorate, choose, customize, purchase;
  • Explorers: Users in this category like to explore collect, view, rate, find, vote, search, curate, review.

If fitness was a game, what sort of game would it be?

When creating a balanced game or an application with game-like elements that is played socially it is then important to take into account these different players types, so we can offer experiences to each that will engage them and make them want to play.

Sukuwatto already has features that appeal to socializers/collaborators: Users can like, comment, share or chat with each other.

What sort of game can we build that would appeal to the rest of the types then? What genre is broad enough to have space for competitors/killers, explorers and achievers?

I went with the role-playing game genre.

Rewarding the players: Experience points

To start with we have to have something to use as a way to keep score for the player. Here are my goals with this:

  • All activity should be rewarded: This means that everytime you log a workout you should get a reward;
  • Rewards should be a function of effort: Walking for 5 miles should yield a bigger reward than a 1 mile walk. Benching 50kgs for 5 sets should represent a bigger reward than benching 40kgs for 5;
  • Rewards should be reversible: Since workouts can be changed or deleted, player rewards should be adjusted accordingly everytime that happens.

Building on these three principles I gave each user an integer-based experience points (XP) field. The more you workout, the more you increase your XP. The harder the effort, the bigger the reward too.

In classic RPG fashion these experience points go towards increasing a player’s level. This level serves as an easy to use way to compare a user’s time and effort spent doing physical activity with the rest of the community.

I’ve decided to go with a Final Fantasy style exponential function to determine the experience points threshold for each level:

Experience/Level progression chart
def get_level_experience(self, level):                                                                   
    exponent = 1.5                                                                                       
    base_experience = 1000                                                                               
                                                                                                         
    return floor(base_experience * (level ** exponent))

Identity: Skills and classes

I’ve also added the concept of skills in the game. A skill is a symbol of proficiency in a certain type of activity:

  • They can have a one-to-one relationship with an exercise. So, for instance, if you log a Walking activity, your Walking skill will increase;
  • They can also represent proficiency in a set of exercises. Do Crawl or Butterfly swimming exercises and you’ll increase your Swimming skill;
  • Skills can also be dependent on specific characteristics of activities: Doing isolation weight-lifting exercises for 8-12 reps will increase the Body building skill. Compound weight-lifting exercises for 5 reps will increase Powerlifting.

There are almost 100 skills available and every user gets a set of skills of its own based on what activities they log. These skills, like the user, have their own experience-points and level indicators.

To give the player a sense of identity, a class is derived from their skills: The skill with the most experience points of the lot will represent the primary class. Run a lot and you’ll be a runner, play a lot of tennis and you’ll be a tennist. If the second skill with the most XP is over half the experience points of the first, the player will also get a secondary class. If you run a lot and do a lot of powerlifting you may turn into a Runner/Powerlifter for instance.

Player profile and skills view

Balancing gameplay

Leveling up after a workout is completed

Now that we have the mechanisms in place to allow a player to progress how do we balance the progression as to level up the player as they improve? Using level 100 as a sort of endpoint where we assume a player has ‘mastered’ the game, how much experience points should we hand the player for each activity and how do we assess the difficulty of each activity in scoring the player?

In Outliers: The Story of Success, Malcolm Gladwell argues that 10.000 hours are needed to achieve mastery in a given field. But that’s surely too much time in the context of a fitness game aimed mostly at amateurs.

At the same time, the usual 50-200 hours common in single-player roleplaying games like The Witcher or Skyrim are perhaps too little: It would represent between 3 months - 1 year of consistent training.

So where do we draw the line?

Let’s start by looking at weightlifting.

In Practical Programming for Strength Training Mark Rippetoe and Andy Baker have this chart:

Relationship between performance improvement and training complexity over time

In their book, terms like novice, intermediate and advanced relate to the time that it takes for an athlete to recover from a homeostatic disruption caused by training and not to their strength or athletic ability.

Since novice athletes have little to no experience with training with weights they’ll be able to quickly recover from a workout activity in a time frame of 48-72 hours. These athletes are still very far away from their physical potential and linear progression training programs that increase weight in every workout are encouraged for as long as they can be sustained.

Athletes move from the novice to the intermediate category once it becomes increasingly difficult to make progress from workout to workout and progression begins to stall even after smaller weight jumps and better efforts at managing recovery have been employed.

An intermediate athlete thus needs more attention to the recovery phase of their training. Recovery will take a longer time at this stage, so instead of making progression from session to session, these athletes will usually only be able to increase weight in their exercises in a weekly basis. These athletes will also benefit from exposure to more diverse exercises than novices.

Once progression begins to stall again, the advanced stage is reached with further complexity in training schedules, workloads and movement patterns needed to keep progressing.

Progression isn’t always this clear-cut though, and sometimes stalling will occur on some lifts. On these occasions athletes do what’s called a deload. Following sequential periods of either stalling on the same weight or not making the required sets and repetitions, the weight for the exercise is lowered, for instance to 80% of the working weight, and training carries on as usual.

Looking at their chart again we can see that the advanced stage might be reached in 2.5 - 4 years during an athlete’s career. So, we should aim for a similar time frame when getting an athlete from Level 1 to 100. How do we get there?

Starting Strength is one of the most popular weight-training programs for beginners. It is supported by a book that teaches the movement patterns and the program, written by one of the same authors of Practical Programming, Mark Rippetoe. In this program, novice athletes practice compound exercise movements 3 times a week alternating between one of two days and usually resting every other day plus sunday. The program has three phases. Phase 2 which should be the one an athlete will spend more time doing looks like this:

Day A
Day B
3 x 5 Squat
3 x 5 Squat
3 x 5 Bench Press
3 x 5 Press
3 x 5 Deadlift
5 x 3 Powerclean

The first day of training will be used to test out at what weight you can do each exercise. After that the weight will usually be increased by 5 lbs per workout, exceptions being the squat and deadlift that, depending on the athlete’s ability, will be able to increase in the range of 10 - 15 lbs in the first few sessions.

After those novice gains are exhausted, it’s time to select a new training program. Texas Method is a common choice, building upon Starting Strength but introducing variation throughout the week with a high volume day, a light workout day and a high intensity workout on the last day. Personal bests will only occur on the high intensity day instead of on every workout, with an high volume day at 90% of 5RM and recovery day with the weights at 80% of those used in the high volume day.

High volume
Recovery day
High intensity
5 x 5 Squat
5 x 2-3 Squat
1 x 5 Squat
5 x 5 Bench Press / Press
5 x 3 Press / Bench Press
1 x 5 Bench Press / Press
5 x 3 Power Clean
3 x 3 Power Snatch
1 x 5 Deadlift

Let’s then picture a scenario in which we have a lifter of average weight using SS first and then TM and see where they end up in terms of workloads:

Average weight in Europe is about 155 lbs which according to strength standards compiled by Lon. Kilgore should give us the following initial weights:

  • Squat: 100lbs;
  • Bench Press: 110lbs;
  • Press: 70lbs;
  • Deadlift: 125lbs;
  • Power clean: 75lbs;

For each workout day we’ll calculate the training volume (sets × reps × weight) for every activity and sum it all together to get the total training volume of the day.

I’ve then simulated 8 months of novice training plus 14 months of intermediate workouts. I threw in some deloads every once in a while too. Playing a bit with the numbers I’ve found that using the training volume number divided by 5 would get me a nice curve that would reach almost level 90 by the end of the second year:

Weight training level progression scenario

What about cardio?

Well, I’m already calculating calories for all activities using the Metabolic Equivalent of Task method. The MET method takes into account the type of exercise done, the time practising, the weight of the athlete and - in some exercise types like walking or running - the speed that’s used. This should be a good starting point to determine how many experience points we’re awarding the player for each workout activity.

Much like the weightlifting scenario above, I don’t want to level-up the player too quickly or too slowly. A time frame of two years of consistent training to reach level 80-90 sounds adequate to me.

Let’s picture a scenario of a complete beginner training to eventually run marathons and cycle a few popular plans throughout a 2 year period. We’ll give that beginner the same average european weight of 155lbs and an average running speed of 6mph and a walking speed of half that, 3mph.

I’ve decided to start with the guides from Marathon Handbook they include 4 different plans going from couch to 5k, 5k to 10k, 10k to half-marathon and finally 10k to marathon. These will cover the first 7 months, with a few week breaks here and there. After that we’ll move on to a couple of Higdon plans, namely Novice 2 Marathon and Intermediate 2 Marathon cycling them a couple of times until we reach the 2 year mark.

Using the calories as the experience points directly wouldn’t lead to an appropriate progression: After all that training the player would be only on level 43. So I’ve decided to multiply the calories by 2.5, making the player reach a more smooth level 80 for the same time period.

Cardio training level progression scenario

Rank and compete: Leaderboards

So now that we have a way to score players and categories to put them in, how do we foster competition so we can drive users to keep progressing and improving?

One technique we could use is leaderboards. A leaderboard is a game element where we present a list of users ranked by their score. They can be very effective at motivating a user to keep at it and try to rise to the top but, if badly designed, can also do the opposite.

Picture for instance a player that has just signed-up for a game with millions of users. If you present them with a list of the all-time best scores of every one who has played since the beginning - with that novice user right at the bottom - it can be dispiriting and off-putting. Confronted with such a big hill to climb a player might naturally think they could never reach the top and it doesn’t even make sense to give it a try: They might quit before they even started.

What we needed to do instead is instill the player with something that game-designer Jane McGonigal calls Urgent Optimism:

Urgent optimism is the desire to act immediately to tackle an obstacle, combined with the belief that we have a reasonable hope of success.

Jane McGonigal

How can we do that when scoring a player in a leaderboard?

We can start by making the hill smaller: Instead of showing an all-time best scores list of all the players, we can focus on the last weekly, monthly and yearly ranks. That way - every new week, every new month - a player knows he can rise to the top if he works hard.

Put the player in the center of the action: Instead of starting a leaderboard from first place put the focus on the player and show a list where he appears in the middle of the table surrounded by those with a score most close to his. That way a player can quickly sense what he needs to do to rise up in the charts and how close the competition is tailing him.

UI Changes

So now that we know how we want the leaderboard to look like, where does it fit in with the rest of the UI?

I was initially targetting sukuwatto for a viewport with a maximum width of 960px. That meant there was a lot of free space that could be used on screens with wider widths. I decided to target a maximum width of 1280px instead and create a dashboard of sorts where I could have some info about the player and a leaderboard:

Homepage with a leaderboard component

Since I now had all this additional space, I ended up moving some of the charts I was displaying on the user profile route into this space as well, showing them in a contextually-appropriate way. So now when the user navigates to the /workout routes I’m showing charts related to that (distance ran, weight moved). The same thing happens when he goes to the /measurement routes, where I now show charts for body composition or weight over time.

The user dashboard shows different information depending on context

Conclusion

Keeping motivation up when working out is not easy. Turning activities into games and sharing them with other people are my proposals to try to improve it. Wanna see if it works for you? Click here to play.