What algorithm does the game use for points in GP?

What algorithm does the game use for points in GP?

Postby anonymous7002 » 20 Oct 2020, 11:20

In the source code of game, you can find a mapped vector that creates the distribution of points in GPs.
For 20 players, that's 50, 43, 37, 32, 28...
I'm not good at C++, so please explain the algorithm so I can code a generator based on that in Python.
anonymous7002
 
Posts: 3
Joined: 20 Oct 2020, 11:16

Re: What algorithm does the game use for points in GP?

Postby Alayan » 20 Oct 2020, 14:56

{l Code}: {l Select All Code}
  <grand-prix>
  <!-- Establish the distribution of points in GP.

       For a race of N karts ; the N-first point values are taken.
       Then, they are sorted. E.g. ; 0 1 2 1 3 2 becomes 0 1 1 2 2 3.
       Then these numbers are used to establish the DIFFERENCE of points
       between consecutive karts.

       The smaller of the numbers is used to establish the score for the
       last kart and not the difference between 2 karts.

       In the above example, the last kart will have 0 point, the one before
       before 1 (0+1) ; the one before 2 (0+1+1), the one before 4 (0+1+1+2),
       etc. until the 1st which have 9 (0+1+1+2+2+3)

       There shall be at least as much points nodes as max-numbers kart -->
    <points points="0" /> <!-- added with 1 kart, score for the last kart -->
    <points points="1" /> <!-- added with 2 karts -->
    <points points="1" /> <!-- added with 3 karts -->
    <points points="2" /> <!-- added with 4 karts -->
    <points points="2" /> <!-- added with 5 karts -->
    <points points="1" /> <!-- added with 6 karts -->
    <points points="3" /> <!-- added with 7 karts -->
    <points points="1" /> <!-- added with 8 karts -->
    <points points="3" /> <!-- added with 9 karts -->
    <points points="4" /> <!-- added with 10 karts -->
    <points points="1" /> <!-- added with 11 karts -->
    <points points="2" /> <!-- added with 12 karts -->
    <points points="5" /> <!-- added with 13 karts -->
    <points points="1" /> <!-- added with 14 karts -->
    <points points="3" /> <!-- added with 15 karts -->
    <points points="6" /> <!-- added with 16 karts -->
    <points points="4" /> <!-- added with 17 karts -->
    <points points="2" /> <!-- added with 18 karts -->
    <points points="7" /> <!-- added with 19 karts -->
    <points points="1" /> <!-- added with 20 karts -->
    <points points="8" /> <!-- added with 21 karts -->
    <points points="1" /> <!-- added with 22 karts -->
    <points points="2" /> <!-- added with 23 karts -->
    <points points="1" /> <!-- added with 24 karts -->
    <points points="9" /> <!-- added with 25 karts -->
    <points points="4" /> <!-- added with 26 karts -->
    <points points="1" /> <!-- added with 27 karts -->
    <points points="10" /><!-- added with 28 karts -->
    <points points="2" /> <!-- added with 29 karts -->
    <points points="12" /><!-- added with 30 karts -->
  </grand-prix>
Image
Alayan
STK Moderator
 
Posts: 256
Joined: 25 Mar 2012, 22:11

Re: What algorithm does the game use for points in GP?

Postby anonymous7002 » 20 Oct 2020, 16:32

But how were those scores decided?
anonymous7002
 
Posts: 3
Joined: 20 Oct 2020, 11:16

Re: What algorithm does the game use for points in GP?

Postby Alayan » 20 Oct 2020, 18:14

No formula was used, values were hand-tuned to fit a few constraints (last-1 gets 1 point, minimize the points given to the first, smooth (rank N points / rank N+1 points) ratio, very slowly increasing this ratio as the number of kart goes up). Having 50 points for 1st at 20 karts and 100 points at 30 karts was a nice touch but I didn't sacrifice smoothness for it.

I think the result is very good, but I'm not sure what you would want to use your python generator for. What's the use case, when would you want to use something similar to my GP points system to rank 50 or 100 competitors ?
Image
Alayan
STK Moderator
 
Posts: 256
Joined: 25 Mar 2012, 22:11

Re: What algorithm does the game use for points in GP?

Postby anonymous7002 » 20 Oct 2020, 18:32

I have found log(n/x)*k, where n is the number of players, x is the placement, and k is the constant, which can be a static or a dynamic value. Would that work out?
For 20 players, an example would be: 50, 39, 32, 27, 23, 20, 18, 16, 14, 12, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0
I had to hand-tune it, so the gap between points doesn't increase as moving down.
The logarithm base can be changed subject to number of players.
anonymous7002
 
Posts: 3
Joined: 20 Oct 2020, 11:16

Who is online

Users browsing this forum: No registered users and 1 guest

cron