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

Issue/#824 support for GameOptions in matchmaker queues #825

Merged

Conversation

Askaholic
Copy link
Collaborator

Loads additional params from the database and parses out game options to send in the game_launch message. My goal is for the params column to closely resemble the gameInfo table in the lua code. So something like this:

{
    "GameOptions": {
        "FogOfWar": "explored",
        "UnitCap": 1000,
        "Share": "FullShare",
    },
    "GameMods": {}
}

But it could always be expanded in the future.

Requires FAForever/db#285
Closes #824

@BlackYps
Copy link
Collaborator

I'm having a hard time figuring out how the server actually sends the game launch options to the client. i think mainly because my IDE can't find the declaration of this call:

await host.lobby_connection.launch_game(
game, is_host=True, options=game_options(host)
)

@Askaholic
Copy link
Collaborator Author

Askaholic commented Aug 31, 2021

Your reliance on IDE’s has been your downfall! Just grep for def launch_game and you’ll find it:

cmd = {
"command": "game_launch",
"args": ["/numgames", self.player.game_count[game.rating_type]],
"uid": game.id,
"mod": game.game_mode,
# Following parameters may not be used by the client yet. They are
# needed for setting up auto-lobby style matches such as ladder, gw,
# and team machmaking where the server decides what these game
# options are. Currently, options for ladder are hardcoded into the
# client.
"name": game.name,
"init_mode": game.init_mode.value,
"rating_type": game.rating_type,
**options._asdict()
}
await self.send({k: v for k, v in cmd.items() if v is not None})

@codecov
Copy link

codecov bot commented Sep 1, 2021

Codecov Report

Merging #825 (bf9c5e7) into develop (cf4e9b0) will increase coverage by 0.04%.
The diff coverage is 95.83%.

Impacted Files Coverage Δ
server/db/models.py 100.00% <ø> (ø)
server/ladder_service.py 97.95% <94.73%> (-0.34%) ⬇️
server/matchmaker/matchmaker_queue.py 92.02% <100.00%> (+0.17%) ⬆️
server/types.py 100.00% <100.00%> (ø)
server/gameconnection.py 95.17% <0.00%> (+0.68%) ⬆️
server/protocol/gpgnet.py 95.00% <0.00%> (+5.00%) ⬆️


# If the players did not match, this will fail due to a timeout error
await asyncio.gather(*[
read_until_command(proto, "match_found", timeout=30)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This integration test fails sometimes on my machine. I saw in the log that it took many matchmaker iterations until the logged in players finally were queued up for searching. They basically matched immediatly, but that was in the teardown log already, so I believe it was after the timeout aborted the test. Maybe increasing the timeout limit would help?

Suggested change
read_until_command(proto, "match_found", timeout=30)
read_until_command(proto, "match_found", timeout=60)

On the other hand I couldn't get it to reliably fail with a 10s timeout either, so I don't really know what exactly is happening. Other Integration tests also fail sometimes, but that is unrelated to this PR. It seems like it sometimes takes a lot of time for a command to take effect, for no apparent reason.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think it has to do with the fast forwarding somehow. Is it really timing out here though? This should only start waiting once all of the players have successfully queued, because queue_player_for_matchmaking waits for the search_info start message before returning.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I haven't gotten these to fail, so I'm just going to leave it as is for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just keep an eye out on this. Maybe it has to do with the local configuration on my machine...

@Askaholic Askaholic force-pushed the issue/#824-matchmaker-game-options branch 2 times, most recently from e0fc423 to d927888 Compare September 3, 2021 02:51
@Askaholic Askaholic force-pushed the issue/#824-matchmaker-game-options branch from d927888 to 4f49935 Compare September 9, 2021 03:59
server/matchmaker/matchmaker_queue.py Show resolved Hide resolved
server/ladder_service.py Outdated Show resolved Hide resolved
@Askaholic Askaholic force-pushed the issue/#824-matchmaker-game-options branch 2 times, most recently from 4647a2f to 091f631 Compare September 18, 2021 23:46
@Askaholic Askaholic force-pushed the issue/#824-matchmaker-game-options branch from 091f631 to 1b85db8 Compare September 25, 2021 07:10
server/ladder_service.py Outdated Show resolved Hide resolved
@Askaholic Askaholic force-pushed the issue/#824-matchmaker-game-options branch from 1b85db8 to bf9c5e7 Compare September 26, 2021 22:22
@Askaholic Askaholic merged commit 54da090 into FAForever:develop Sep 26, 2021
@Askaholic Askaholic deleted the issue/#824-matchmaker-game-options branch September 26, 2021 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send game options in game_launch message for matchmaker games
3 participants