Latest Posts

Topic: Rating system

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2993
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-08-10, 09:17

kaputtnik wrote:

Fair point. So there should be a list of maps that are "officially balanced". But how is it possible to make the list easy to fill with new maps? How should we decide which map is equal enough?

I don't think that there will be an easy way. First the author will need to design it that way, then it will need extensive playtesting.


Busy indexing nil values

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1082
Ranking
One Elder of Players
Location: Poland
Posted at: 2019-08-20, 11:29

As I understand https://www.widelands.org/forum/topic/4599/?page=4#post-29394 is considering some rules around rating games. My replay below:

WorldSavior wrote:

So you played autocrat on Ice Wars and the-x didn't conquer an island in order to get undefeatable? That's also interesting face-wink.png

right: how should we treat such cases?

As a draw

In general case: a draw. In some cases: as a defeated player.

If you take into account "The colonies" map, it was designed to be split into two pieces. Small, initial island in the middle and the twisted continent around it. If you conquer initial island it doesn't mean that you win the game, since the continent is much bigger and contains more resources.

but there must be a clear rule on it before the situation actually happens.

So the best solution for such situations is to agree (between players) before the game how it should be considered after conquering some part of the land. We can make a place where general rules for each map are stored (f.e. conquering main land on Ice Wars should be considered as a win, while conquering the initial island on The colonies as a draw or lose of the second player). And the rules would not be a strict ones, but they allows to simplify fights.

why not simply playing territorial lord on Ice wars instead of autocrat?

Because 4 hours of gameplay is not enough for some types of players. You're skilled and you manage to created constant flow of lvl 10 soldiers after 1 hour or so, but some players wants to play the game for a longer time, like 6 or 8 hours, because they can't produce highly trained soldiers so fast. They can even have problems after 4 or 6 hours.

By the way, another important rule would be that only headquarters are the allowed starting conditions (or should we also allow others?)

Why? I don't get the point here.

For official games - yes, I can agree. But for general ones, why not?


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 194
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2019-08-31, 14:52

Ok, glicko implementation is going fine... except... For one part...

Has anybody any idea on how to go and implement that in python ?

It's far from major though, so I could theoretically do without it IMO. But I'm not in known territory here face-tongue.png


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1082
Ranking
One Elder of Players
Location: Poland
Posted at: 2019-08-31, 20:04

I assume that you are taking the original paper http://www.glicko.net/glicko/glicko2.pdf, right?

Let's see what is defined above:

  • tau - constant, proposed to be 0.2
  • epsilon - constant, proposed to be 0.000001
  • Delta - quantity, defined in Step 4
  • phi - rating deviation, defined in Step 2
  • nu - quantity, defined in Step 3
  • sigma squared - variance, direct calculation on volatility
  • x - this is a variable

Point here: all values except tau are variables, dependent on input data, but x is the most significant for math here.

I am not sure if you are calculating it inside a class or you're doing it in procedure. Both uses are almost the same in code, different in running. Here I will provide a sample code for procedure:

from math import log, exp

def function_f(x, Delta, phi, nu, sigma):
    global tau

    numerator1 = Delta**2 - phi**2 - nu - exp(x)
    numerator1 *= exp(x)
    denominator1 = phi**2 + nu + exp(x)
    denominator1 = denominator1 ** 2
    denominator1 *= 2

    a = 2*log(sigma)
    numerator2 = x - a
    denominator2 = tau**2

    result = numerator1 / denominator1
    result -= numerator2 / denominator2
    return result

def step5(Delta, phi, nu, sigma):
    global tau, epsilon

    a = 2*log(sigma)
    A = a

    if Delta**2 > phi**2 + nu:
        B = log(Delta**2 - phi**2 - nu

    else:
        k = 1
        while function_f(a - k*tau, Delta, phi, nu, sigma):
            k += 1
        B = a - k*tau

    f_A = function_f(A, Delta, phi, nu, sigma)
    f_B = function_f(B, Delta, phi, nu, sigma)

    while abs(B-A) > epsilon:

        proportion = f_A / (f_B - f_A)
        C = A + (A - B) * proportion
        f_C = function_f(C, Delta, phi, nu, sigma)

        if f_C*f_B < 0:
            A = B
            f_A = f_B
        else:
            f_A /= 2

        B = C
        f_B = f_C

    sigma_prim = exp(A / 2)
    return sigma_prim

I expect that you know all of this, but I will point for those who didn't notice:

  • for class method you don't have to pass variables, just type before all occurrences self. and add self as one of input of the methods
  • I have split some of the equations for smaller parts for easier typing and clear view (and possible debugging)
  • if you are using procedural way, you can pass all of those variables (Delta, nu, phi, ...) in a dictionary - that will make passing variables much easier

einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 194
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2019-08-31, 23:23

Hahahaha, I was expecting some pointers, not the whole code itself but thanks a lot it sure answered a lot of question. ^^

Rest of glicko is implemented fine now face-smile.png So I'll integrate this part too!!

Also, I used utf-8 greek caracter for variables is that a bad thing? You don't seem to have the same practice face-tongue.png

edit: I used tau as 1.0 because I think we'll have much change in skills over time

Edited: 2019-08-31, 23:24

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1082
Ranking
One Elder of Players
Location: Poland
Posted at: 2019-09-01, 01:53

trimard wrote:

Hahahaha, I was expecting some pointers, not the whole code itself but thanks a lot it sure answered a lot of question. ^^

You haven't provided your code (or I haven't noticed anything), so no direct copy-paste here face-wink.png .

Also, I used utf-8 greek caracter for variables is that a bad thing? You don't seem to have the same practice face-tongue.png

I have learned that it is a bad practice in general, but as far as I know Python is handling it. I am not sure how well, but it is. Remember to add a comment at the beginning of the file that you are using UTF-8 encoding. Anyway, changing all occurrences at once should not be too hard face-wink.png .


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 194
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2019-09-01, 02:47

You haven't provided your code (or I haven't noticed anything), so no direct copy-paste here face-wink.png .

You mean I shouldn't copy paste your code?

Because I kind of did that, and tested, and the thing took so much energy I was under the impression I was mining bitcoins face-wink.png . I'll test more precisely tomorrow though.

I would commit my code, but I must admit. I'm a little ashamed. I used no good practice. Even for me it's a real struggle. But ok, I'll commit tomorrow!

I have learned that it is a bad practice in general, but as far as I know Python is handling it.

If it's bad practice I will change it then yes.

I'm so hyped, glicko is already running fine. I got the same results as the test in the paper. (Even without step 5)


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1082
Ranking
One Elder of Players
Location: Poland
Posted at: 2019-09-01, 14:28

trimard wrote:

You haven't provided your code (or I haven't noticed anything), so no direct copy-paste here face-wink.png .

You mean I shouldn't copy paste your code?

No, I misunderstood your statement that you can't use directly the code and need integration to your code.

I'm so hyped, glicko is already running fine. I got the same results as the test in the paper. (Even without step 5) I could see that you've provided both rankings on the same page. Is it possible to make a tabs for different rankings? Or any new page for any ranking? f.e.:

  • rating/score/glicko2-official/
  • rating/score/ratio/
  • ...

or with GET parameter:

  • rating/score/?type=glicko2
  • rating/score/?type=ratio

and official as default one


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1082
Ranking
One Elder of Players
Location: Poland
Posted at: 2019-09-01, 14:28

trimard wrote:

You haven't provided your code (or I haven't noticed anything), so no direct copy-paste here face-wink.png .

You mean I shouldn't copy paste your code?

No, I misunderstood your statement that you can't use directly the code and need integration to your code.

I'm so hyped, glicko is already running fine. I got the same results as the test in the paper. (Even without step 5) I could see that you've provided both rankings on the same page. Is it possible to make a tabs for different rankings? Or any new page for any ranking? f.e.:

  • rating/score/glicko2-official/
  • rating/score/ratio/
  • ...

or with GET parameter:

  • rating/score/?type=glicko2
  • rating/score/?type=ratio

and official as default one


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 194
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2019-09-01, 15:21

I could see that you've provided both rankings on the same page. Is it possible to make a tabs for different rankings? Or any new page for any ranking? f.e.:

Mhhh, I'm not sure, I was thinking we could have tabs used for other "seasons" (Which would at least indicate different builds)

so maybe different pages, so we can keep the tabs if needed face-tongue.png

I pushed my branch btw. Still a lot of WIP and reformating to do, so please don't take too much attention to the general structure of things.

https://code.launchpad.net/~widelands-dev/widelands-website/rating_system


Top Quote