I found that I still need to wait around 10 seconds after pressing FX-L and FX-R in matching phase.
After a bit of research in source code, I think it is because of the entry list in opponents is never empty since the code add yourself into the list at first place:
if(await DB.Count({collection: 'matchmaker', c_ver: entryData.c_ver, filter: entryData.filter, claim: entryData.claim, entry_id: entryData.entry_id}) === 0) {
console.log("[" + loglip + " | " + loggip + "] Adding your info.")
await DB.Upsert<Matchmaker>( // insert yourself to database
{ collection: 'matchmaker', gip: entryData.gip, lip: entryData.lip},
entryData
)
}
...
// since the database has at least one entry, the opponents entry list initializes with this entry
let opData = await DB.Find<Matchmaker>({collection: 'matchmaker', c_ver: entryData.c_ver, filter: entryData.filter, claim: entryData.claim, entry_id: entryData.entry_id})
let opponents = {
entry_id: K.ITEM('u32', entryData.entry_id),
entry: opData.length > 0 ? opData.map(e => ({
port: K.ITEM('u16', e.port),
gip: K.ITEM('4u8', e.gip),
lip: K.ITEM('4u8', e.lip)
})) : []
}
console.log("[" + loglip + " | " + loggip + "] Opponents: " + opponents.entry.length)
if(opponents.entry.length === 0) send.success() // so the code won't send success, the game just keep waiting
else send.object(opponents)
I know this is necessary for online matchmaking, but for players that only play offline, it's unnecessary.
I don't exactly know how the communication between server and clients work, but I have tested that if i explicitly set entry to an empty list the skip is instant.
let opponents = {
entry_id: K.ITEM('u32', entryData.entry_id),
entry: [],
};
A better approach is to add a plugin setting to toggle this "force single player" behavior.
I was going to open a pull request but the repo cloning was so slow and i'm using 6.1.0b currently thus I cannot test newer version.
i would appreciate that if you could spare some time working on this.
I found that I still need to wait around 10 seconds after pressing FX-L and FX-R in matching phase.
After a bit of research in source code, I think it is because of the
entrylist inopponentsis never empty since the code add yourself into the list at first place:I know this is necessary for online matchmaking, but for players that only play offline, it's unnecessary.
I don't exactly know how the communication between server and clients work, but I have tested that if i explicitly set
entryto an empty list the skip is instant.A better approach is to add a plugin setting to toggle this "force single player" behavior.
I was going to open a pull request but the repo cloning was so slow and i'm using 6.1.0b currently thus I cannot test newer version.
i would appreciate that if you could spare some time working on this.