I’m using
Nakama version : 3.1.1
When I add match maker with minimum less or equal to 3 it work but if above 3 it doesn’t work. I check the code of matchmaker.go
of nakama, I see the code doesn’t actually modify actual array. Check out below block of code from matchmaker.go
and some comments.
entryCombos := make([][]*MatchmakerEntry, 0, 5) // <----- Not array of array pointer
for _, hit := range result.Hits {
...
var foundCombo []*MatchmakerEntry
for _, entryCombo := range entryCombos { // <----- entryCombo is copied out
if len(entryCombo)+len(entries)+index.Count <= index.MaxCount {
for _, entry := range entryCombo {
if _, found := hitIndex.SessionIDs[entry.Presence.SessionId]; found {
sessionIdConflict = true
break
}
}
if sessionIdConflict {
continue
}
entryCombo = append(entryCombo, entries...) <----- then modify the copied, not the actual array
foundCombo = entryCombo
break
}
....
}
I have solved this by modifying the entryCombos
variable and let the loop access it as pointer accordingly.
entryCombos := make([][]*MatchmakerEntry, 0, 5)
// to
entryCombos := make([]*[]*MatchmakerEntry, 0, 5)
// ^ Add this