In the game being developed, players will be playing best-of-three matches against one another. XP will be given out depending on their score vs the average score and will receive a bonus for whether or not they win or lose.
Given the nature of our game, players will be able to leave a match in between any of the 3 rounds, able to return to them at a later point in time. In order to decentivize players from starting and immediately leaving games/not continuing if they sense they might just lose, I've designed an equation around the idea that alters/gives bonus xp based on if/how many rounds they have played.
In said equation, I reference variables monitored by our database for recording reasons, specifically 'round,' which notes what round the player is currently on, and 'win,' which refers to whether or not the player won.
The issue I'm having is it's been a good long time since I took any Maths classes and have forgotten a good chunk of notation + terminology, and am struggling to put my thoughts down into words, either to explain to programming or search to help myself.
Eqn:
$\text{XP}= \lfloor \frac{p}{a}* R\rfloor + E$
In this equation:
- p = player's highest score from the 3 rounds
- a = Game's Average Score / 10
- R = Rounds played bonus (Bonus based on number of rounds they played)
- E = End status bonus (Bonus based on whether they won or lost)
My probelm here is the fact that R depends on the round # recorded in the database and similarly E depends on whether or not they won as recorded in database, and in both cases I'm not sure how to notate it.
If in database:
- round = 1, R = 1
- round = 2, R = 1.15
- round = 3, R = 1.35
- win = 1, E = 15
- win = 0, E = 5
- win = 2, E = 0
- win = 3, E = 0
In relation to my equation, how can I best notate everything?
Edit: Pic of me attempting to explain said equation to programming in poor handwriting
Fairly certain I'm not notating that 100% correctly, given programmer literally said "could you put this part in an equation?" while pointing at my if thens.
Since you gave an equation, I'm guessing you are trying to come up with some mathematical expression that will capture the dependence of $R$ on the number of rounds and $E$ on the win? $E$ is easy, and since $R$ has only 3 values, it wouldn't be hard to come with an expression for $R$ either - though since your values do not grow arithmetically, it would be a bit more complicated.
However, programmatically, this is a bad idea. The program will be easier to understand, and easier to modify if you DON'T try to convert this into one big equation. Your programmer is asking for an equation not because they think an equation is the way to go, but because they couldn't follow your mass of if statements, and hoped that by an equation, they could make some sense of it.
What you want is method like this:
Your programmer should be able to follow that, and convert it into whatever language they are using.