# Mathematics of difficulty acceleration in endless runners

I'm currently working on an endless runner and was wondering about the growth of difficulty in the game. Is the acceleration of difficulty highly specific to games or are there standard growth functions that most endless runners adhere to and fine tune above and beyond that?

The difficulty of an endless runner is dependent on a few things, first of all the size of the obstacles and different types of obstacles, typically it's best to just hardcode when different obstacles can appear and use a formula for sizes (especially when you can only use a given dodge ability for a certain amount of time).

A good formula for the size of obstacles is [time you can use ability to dodge][speed](1-([scaling constant])^[time]) or d*v*(1-C^t) remember that the scaling constant (C) must be between 0 and 1. This will create a difficulty scaling that always starts easy but moves to more and more difficult never becoming impossible.

Second scale is speed, moving faster means having less time to react means a more difficult game, here a less complicated formula is needed and this can be done fairly linearly (or a similar formula, maybe a root experiment here).

Third is number of obstacles, note that speed also increases number of obstacles, a good way of determining whatever or not to create an obstacle is to first determine the minimal distance theoretically required between obstacles, this is likely to be the time needed to complete an animation between key release and key press for next dodge ability and then multiplied by speed to get a distance (or just use raw time). You can then generate a random value and if it' s smaller then (1-C^t) you generate a obstacle here (and reset the minimal distance until after the obstacle).

Of course you don't have to scale all 3 things at the same time (doing so makes for a very fast phased game). Each of these methodes will likely feel somewhat smooth (if you get the parameters right, especially C which you might want to start with something like 0.99 just to see how it behaves and maybe plot it on wolfram alpha and look at what values it is at given time points (maybe scale time accordingly)).

From what I've seen it depends on the target audience of your game and your content.

For example Flappy Bird has almost no content, with an insane difficulty level and no difficulty growth. It's meant to appeal to persons who want to have fun trying something difficult as a quick time sink.

However if you're building something like an adventure game with loads of beautiful content the game might start out easy and never get much harder except for the learning of new tricks every once in a while. Most of the enjoyment comes from experiencing the game.

The games in between usually have the biggest difficulty growth curves. You can have split content or achievements, and increase the difficulty level between them. You'd start out real easy to get them hooked on the game play, and increase the difficulty real slowly too to get them hooked on receiving the rewards (new content, achievements). Only towards your last good rewards will you increase the difficulty more steeply, to really make it a challenge to get those last rewards. After that it's just high scores, so you could increase the difficulty linearly, or superlinearly if you hate your players ;)

Note that the only difference here between an adventure side scroller and an infinirunner is that there's no stop between level transitions, and they can forever keep on playing after the last level.

The only way to make the game predictably good is by having it play tested, often and always by new persons that are in your target audience. They'll let you know if they feel your game is too easy or too hard, and if it gets boring at all. Ask questions like if they ever give up because it's too hard whether they're going to pick it up later and try again.