Skip to content

fix: CycleMatchModule should not cycle erroneously when players drop below the join.min-players amount #1495

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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

jasoryeh
Copy link
Contributor

@jasoryeh jasoryeh commented Mar 2, 2025

This fixes an issue that most servers will not encounter, unless they changed the join.min-players setting.

join.min-players defines the minimum players to start a match, this option is default to 1 meaning most servers will run correctly if their configurations are not modified, however, previously if you change it to a value higher than 1 and you have <= that amount of players playing/participating, the matches will cycle/end erroneously when players leave/join mid-match due to an incorrect comparison that triggers a cycle if empty.

@Pablete1234
Copy link
Member

Pablete1234 commented Mar 2, 2025

I believe this works as intended
setting min-players = 2 should mean that no match should be playing without at least 2 players, that applies to both being able to start the match, as well as continuing the match.

If you wish certain maps to enforce a min player count before starting (eg: tournament-edition versions which require N players to start), you can use the min attribute of teams, which works similarly but won't end matches when they drop below

If you wish to change this behavior i think its most appropriate for it to be a separate option.

Copy link
Member

@Pablete1234 Pablete1234 left a comment

Choose a reason for hiding this comment

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

As mentioned in the comment, consider simply making this an extra config setting

&& match.getParticipants().size() < PGM.get().getConfiguration().getMinimumPlayers()) {
&& match.getParticipants().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

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

This would end matches even if min-players is set to 0, which is often done in debug/test server scenarios so that your matches don't end on you if you rejoin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this scenario makes sense- perhaps a separate configuration option is necessary to more clearly enforce a minimum participant count for continuing a match.

@jasoryeh
Copy link
Contributor Author

jasoryeh commented Mar 3, 2025

If you wish certain maps to enforce a min player count before starting (eg: tournament-edition versions which require N players to start), you can use the min attribute of teams, which works similarly but won't end matches when they drop below

I understand the idea that this configuration might not make sense for enforcing minimum players as each map is different, however, this doesn't make sense from the configuration documentation comments, as the the config.yml is clear that the join.min-players is designated to enforce the minimum number of players to start a match:

# Changes behaviour when players try to /join a match.
join:
min-players: 1 # Minimum number of players before a match can start.

Furthermore, using this value as double duty for default minimum player count and as a minimum-continuing-match-player-size creates unnecessary ambiguity.

I believe this works as intended setting min-players = 2 should mean that no match should be playing without at least 2 players, that applies to both being able to start the match, as well as continuing the match.

I disagree, I believe a minimum player count limit for a match to continue should be described in a separate configuration not in the join section and rather in something like gameplay or match. The join section, in my opinion, should only be used to regulate only the pre-match -> start-of-match phases.

If you wish to change this behavior i think its most appropriate for it to be a separate option.

I think a best case course of action would be to introduce new configuration to more clearly define an option for enforcing a minimum playing player count.

@Pablete1234
Copy link
Member

I understand the idea that this configuration might not make sense for enforcing minimum players as each map is different, however, this doesn't make sense from the configuration documentation comments, as the the config.yml is clear that the join.min-players is designated to enforce the minimum number of players to start a match:

# Changes behaviour when players try to /join a match.
join:
min-players: 1 # Minimum number of players before a match can start.

Yeah the problem may be the config's naming, in modern pgm (1.9+) the config wasn't even in the join config
https://github.com/OvercastNetwork/ProjectAres/blob/master/PGM/src/main/resources/config.yml#L139

and had a separate config for cycling when match is empty:
https://github.com/OvercastNetwork/ProjectAres/blob/master/PGM/src/main/resources/config.yml#L122
https://github.com/OvercastNetwork/ProjectAres/blob/master/PGM/src/main/java/tc/oc/pgm/cycle/CycleMatchModule.java#L210

In fact, digging into the history it seems that this 1.8-pgm version "simplified" the settings, renaming minimum-players to join.min-players, and removed the match-empty in favor of join.min-players = 0:
12e9e60#diff-fd22f8387085c525f472af2f02ff3dd726cbecf8d416c1cf9639050d480efe5bR176

12e9e60#diff-c44e8a03c6e51fede2607ed31511ee21a7022f2e615b7ee442acf97a3e0dd29fL48

So yeah, tldr: this was an intentional change to simplify the settings by merging the cycle.empty.enabled: true/false config into the minimum-players encoded as a 0 or a 1, with little regard to what it means for values >1.

Feel free to revert these so that we have the cycle enabled as a separate config

…below the `join.min-players` amount

`join.min-players` defines the minimum players to start a match, this option is default to `1` meaning most servers will run correctly, however, previously if you change it to a value higher than 1 and you have `<=` that amount of players playing/participating, the matches will cycle/end erroneously when players leave/join mid-match

Signed-off-by: Jason <[email protected]>
@jasoryeh jasoryeh force-pushed the patch-1 branch 2 times, most recently from e8f21fe to 29aac7d Compare March 23, 2025 18:21
@jasoryeh
Copy link
Contributor Author

I made it a separate config value and just put it in join.min-players-maintain next to the original config that was being used. Feel free to suggest a better name because I wasn't too sure what to call it

@jasoryeh jasoryeh requested a review from Pablete1234 March 23, 2025 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants