Tweak VacantOnly / VacantParticipants behaviour#59
Draft
Conversation
sm4sh notably sets this to false but VacantParticipants to >0
Member
Author
|
The other random formatting changes were done by my IDE, I guess it's stylistic |
Member
Author
|
@jonbarrow has informed me this is not the correct behaviour and it seems sm4sh does intentionally set VacantOnly to false (for some reason?) |
This was referenced Oct 22, 2025
For AutoMatchmake, the session has to have a slot for us to join no matter what the searchparam says
DaniElectra
reviewed
Oct 26, 2025
Member
DaniElectra
left a comment
There was a problem hiding this comment.
While we're here we should also set all of the excludes from the search criteria to true for auto matchmake.
Something like this could work: searchCriteria.ExcludeLocked || isAutoMatchmake
jonbarrow
reviewed
Oct 26, 2025
Comment on lines
212
to
219
| if bool(searchCriteria.VacantOnly) || isAutoMatchmake { | ||
| // * Account for the VacantParticipants when searching for sessions (if given) | ||
| if searchCriteria.VacantParticipants == 0 { | ||
| searchStatement += ` AND array_length(g.participants, 1) + 1 <= g.max_participants` | ||
| } else { | ||
| searchStatement += fmt.Sprintf(` AND array_length(g.participants, 1) + %d <= g.max_participants`, searchCriteria.VacantParticipants) | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Just a couple notes:
VacantParticipantswill never be 0 in normal circumstances. WhenMatchmakeSessionSearchCriteria::SetVacantOnly(bool)is called,VacantParticipantsis always set to 1. WhenMatchmakeSessionSearchCriteria::SetVacantOnly(bool, ushort)is called it first checks ifVacantOnlyis true or not. If it is true, then it checks the value ofVacantParticipants, and ifVacantParticipantsis 0 then the function exits with a failure, otherwiseVacantParticipantsis updated to the given value. IfVacantOnlyis set to false, thenVacantParticipantsis always set to 1. So outside of custom clients (which I don't think should be an issue here), thesearchCriteria.VacantParticipants == 0branch will never be hit, and tbh if a client sends 0 we should throw an error much earlier- The
VacantParticipantsvalue should still (probably) be checked in all cases, even in both auto and browse matchmaking types (which is also why it's always defaulted to 1, for 1 vacant slot for the caller). It'sVacantOnlywhich we should ignore in the auto methods (can't join automatically full room), but we should still make sure there's enough spots the caller is asking for
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #XXX
Changes:
Allow VacantParticipants (new field in NEX 3.4) to override the original VacantOnly boolean.
Most games do the following:
VacantOnly: trueVacantParticipants: 1However, Sm4sh WiiU (and probably 3DS, I didn't check) does the following:
VacantOnly: falseVacantParticipants: 1This causes it to fail matchmaking since it will always try to join sessions, even if full. However, if we give VacantParticipants precedence over VacantOnly, all is fixed. Games that (correctly) set VacantOnly to true are unaffected.
I am not aware of games that actually intentionally set
VacantOnly: false(some kind of spectator mode?) so I was unable to see what theirVacantParticipantsvalue is. I hope it is 0.