Often getting the same map in ladder

This is for troubleshooting of problems with the FAF client and Forged Alliance game.

Moderator: PhilipJFry

Often getting the same map in ladder

Postby Vee » 25 Mar 2015, 13:41

It is a well known problem that you get the same maps over an over again in ladder, while you never or almost never get some maps that you have selected. Which map you get all the time depends on you and your opponent. Some people get badlands all the time, some emerald crater, some winter duel. Maybe people are just imagining that and it's truly just randomness...but it's still worth to investigate. I've looked at the code here https://github.com/FAForever/server/blo ... er.py#L130 This code seems OK. Perhaps the problem is that the table ladder_map_selection contains duplicate entries, so that you have a higher chance to get those maps that have duplicate entries. Or perhaps it is the algorithm after all. How about changing it to this:

Code: Select all
def choose_ladder_map_pool(self, player1, player2):
   lucky_player = [player1,player2][random.randint(0,1)]
   maps = self.getSelectedLadderMaps(lucky_player.id)
   missing_maps = 15 - len(maps)
   if missing_maps > 0:
      maps += self.getPopularLadderMaps(missing_maps)[:missing_maps]
   return maps


Explanation: we randomly pick one of the two players's map pools. If that map pool has less than 15 maps, we extend it to 15 with popular maps. Then we pick a random map from that list. This code is simpler and will result in a more diverse set of maps being played because all maps that a player has selected have some chance to be picked, rather than just the intersection. Also the 33% popular maps chance has been removed. Now you will only get your mappool extended with popular maps if you have selected less than 15.
Vee
Evaluator
 
Posts: 677
Joined: 04 Dec 2013, 20:43
Has liked: 275 times
Been liked: 225 times
FAF User Name: Vee

Re: Often getting the same map in ladder

Postby ZLO_RD » 25 Mar 2015, 16:43

how do extend someone's pool? are you sure you extend with random maps in your algorithm? (i am not good at coding i guess)

Edit: i kinda like idea, not sure about removal of common maps thought.
http://www.youtube.com/user/dimatularus
http://www.twitch.tv/zlo_rd
TA4Life: "At the very least we are not slaves to the UI"
User avatar
ZLO_RD
Supreme Commander
 
Posts: 2265
Joined: 27 Oct 2011, 13:57
Location: Russia, Tula
Has liked: 303 times
Been liked: 400 times
FAF User Name: ZLO

Re: Often getting the same map in ladder

Postby Vee » 25 Mar 2015, 16:52

The pool gets extended in the same way as it gets extended now: by adding popular maps. So if you have 9 maps selected then it will add the 6 most popular ladder maps to that. So it is not extended by random maps. That would be easy to change though. See the code here: https://github.com/FAForever/server/blo ... er.py#L109

Common maps still have more chance to be played because they are in the pool of both players so they have double chance to be played, but now you will not only get common maps. We could also give some extra chance to common maps to make it more than double, just not 100% chance. But if the database contains duplicate rows then that should be fixed first of course (that is the only other reason I can think of why some people often get the same map).
Vee
Evaluator
 
Posts: 677
Joined: 04 Dec 2013, 20:43
Has liked: 275 times
Been liked: 225 times
FAF User Name: Vee

Re: Often getting the same map in ladder

Postby Sheeo » 26 Mar 2015, 00:19

Vee wrote:Perhaps the problem is that the table ladder_map_selection contains duplicate entries


This assumption is false: https://github.com/FAForever/server/blob/develop/src/lobbyconnection.py#L1054

While the code is a bit contrived, duplicates are indeed filtered on insertion to the database.


I could analyze the map selections of some players who claim they are unfairly given the same maps, if you'd like.
Support FAF on patreon: https://www.patreon.com/faf?ty=h

Peek at our continued development on github: https://github.com/FAForever
Sheeo
Councillor - Administrative
 
Posts: 1038
Joined: 17 Dec 2013, 18:57
Has liked: 109 times
Been liked: 233 times
FAF User Name: Sheeo

Re: Often getting the same map in ladder

Postby speed2 » 26 Mar 2015, 01:02

What about some code that would not allow to pick same map again. For example if you played one map, you wont get it for another lets say 5 games (maybe more). Cause even I played a bit ladder and got 3x in a row badlands...and that made me quit the last one cause thats just dumb.
How hard would be this change?
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Often getting the same map in ladder

Postby Sheeo » 26 Mar 2015, 02:02

So difficult that the following query would do it

Code: Select all
(SELECT mapid
FROM   game_stats
        INNER JOIN game_player_stats
                ON game_player_stats.gameid = game_stats.id
WHERE  playerid = ?
LIMIT  5)
UNION DISTINCT
(SELECT mapid
FROM   game_stats
        INNER JOIN game_player_stats
                ON game_player_stats.gameid = game_stats.id
WHERE  playerid = ?
LIMIT  5);


Having two select clauses ensures we get the latest 5 maps for each player.

I'm assuming this isn't very controversial, so I'll get this into the network update.
Support FAF on patreon: https://www.patreon.com/faf?ty=h

Peek at our continued development on github: https://github.com/FAForever
Sheeo
Councillor - Administrative
 
Posts: 1038
Joined: 17 Dec 2013, 18:57
Has liked: 109 times
Been liked: 233 times
FAF User Name: Sheeo

Re: Often getting the same map in ladder

Postby Vee » 26 Mar 2015, 11:46

Thanks that is great! That solves the issue that you get maps multiple times in a row. There is still the other issue that you (almost) never gets some maps that you have selected. Or maybe we are just imagining that, humans are not very good at probability by feeling :D
Vee
Evaluator
 
Posts: 677
Joined: 04 Dec 2013, 20:43
Has liked: 275 times
Been liked: 225 times
FAF User Name: Vee

Re: Often getting the same map in ladder

Postby ZLO_RD » 26 Mar 2015, 17:11

Give human random data, and he will find tons of patterns in it

i actually heared story that some one replaced random algorithm to a not random one cause users were compainig that it was not random enought...
http://www.youtube.com/user/dimatularus
http://www.twitch.tv/zlo_rd
TA4Life: "At the very least we are not slaves to the UI"
User avatar
ZLO_RD
Supreme Commander
 
Posts: 2265
Joined: 27 Oct 2011, 13:57
Location: Russia, Tula
Has liked: 303 times
Been liked: 400 times
FAF User Name: ZLO

Re: Often getting the same map in ladder

Postby Gorton » 26 Mar 2015, 17:20

I wouldn't say 5 games, but at least 2-3.
"who is this guy, he didnt play gpg or what?" - RA_ZLO

*FAF Moderator*
Gorton
Councillor - Moderation
 
Posts: 2543
Joined: 16 Apr 2013, 21:57
Location: United Kingdom
Has liked: 1067 times
Been liked: 455 times
FAF User Name: Gorton

Re: Often getting the same map in ladder

Postby Vee » 26 Mar 2015, 22:51

Maybe we are not imagining it after all Image (from TheRedViper)

p < 10^-graham's number
Vee
Evaluator
 
Posts: 677
Joined: 04 Dec 2013, 20:43
Has liked: 275 times
Been liked: 225 times
FAF User Name: Vee

Next

Return to Tech Support

Who is online

Users browsing this forum: No registered users and 1 guest