2
$\begingroup$

I have many routes a player can take in a game I'm making. Each route awards them a specific score (ranging from 4 to 31, but mostly concentrated around 8 and 11) and I need to decide which difficulty challenge to present the player with in order to progress through that route.

The difficulty of challenges I have range from 1 to 9. I want each difficulty to have as close to an equal chance of being chosen assuming the player takes a random route (so if take every score and put them through this formula to get the difficulty and count how many times each difficulty is chosen, all these counts would be as close as possible).

Is there any formulae I could use to find a corresponding difficulty for any route based on that route's score relative to the scores of all the other routes? Of course, the higher score a route awards, the higher difficulty I want the challenge to be.

I have plotted the current distribution of scores (x being the score, y being the occurrences of that score) on a graph to make them easier to visualize, and so I believe I'm looking for an equation that flattens this curve Scatter graph.

$\endgroup$
2
  • $\begingroup$ en.m.wikipedia.org/wiki/Histogram_equalization $\endgroup$
    – user619894
    Nov 29, 2021 at 23:47
  • $\begingroup$ That looks like a good start but I'm struggling to find any more basic maths or code for it since it's mostly used for image processing. But I have now generated a histogram for my data which is probably more suitable for this i.imgur.com/cG25eER.png In making the histogram, I also found the skewness (3.42721) and kurtosis (17.79751) which could be useful if I can get an equation to generate a similar graph and then invert it to hopefully find the equation for the difficulty $\endgroup$
    – hopperelec
    Nov 30, 2021 at 0:28

1 Answer 1

1
$\begingroup$

Turns out I was really over-thinking this problem. The solution was to just produce a sorted list of all the available scores, find the index within this list of the target score and divide this by the number of routes per difficulty.

Mathematically, where $S(x)$ is the score at sorted index $x$, $s$ is the target score, $D(x)$ is a value for the difficulty $x$ and $d$ is the target difficulty, $d=D(\frac{S^{-1}(s)}{\vert D\vert})$

Keep in mind that the same score may appear multiple times in $S$, $S^{-1}(x)$ may have several solutions, so an average of these solutions must be taken. Since $S$ is sorted, the indexes will also be sorted and one apart and there will be no extreme solutions, so both a median and mean will produce the same fair result. Due to both this and the division by $\vert D \vert$, rounding may be required. I arbitrarily chose that, between just a few more lower or higher difficulties, I would prefer more lower difficulties, so I round down for .5

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .