Topic: Rating system
trimard![]() Topic Opener |
Posted at: 2019-07-27, 16:07
Ok I'm having some trouble storing decimal value it seems in django. Anyone has experience in that? Also, I've been rethinking about what Worlsavior said. Maybe we could already start a tread to call for games? People that post the result of their match in the post will have a ranking! And it would give us lots of data to play with ![]() ![]() |
einstein13![]() |
Posted at: 2019-07-27, 19:36
I don't have experience either. But as I remember: some database types don't support decimals, but all of them supports float. And float for our calculations should be enough to store all data. Python can easily show the values by But where you want to use decimals instead of floats?
That is a good idea! Database models for ranking games and ladderRecently I was thinking how to solve the models for games and players. The problem was split into two parts:
For Game models we need lots of data, but the data can be also split into two parts: specific game data & players (and teams) data. Plus we want to support not only 2-players games, but every possible Widelands game too. That makes the system more complicated. For that we need at least two models: game model and participant model. Game model will contain data like map, win conditions, timestamps, and so on. Participant model will create many-to-many relation between game model and registered user model, plus it should contain data like which team the player was playing with, how many interruptions were on that player side (future use?) and so on. And for coding stuff, arbiter can have access to django admin page, where on a game model form can be several inlines of participants and it will be quite easy to add any records or edit them. For rank models I was thinking about one that will contain join to the registered user, rank values (two integers and two floats for beginning), update time (when rank record was created) and if it is an active one. Why the last "active"? Because if we create that, we can easily store data about previous rank values and then we can see whole history of the player. And why I am thinking about integer values for ranking? Because then we can easily support simpliest win/lose rank too. I understand that you may have another view on the problem, so I am open for your point of view einstein13 ![]() ![]() |
trimard![]() Topic Opener |
Posted at: 2019-07-28, 00:25
Django says it can, but actually you're right I should use float or int. Maybe int then? But then what do you do? You have a function for changing the value back to the original? Maybe float is easier
huhhhh, I have no idea what I'm doing on this. Never made a lot of "low-level" stuff before tbh. Neither a lot of math, at best some geometry stuff. It seems float will fit perfectly for that job, I'll use that About the tread:
Ok, I'll do that tomorrow then
Perfectly on topic on my current problems!
Exactly. Here's what I have for now for my first test. A lot of stuff are missing but I'm looking for functionality first
So if I understand correctly: Specific game :
participant
registred user
Which data do you want to put in registered user?
Why didn't I think about that? The first thing I did was a page for the arbiter to enter data...
Huh, yes didn't realized I was gonna need another table for the score. Yes I guess we can't recalculate everything everytime someone looks at the scores. Even more so as the score won't be updated every minute.
rank number. rating score. Standard deviation. Volatility???
Why not say that it's inactive after a certain standard deviation? Mhhh although yeah, we might need to store the user's history. Is that what you wanted to put inside regitred user?
I'm not sure I understand that part
No no, all good ideas! Just not sure I understand exactly on all of them ![]() ![]() |
GunChleoc![]() |
Posted at: 2019-07-28, 08:59
Definitely - players should always decide whether a match is ranked or not before they start playing. Busy indexing nil values ![]() ![]() |
kaputtnik![]() |
Posted at: 2019-07-28, 09:52
I think using a models.DecimalField is good. One doesn't has to fiddle with roundings of values then, imho. See also python Decimal ![]() ![]() |
trimard![]() Topic Opener |
Posted at: 2019-07-28, 13:48
Yes, that's what I tried but I'm having trouble making it work. I always get the same bug: "[<class 'decimal.InvalidOperation'>]" When trying to store any number with the django model I showed in the upper messages. Even if I put Decimal(1500) or Decimal (0.1) or anything. Same bug. And I cannot find much documentation for that bug. Only the "max_digits should be higher than decimal_places" Django's error message isn't really helpful...
Ha, that's a good point in keeping this format then, yes. I'm not so used to math in code, so any simplification is beneficial. Well that is, if I can fix this bug ![]() ![]() |
WorldSavior![]() |
Posted at: 2019-07-28, 17:01
Also on very imbalanced maps?
Kind of, but permanently. For example on Ice Wars, blue position. Wanted to save the world, then I got widetracked ![]() ![]() |
kaputtnik![]() |
Posted at: 2019-07-28, 18:52
max_digits is the overall amount of digits, that's the digits in the left of the decimal separator plus the digits on the right of the decimal separator.
= overall digits of 5, three on the left and two on the right of the separator. Trying to apply a value of 1500 does not work, because the left part (integers) can only have 3 digits. '0.1' should work though, maybe it should be '0,1' (note the comma instead of the point). Don't really know, but it may depends on your settings of locales. If you're on linux try this command:
The output from my machine:
![]() ![]() |
trimard![]() Topic Opener |
Posted at: 2019-07-28, 20:09
THANKSSSSS, that was it. Don't know how I didn't see that! ![]() ![]() |
einstein13![]() |
Posted at: 2019-07-28, 22:06
I am sorry for technical language (for those who doesn't like it)
And when you want to register new game, let's say between me and you (and you win), you will get: Game records: 1
Participants records: 2
Rating records: 4
Values are only for example purpose, the are not very strict Is my idea clearer now? I am not sure if you like it or not, but since Widelands is a doocracy and since you are developing the tools, you make a choice
Nicely done!
The simpliest idea for rank I know is to find proportion of win/all games. And since "rating" is providing decimals, the (almost) most precise equation for rank value would be:
And to be honest, my idea is covering more than one ranking at once, plus more than only one type of games (1 vs. 1) for them. But if you stick to your approach, that also will be very good! einstein13 ![]() ![]() |