5
\$\begingroup\$

Introduction

I'm creating a game where the player can obtain 1 to 3 stars for each level based on the score it gets (based on the completion time). The levels are grouped in "worlds" each of which is unlocked when the user obtains a given number of stars in the previous levels.

For example, world 1 has 5 levels and to unlock world 2 the user needs to gain at least 5 stars (thus at leas one star per level in average).

Here is a basic idea of the words -> n° of levels in that world -> stars to unlock

1 -> 5 -> 0 (of course)
2 -> 5 -> 5 / 15 (33%)
3 -> 5 -> 10 / 30 (33%)
4 -> 7 -> 25 / 45 (55%)
5 -> 7 -> 30 / 66 (45%)
...

To determine the score you should reach, for each level, to get 0 / 1 / 2 / 3 stars, I recorded some play stats from a bunch of beta-testers obtaining a normal distribution of play times for each level. Given each distribution, I should be able to answer this question for each level:

at what score should I reward n stars in order for x% of the player to get n stars overall?


Justification

The "high score progress" mechanic is meant to be one of three different possible ways of progression, the other two being: exploration and "character building". New worlds can be unlocked by paying a given amount of coins which are found hidden in levels. A player either rushes to the end of the level obtaining high scores or takes its time and scouts out every coin in each level, obtaining enough coins to pay the next world. As for the "character building", a player may choose to fight every enemy in the levels (which are more likely placed on the main path) and being very good at timing battle controls, gain experience and level up its character. With level up you can speed up your character (getting higher scores) or improve coins (getting more coins without too much exploration), this way the "character building" mechanic places between the other two. Reducing the percentage of users that reach final worlds by score is a way to forcefully funnel players to their "most suited" mechanic.


Tuning

So now I can change the thresholds for each star at each level (or group of levels) in order to filter the percentage of players that will obtain a given number of stars at some point. This way I can set the game difficulty as the difficulty to unlock a given world which is the percentage of people who are good enough to gain enough stars to unlock that world.

For example for early world progress difficulty, I chose a base of 1.22 as exponential base of the percentage reduction (difficulty growth), like this:

world -> difficulty coeff. -> perc. players

1 -> 0 -> 100% 
2 -> 1.22 -> 98.78%
3 -> 1.4884 -> 98.5116%
4 -> 1.815848 -> 98.184152%
5 -> 2.21533456 -> 97.78466544%
...

This way, for example, the last world should be reached by about 47% of the players.

Now I want to know how to tune percentages of people gaining 1 / 2 / 3 stars in order to stick to this given percentage progression. In order to do this, I found the minimal configurations of possible stars obtained in each world level in order to unlock the next one, for example:

world -> n° 1 stars -> n° 2 stars -> n° 3 stars -> stars to unlock next world
1 -> 5 -> 0 -> 0 -> 5
2 -> 10 -> 0 -> 0 -> 10
3 -> 5 -> 10 -> 0 -> 25
4 -> 12 -> 10 -> 0 -> 30
5 -> 18 -> 11 -> 0 -> 40
...

Note that if the user got 10 x 2 stars in the previous world, then it still has those 10 x 2 stars in later worlds, unless it tops them wit 3 stars.


My Calculations

Now, for example, if I want 98.78% of the players to be able to unlock the second world, given they have to obtain minimum 1 star at each previous level, then p^5 = 0.9878 and p = rad(5, 0.9878) ≈ 0.9975, so 99.75% of the players should be able to get at leas 1 star in each level of the first world.

For the third world, things get a little harder, as the 1 star probabilities for the first 5 levels are locked now. Players must be able to obtain at least 1 star in each of the 10 levels of the first two worlds with an overall probability of 98.5116%, but the probability to obtain 1 star in the first 5 levels is locked at 99.75%, with an overall probability of obtaining 1 star in each of the first 5 levels of 98.78%. So I had to solve this equation: p * 0.9878 = 0.985116 so p = 0.985116 / 0.9878 = 0.9973 which is the probability p to get at leas 1 star in all the 5 levels of the second world. So the probability to obtain 1 star for each single level of the second world is p = rad(5, 0.9973) = 0.9995 which is slightly higher than the previous world.

Fourth world gets even weirder, as the restrictions shifts on the 10 x 2 stars that players need to obtain in the 15 previous levels. To do this, I used binomial distribution to find the probability to extract at least 10 successes over 15 attempts which gave a probability of 58.79% to obtain 2 stars in each of the 15 levels of the first 3 worlds in order to have a 98.184% probability to finish the third world with at leas 10 x 2 stars.

Fifth world differs from fourth only by 7 x 1 star so I just calculated p * 0.98184 = 0.97784 where p is the probability to obtain 1 star in each of the 7 levels of the fifth world, obtaining a probability to obtain 1 star for each single level of the fifth world of 99.50%.


Problems

Now I'm stuck at world 6 where the user is required to obtain at least 11 x 2 stars. How do I calculate this probability? I can use the binomial distribution, but the probabilities of the events are not the same everywhere as the probability to obtain 2 stars in the first 5 words is locked.

Is there any formula to help me with this? Is there any simpler / more direct approach I can fallow? Does any of this make any sense at all?

\$\endgroup\$
  • 1
    \$\begingroup\$ Typically I'd expect this kind of gating mechanism to be used to encourage players to get better at the game, so as to provide an interesting difficulty curve for as wide an audience as possible. The intention is, again typically, trying to get as close to 100% of players reaching the end as possibly. Is your intention to actually set the game up so a % of your players will never reach all the content? It just seems like your calculation is either not taking into account player improvement, or the point at which a player stops playing because of difficulty, or both. \$\endgroup\$ – Chris Aug 10 '17 at 15:50
  • \$\begingroup\$ In my mind there's two different paths I could take from here and justify the small percentage of players in the final world: either I keep the thresholds fixed, and so I expect the users to "learn to play" thus shifting away from the fixed beta-tested times and eventually reach the end, or I keep the threshold dynamic (re-calculating them as new users join and replay levels) and add some currency to unlock worlds even if you don't have enough starts to play it, thus the low percentage is "how many users will reach the end without using the currency?". \$\endgroup\$ – Onheiron Aug 10 '17 at 15:57
  • 2
    \$\begingroup\$ While your approach is valid and makes for a fascinating math problem, I'd echo Chris that this might not be the optimal way to shape the player experience. In a typical level progression, the difficulty of the later levels comes from those levels' content offering the player escalating challenges, rather than from requiring more and more thorough re-play of the earlier levels (read: grind) just to access them. Completionist players will tend to challenge themselves to boost their stars on every level anyway - forcing players to do so just to progress can breed more frustration than motivation \$\endgroup\$ – DMGregory Aug 10 '17 at 16:35
  • 1
    \$\begingroup\$ Keeping the math aside I think there is a better solution for your problem:Set the number of required stars to advance to the next world from just the current, then, add a "bonus" extra challenging level in each world that the player will gain aces with the total number of stars.After that the balancing of the stars per level should be much more straight forward. Although this system rewards "good" players instead of generate frustration in more "casual?" profiles. This of course, if that suits your concept of the game. \$\endgroup\$ – Westside Tony Aug 11 '17 at 9:39
  • 1
    \$\begingroup\$ @Onheiron I think this may be an XY Problem (meta.stackexchange.com/questions/66377/what-is-the-xy-problem). This is certainly an interesting statistics & probability question, and perhaps math.stackexchange.com might have people more able to answer. However, from the comments, I'd say knowing more about the game design problem would help in creating an answer. My gut tells me that the probabilities that you're measuring, aren't necessarily directly applicable to the design problem. Don't fear having a long question, even starting by editing in the strategies info would help. \$\endgroup\$ – Chris Aug 18 '17 at 1:32
0
\$\begingroup\$

After some reading and tinkering I decided to fallow a more straight forward approach and use simulation to obtain some empirical data.

To do so, I wrote a code snippet "simulating" one billion games like this:

  1. A new game starts
  2. Player has 0 feathers
  3. Player starts at world 1 with 5 levels
  4. Every level in each world has the same 3 probabilities for players to get 1 - 2 - 3 stars (in percentage).
  5. For each level in the current world the player extracts a random number between 0 and 100
  6. I compare the extracted number with the 3 probabilities to see how many stars the player got in that level
  7. Gained stars are added to the player's stack
  8. When player reaches the end of the world it can progress only if it has enough stars
  9. Each world has a counter of how many players were able to unlock it.

This might seem too simplistic, but it actually works. As we know, with a (good) random number generator any number has the same probability to be extracted, whilst actual real life level completion times tend to assume a Gaussian distribution with a peak around the average. But here's the quirk: what I am considering is not the completion time itself, but the percentage of players completing the level within that time at most. So finding out z-scores for my required percentages allows me to identify the time thresholds for each single level, no matter how the actual play times are distributed. This way I can use a random number extraction simulation to simulate something more complex and find the correct thresholds for each level in order to ensure the desired percentage of player would be able to progress.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.