Skip to Content
MineDuels

Regions and several proxies

Name a region on each proxy, let players choose where they play, and match them on the server with the best ping.

A network can have more than one proxy, for example one in Europe and one in Singapore. Each proxy names its own region. Players who join through a proxy play in that region by default, and they can switch other regions on in /regions. All proxies and all backends share the same Redis, database number and secret.

Regions are optional and are set only on proxies. Until a proxy has region= in its config.properties, the network has no regions: there is no /regions menu, no Regions button, and nothing is restricted. Backends and regions.yml cannot turn regions on.

What you need

  • Minecraft 1.20.5 or newer for a move between proxies (older clients stay where they are).
  • accepts-transfers = true in the velocity.toml of the proxy that receives players.
  • The same MineDuels version on every backend and every proxy.

Set up the regions

The proxy decides the region. Backends need no region of their own: a backend is in the region of the proxy it sits behind.

1. On every proxy, in plugins/mineduels/config.properties:

proxy-name=proxy-eu
region=eu
region-display=<gold>Europe
public-address=eu.example.com:25565
accepts-transfers=true
latency.sg=170
latency.us=90
KeyMeaning
regionThe region label: lower case letters, digits, _, ., -, up to 32 characters. Leave it empty on a network with one proxy.
region-displayThe name players see in /regions. Empty: the label.
latency.<region>Estimated milliseconds from this region to that one. A region you leave out counts as 100.

2. On every backend, in database.yml, name the proxy it sits behind:

cross-server:
  server-name: game-eu-1
  proxy-server-name: practice
  proxy: proxy-eu

proxy is the proxy-name of that proxy. This is how a backend learns its region. With a single proxy you can leave proxy empty: the backends then take the region of the only proxy that has one.

The region key that older versions had in database.yml is gone. It is removed from your file automatically on the first start (see "Updating old files" below).

3. Optional: regions.yml on the lobbies. Every region a proxy announces shows up in /regions without any entry here. Add an entry only to change how it looks. An entry for a region no proxy names is ignored:

regions:
  sg:
    display: "<aqua>Singapore"
    default: false
    item:
      slot: 11
      material: PLAYER_HEAD
      texture: "eyJ0ZXh0dXJlcyI6..."
      name: "%display%"
      lore: ["%state%", "<gray>Servers: <white>%servers%", "", "<yellow>Click to switch"]
KeyMeaning
regions.<id>The region label, as written in the proxy's region, in lower case.
displayThe name shown in the menu.
defaultWhether new players have the region on. false unless you write true.
itemThe menu item: material, name, lore, glow, slot. For PLAYER_HEAD, texture is the Base64 value of a skin.
button, button-slotsThe Regions button in other menus. See below.

Placeholders in the item: %display%, %state%, %servers%, %player%.

Updating old files

The plugins update older files on the first start, and keep a copy of what they changed.

FileWhat happensCopy
plugins/mineduels/config.properties (proxy)The optional block region=, region-display= is added at the end. Your lines are not touched. Regions stay off.config.properties.bak-before-regions
database.ymlThe old cross-server.region line is removed. Your other values are kept.backups/
regions.ymlA file with no regions is replaced by the new one. A file with regions keeps them, gets default: true on any region that had no default (what it meant before), and gains the button settings.regions.yml.bak-before-proxy-regions
messages.ymlThe new texts are added.backups/

Example: your old regions.yml listed sg with no default. After the update it still has sg, now with default: true, so players keep seeing it switched on. New regions that only a proxy announces start off.

What players see

A player who joins through proxy-eu plays in eu. That region is always on and cannot be switched off. Every other region starts off.

  • /regions opens the menu. A click switches a region on or off.
  • The same menu opens from the Regions button in the queue menus, the duel kit menu, /settings and the party menu. The button shows the regions the player plays in.
  • A region with no online server is marked as offline.
  • The choice is saved with the player's other settings and works on every lobby.

Example: Sam joins through the Europe proxy. /regions shows Europe as "Your region" and Singapore as "Disabled". Sam clicks Singapore. Sam's queue joins now accept servers in both regions.

How the best server is chosen

For every player the plugin knows two numbers: their ping to the proxy they joined through, and the latency between that region and the region of each server. The score of a server is their sum.

score = ping to your proxy + latency(your region, server region)

The server with the lowest score wins. Scores less than 20 ms apart count as equal, and then the server with the most free arenas, then the fewest players, wins. For a match, the player with the worst score decides.

Example: Sam is on eu with a ping of 30 ms. With latency.sg=170 on the Europe proxy:

ServerRegionScore for Sam
game-eu-1eu30
game-sg-1sg200

Sam's game goes to game-eu-1, even if game-sg-1 has more free arenas. If Europe has no free arena and Sam has Singapore on, the game goes to game-sg-1. If Sam has Singapore off, Sam waits.

What it changes

  • Queues: two players are paired only when they share a region and their ping range in /settings accepts each other. The ping of a player in another region includes the latency between the two regions. The ELO range works in the same way for ranked.
  • Duels: a duel is hosted in a region both players accept. If they share none, the accepter is told and the duel does not start.
  • Parties: a party belongs to one server, so a player in another region cannot join or be invited. They get a message that names the region (party.other-region). See Parties. The party leader chooses the regions for everyone. Members who open /regions see the leader's choice and cannot change it. Party games and tournaments use the regions all their players accept.
  • Server menu: /servers shows %region% for each server. Choosing a server in a region you have off tells you to use /regions.
  • Moving between proxies: when a game is found on a backend behind another proxy, the proxy that holds the player moves them to the other proxy and sends them on to that server. After the match they go back to a lobby, in their home region when it can be reached.

What is not possible

  • Moving players to a proxy that has accepts-transfers off, or players on a client older than 1.20.5. They stay where they are and the matchmaker does not choose that region for them.
  • Switching off the region of the proxy you joined through.
  • Measuring the real ping to another region. The score uses the latency.* values you set, so keep them close to the real round trip time between your data centers.
  • Mixing MineDuels versions between proxies and backends.

Related: Velocity plugin, Backend config, Parties.

On this page