PotatoScore

In the week since my last post, we have been working furiously on finishing up our game. One of the things I have been working on is how our game handles the score that the player obtains while playing.

Since we use the score in two different states in the game, the gameplay-state and the victoryscreen-state, I implemented our score class as a member of our main game-state, thus making it exist and be accessible as long as the game is running.

The score class is used as a pointer in the gameplay-state, where it gets updated with information about how many enemies have been killed and evaded, how many pick-ups have been picked-up, how much life the player has and how many potatoes the player has left.

The kills/evasions and the pick-ups are then recalculated and summed in real-time and printed in the gamplay-state as the player’s score.

Upon completing a mission, the parameters of the score: the number of kills and evasions, the number of pick-ups obtained, the amount of life left, and the amount of potatoes left are printed out on the victory screen. The total score, which is calculated from the above mentioned parameters, is also printed to the screen.

The victory screen then checks whether the score obtained is among the top ten of the High Score, but that is a different class so I won’t go into how that works right now.

Seeing as the score class lives as long as the game is running, the score needs to be reset at some point (otherwise it would just keep increasing for every kill / evasion etc. made during that game-session). This is done by a function in the score class, called resetScore(), it nulls all the parameters of the total score, and is called every time a mission is started.

Score FlowChart
Illustration on how the interactions and functionality of the Score class.

The score itself is calculated by a very simple formula:

  • Kills are worth 1499 points each.
  • Evasions are worth 997 points each.
  • Pick-ups are worth 1048 points each.
  • Life is worth 1980 points per hp.

Ammo is a multiplier to the sum of the score from kills/ evasions/ pick-ups and life.
The calculation for this multiplier is: (1 – (ammo left when the mission is finished) / 100).

The resoning behind the higher value of the score for killing enemies compared to evading them, is that in order to kill something you have to expend ammo, which in turn lowers your multiplier. The reason for the size of the numbers is that bigger numbers feel more fun :p

Initially we had lower, and even, numbers for the score, but when play-testing it the score felt very static, hence the uneven numbers listed above, and reaching a score of one hundred thousand felt more like an accomplishment than a score of ten thousand.

About Erik Nilsson

2015 Programming