Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with No Repetition Code #624

Closed
FtXCommando opened this issue Jul 7, 2020 · 10 comments · Fixed by #631 or #758
Closed

Problems with No Repetition Code #624

FtXCommando opened this issue Jul 7, 2020 · 10 comments · Fixed by #631 or #758
Assignees
Labels

Comments

@FtXCommando
Copy link

FtXCommando commented Jul 7, 2020

It seems that the no repetition code that has people not play one of their last 3 maps is no longer functioning with the introduction of the new pools. I'm noticing people playing the same map repeatedly.

I don't think it has anything to do with people transitioning between pools and the code considering the same map in two different pools to be two different maps as the example below consists of two people facing one another for two games in a row on the same map twice in a row. They should have had the same map pool for both games. They were both also 1400 (rounded) in both games, meaning they were not on the edge of switching between two pools.

I also don't think it has anything to do with the code bugging out due to there being no viable map to pick, as the smallest map pool is 7 which means in the worst case scenario, there is still 1 viable map for the code to pick with the 3 map restriction.

repeat

@Askaholic
Copy link
Collaborator

Thanks FTX!

I think this definitely has something to do with it:

result.extend([

those lines should be inside the for loop otherwise only the game data for the last player in the list will be queried. We will have to write some more unit tests to cover this condition.

@0x647262
Copy link
Contributor

@Askaholic I'd be happy to take a look into this

Askaholic pushed a commit that referenced this issue Jul 22, 2020
* Fixes #624

* Remove unused function arguments
@Askaholic
Copy link
Collaborator

According to @FtXCommando this is still an issue on the most recent server version.

repetition

@0x647262
Copy link
Contributor

0x647262 commented Nov 11, 2020

@Askaholic mind reassigning this to me?

Looks like https://github.com/FAForever/server/blob/develop/server/matchmaker/map_pool.py#L25 is the culprit.

@Askaholic
Copy link
Collaborator

Sure! I have no leads for you this time though; no idea why it's not working.

@Askaholic
Copy link
Collaborator

Really, you think it's choose_map? I thought I had written some good tests for that :P

@0x647262
Copy link
Contributor

Just a hunch for now... ladder_service.pyis still a suspect as well, as we could still just be feeding choose_map bad data.

@Askaholic Askaholic added the bug label Nov 11, 2020
@Askaholic
Copy link
Collaborator

That would have been my guess. I also though that maybe the map pool was just too small, but I don't think so. It seems that the smallest map pool has 7 maps which is enough for both players to throw out 3 maps and still have 1 that neither has played recently.

@0x647262
Copy link
Contributor

After a bit of testing I'm 100% certain we're feeding the choose_map function garbage data. The pool (or ladder anti-repetition limit) has to be just small (or large, in the case of the ladder anti-repetition limit) enough to allow choose_map to offer up a repeat map.

@Askaholic
Copy link
Collaborator

I think I found the issue. The problem is actually that the map pools themselves are being fetched incorrectly. In particular they are fetching map id's instead of map version id's. See here:

map_version.c.map_id,

This should be map_version.c.id since map_version.c.map_id is just the foreign key reference to map.id.

So what happens is that the map paths are still correct for a particular map version, but the id's are just completely wrong. Since the game code actually looks up the version id from the map path when writing the game_stats entry, the game history still uses the correct map_version ids. But when the map pool sees those ids they don't show up in the map list, so it ignores them all and just picks a random map.

I looked at the git blame and it looks like this has been happening ever since we implemented the new map pools. Which was almost a year ago.

Askaholic added a commit that referenced this issue Apr 1, 2021
* Fix getting map version id

* Set async test deadlines to None

* Fix indent

* Add integration test for anti map repetition

* Refactor variables in choose_map

* Set default limit to 2

* Fix typing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants