1681-engine / index / Matchmaker
Class: Matchmaker ​
Defined in: src/net/lobby/Matchmaker.ts:37
The matchmaking queue, pure: tickets in, matches out, no clock of its own and no sockets. Each find(now) takes the oldest ticket of a mode as the anchor, gathers the groups within its rating window (and each within theirs, so a newcomer is not thrown in with veterans because a veteran waited), and fills the teams from the closest ratings first, never splitting a party; the teams are then balanced by rating. A window grows with the wait, so anyone is matched in the end; a ticket nothing fits waits for the next call.
Constructors ​
Constructor ​
new Matchmaker(modes): Matchmaker;Defined in: src/net/lobby/Matchmaker.ts:41
Parameters ​
| Parameter | Type |
|---|---|
modes | readonly MatchMode[] |
Returns ​
Matchmaker
Accessors ​
size ​
Get Signature ​
get size(): number;Defined in: src/net/lobby/Matchmaker.ts:48
Returns ​
number
Methods ​
add() ​
add(ticket): void;Defined in: src/net/lobby/Matchmaker.ts:57
Adds a ticket (replacing one of the same id); throws on an unknown mode or a group too big for a team.
Parameters ​
| Parameter | Type |
|---|---|
ticket | Ticket |
Returns ​
void
find() ​
find(now): FoundMatch[];Defined in: src/net/lobby/Matchmaker.ts:87
Every match that can be made now; their tickets leave the queue.
Parameters ​
| Parameter | Type |
|---|---|
now | number |
Returns ​
get() ​
get(id): Ticket | undefined;Defined in: src/net/lobby/Matchmaker.ts:70
Parameters ​
| Parameter | Type |
|---|---|
id | string |
Returns ​
Ticket | undefined
mode() ​
mode(id): MatchMode | undefined;Defined in: src/net/lobby/Matchmaker.ts:52
Parameters ​
| Parameter | Type |
|---|---|
id | string |
Returns ​
MatchMode | undefined
remove() ​
remove(id): Ticket | undefined;Defined in: src/net/lobby/Matchmaker.ts:64
Parameters ​
| Parameter | Type |
|---|---|
id | string |
Returns ​
Ticket | undefined
waiting() ​
waiting(mode): Ticket[];Defined in: src/net/lobby/Matchmaker.ts:75
The tickets waiting for a mode, oldest first.
Parameters ​
| Parameter | Type |
|---|---|
mode | string |
Returns ​
Ticket[]
windowOf() ​
windowOf(t, now): number;Defined in: src/net/lobby/Matchmaker.ts:80
How far a ticket's rating window reaches now.
Parameters ​
| Parameter | Type |
|---|---|
t | Ticket |
now | number |
Returns ​
number