1
\$\begingroup\$

I have created snake game. I can't think of good score system so that is is fair.

There is only one highscore list for all modes.

Player can choose any size of board - Let's call that param "Board area", it is defined in cells. One snake segment takes one cell.

Player can choose any speed of snake - Speed, in cells per second

I don't know how to calculate it so that score is fair for all players.

Firstly I thought of this: score = length * speed But is is not fair for players that reach end of board (nearly no free spaces to go, careful planing is needed to survive).

Then I thought that I need somehow award players that can survive for long in small amount of free place. The new formula looks like that: score = (length/board size) * (length * speed) But I still don't like it.

My score should reward players for: Longest snake, tight turning and planning (bigger multiplier when board is full), and speed at which they are playing.

\$\endgroup\$
2
  • \$\begingroup\$ Are there any "fruits" that give extra extra? \$\endgroup\$ Commented Jun 4, 2013 at 14:21
  • \$\begingroup\$ @psycketom It will be based on how "covered" they are by snake tail of walls. \$\endgroup\$
    – Hooch
    Commented Jun 4, 2013 at 22:17

1 Answer 1

5
\$\begingroup\$

I'd squeeze in another variable - cells travelled - it could act as your "planning" score.

Base

Given the core variables speed, length, cells travelled, the main formula could be:

score = base * (length * speed)

With base being:

base = cells traveled; // basically, this could prove enough

// optionally
base *= board size coefficient; // a coefficient based on board size could apply to base, this is for you to judge, but generally the idea is that the larger the board, the smaller the coefficient.
base *= prohibited cells; // prohibited cells ("walls") also being an applier - the larger the prohibited cells, the larger the coefficient.

Tight turn

I'd give tight turn a constant value. So, once a tight turn happens: score += tight turn * speed. Though, length could act as a modifier again - base += tight turn * (length * speed).
You could also apply a modifier to tight turn based on how tight it was by checking the distance between head and tail after turn.

Fruits

In case you have "fruits" there, lets give them a constant value again fruit, once we eat one: base += fruit * speed.

Extra mechanics

You can also implement extra mechanics. One variable being cells travelled to get the fruit.

The other being, tail kiss - gives extra points once head, being perpendicular to tail, exchanges the last tail block.

\$\endgroup\$
4
  • \$\begingroup\$ I would suggest players also get bonus points based on path planning between fruits. For example, take the manhattan distance from the previous fruit to the current and the number of steps the player took from previous to current. If the steps are within a certain threshold based on snake length, speed, board size, and prohibited cells, they get bonus points. If it is too far, they get fewer until zero. That being said, I don't think players should get points for surviving without eating fruits as that can be exploited. \$\endgroup\$ Commented Jun 4, 2013 at 16:24
  • \$\begingroup\$ I like your idea. I will also remove rewarding from not eating. So time does not matter. Only food eaten and lever of "hardness". \$\endgroup\$
    – Hooch
    Commented Jun 4, 2013 at 22:13
  • \$\begingroup\$ I thought of sth new. If food in moment of eating is in open space it has multiplayer of 1. If it has 2 sides attached to snake or walls it will have multiplayer of 2. It it had all sides cover while being collectd I will give boost of 50x or sth like that. It encourouges carefull planing and calculationg your tail location so that it opens your way out as soon as you eat it. I'll also give 2x bonus for food collected in the shortest possible way. Thank for ideas. \$\endgroup\$
    – Hooch
    Commented Jun 4, 2013 at 22:16
  • \$\begingroup\$ Glad I could help. :) Share the game with us, once it's ready! \$\endgroup\$ Commented Jun 4, 2013 at 22:19

You must log in to answer this question.

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