Skip to content

Add regional matchmaking to joinOrCreate() - #418

Open
erikdubbelboer wants to merge 1 commit into
mainfrom
matchmaking_region
Open

erikdubbelboer wants to merge 1 commit into
mainfrom
matchmaking_region

Conversation

@erikdubbelboer

@erikdubbelboer erikdubbelboer commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Derive each player's matchmaking region from the CF-IPCountry and X-Geo-Region headers, falling back to the country and region query parameters. Use eu-west when the location is unknown.

joinOrCreate() takes a new method setting:

  • low-latency searches the player's region, then its configured neighbors in order.
  • faster-matchmaking (the default) does the same, then falls back to any eligible lobby worldwide, including lobbies without a region.

If no lobby matches, create one in the player's region. Reject unknown methods.

Search one region per query so a closer region always wins. Within a region, pick the fullest lobby, then the oldest, instead of a random one.

Store the creator's region on lobbies made by create() and joinOrCreate(), and expose it as matchmakingRegion. list() and joinOrCreate() filters can match on it. Add a partial index for the regional lookups.

@erikdubbelboer
erikdubbelboer force-pushed the matchmaking_region branch 3 times, most recently from 2d66d0c to 11b661d Compare November 9, 2026 09:14
Base automatically changed from rm-lobby-latency to main November 11, 2026 01:28
@erikdubbelboer
erikdubbelboer marked this pull request as draft November 18, 2026 08:44
@erikdubbelboer
erikdubbelboer force-pushed the matchmaking_region branch 2 times, most recently from 10435bf to a321f49 Compare November 29, 2026 05:19
Derive each player's matchmaking region from the `CF-IPCountry` and
`X-Geo-Region` headers, falling back to the `country` and `region` query
parameters. Use `eu-west` when the location is unknown.

`joinOrCreate()` takes a new method setting:

- `low-latency` searches the player's region, then its configured
  neighbors in order.
- `faster-matchmaking` (the default) does the same, then falls back to
  any eligible lobby worldwide, including lobbies without a region.

If no lobby matches, create one in the player's region. Reject unknown
methods.

Search one region per query so a closer region always wins. Within a
region, pick the fullest lobby, then the oldest, instead of a random
one.

Store the creator's region on lobbies made by `create()` and
`joinOrCreate()`, and expose it as `matchmakingRegion`. `list()` and
`joinOrCreate()` filters can match on it. Add a partial index for the
regional lookups.
@erikdubbelboer
erikdubbelboer marked this pull request as ready for review November 30, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant