game-common / pragma.matchmaking / WarmBodyMatchmakingPlugin /

WarmBodyMatchmakingPlugin #

class WarmBodyMatchmakingPlugin(service: Service, contentDataNodeService: ContentDataNodeService, matchmakingHelper: MatchmakingHelper) : MatchmakingPlugin, ConfigurablePlugin<WarmBodyMatchmakingPlugin.Config>

An implementation of the MatchmakingPlugin interface that builds matches with any parties available based on the configurable Config.numberOfTeams and Config.playersPerTeam.

A game instance will be started when there are exactly enough players to satisfy the Config.playersPerTeam and Config.numberOfTeams configuration. The started game instance will contain players assigned to teams numbered from 1 to Config.numberOfTeams. All players in a party will be put on the same team. The started game instance will have an empty string for the game server zone.

This plugin will throw a PragmaError.MatchmakingService_PartyTooBig in the WarmBodyMatchmakingPlugin.initialize method if a party contains more players than the configured Config.playersPerTeam. In this case, either change the PartyConfig.maxPlayersPerParty configuration or this plugin’s Config.playersPerTeam configuration so this error is no longer thrown.

When to make a custom plugin instead of using this Pragma provided plugin:

  • If parties should only be in the same game instance based on some parameters (e.g. ranking system, ping, etc…)
  • If matches should be started on different game server zones
  • If players in the same party need to be on different teams

Constructors #

WarmBodyMatchmakingPlugin

fun WarmBodyMatchmakingPlugin(service: Service, contentDataNodeService: ContentDataNodeService)

WarmBodyMatchmakingPlugin

fun WarmBodyMatchmakingPlugin(service: Service, contentDataNodeService: ContentDataNodeService, matchmakingHelper: MatchmakingHelper)

Functions #

NameSummary

initialize

open override fun initialize(queueKey: MatchmakingRpc.MatchmakingQueueKey, party: Matchmaking.Party): NewGameInstance?

Called with a new Matchmaking.Party before it enters matchmaking. Perform any validation logic or initial transformations to party or players here. Return a NewGameInstance to start the game instance before it enters the matchmaking queue. Return null to continue to the matchmaking queue. If the Matchmaking.Party is not valid, prevent it from entering matchmaking by throwing an ExtException.

matchParties

open override fun matchParties(queueKey: MatchmakingRpc.MatchmakingQueueKey, anchor: Matchmaking.Matchable, other: Matchmaking.Matchable): NewGameInstance?

Called during the main matchmaking loop. The anchor Matchmaking.Matchable represents a collection of parties that could form the teams for a game. Parties can be moved between the matchable and the anchor. This method is called many times, evaluating each party that has joined the matchmaking queue. When the criteria to start a new game is met, return a NewGameInstance from this method to be sent to the game server.