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
nstars in order for
x%of the player to get
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.
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
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
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
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?