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 match will be started when there are exactly enough players to satisfy the Config.playersPerTeam and Config.numberOfTeams configuration. The started match 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 match 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 match 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

buildMatch

open override fun buildMatch(queueKey: MatchmakingQueueKey, potentialMatch: PotentialMatch, matchable: Matchable)

Called during the main matchmaking loop. The PotentialMatch represents a collection of parties that could form the teams for a match. The Matchable are parties that could be added to the PotentialMatch. This method is called many times, evaluating each party that has joined the matchmaking queue. If the PotentialMatch is marked as ready to start, it will be removed from the matchmaking queue and sent to the game server. If a PotentialMatch is compared against every other Matchable in the queue and not marked as ready to start, the next matchmaking loop will run with a new PotentialMatch seeded with a different set of parties.

initialize

open override fun initialize(queueKey: MatchmakingQueueKey, potentialMatch: PotentialMatch)

Called with a new PotentialMatch before it enters matchmaking. Perform any validation logic or initial transformations to the PotentialMatch here. If the PotentialMatch is not valid, prevent it from entering matchmaking by throwing an ExtException.