LogoLogo
HomeOnline DashboardAPIDiscordForums
SDK 0.4.14
SDK 0.4.14
  • Welcome
  • Overview
    • What is coherence?
    • How does coherence work?
    • Features and Roadmap
    • Requirements
  • Get Started
    • Install coherence
    • Scene setup
    • Prefab setup
    • Build and run
    • Baking and code generation
    • Create a free account
    • Deploy and share
  • Authority and communication
    • How authority works
    • Authority transfer
    • Commands
    • Server-side and input queues
    • Animations
  • Persistence
    • Overview
    • Configuring persistence
    • Storage
    • Example – A global counter
  • Optimization
    • Overview
    • Simulation frequency
    • Areas of interest
    • World size
    • Level of detail
    • Interpolation
    • Extrapolation
  • Connected entities
    • Overview
    • Entity references
    • ConnectedEntity component
    • Parent-child relationships
  • Simulators
    • Overview
    • Client vs. simulator logic
    • Build and deploy
    • Simulator load balancing
  • Tutorial project
    • Get the Tutorial Project
    • Start Tutorial
      • 1. Transforms
      • 2. Physics
      • 3. Persistence
      • 4. Animation and Variables
      • 5. AI Navigation
      • 6. Network Commands
      • 7. Network Events
  • Game Services
    • Game account
    • Key-value store
    • Matchmaking
  • API reference
    • Network SDK
      • CoherenceSync
      • MonoBridge
      • LiveQuery
      • Archetype
      • Sample UI
      • Settings Window
    • Cloud API
      • API tokens and keys
      • Server discovery
      • Game account
      • Key-value store
      • Matchmaking
    • Replication Server
    • Simulation Server
    • Entity Component System
      • Network Entities and Components
  • Schema reference
    • Overview
    • Specification
    • Field Settings
    • Archetypes and LOD-ing
  • Resources
    • Downloads
    • Video Tutorials
    • Glossary
    • CLI Utilities
    • Helper Scripts
    • Troubleshooting
  • Community
    • Discord
  • Additional information
    • Pricing
    • SLA
    • Unreal Engine support
    • Peer-to-Peer (P2P)
    • Known Issues
    • Version History
Powered by GitBook
On this page
  • Coherence.Play.Matchmaking
  • Example

Was this helpful?

Export as PDF
  1. API reference
  2. Cloud API

Matchmaking

The matchmaking provides a powerfull service to group players together in teams.

Coherence.Play.Matchmaking

The matchmaking module has only one method.

// Invoked on success/failure
public delegate void OnMatch(Result result, MatchResponse match);

// The data for every player returned by the matchmaking request
public struct PlayerPayload
{
    public string user_id;
    public string team;
    public int score;
    public string payload;
}

// The response of the matchmaking request
public class MatchResponse
{
    public string match_id;
    public PlayerPayload[] players;
    public string error;
}

public static class Matchmaker
{
    // Sends matchmaking request.
    // region:  matchmaking region, e.g. eu, us, ...
    // team:    team name
    // payload: custom string that will be send to all other players
    public static void Match(string region, string team, string payload, OnMatch callback)
    
    // Sends a matchmaking request
    // region:  matchmaking region, e.g. eu, us, ...
    // team:    team name
    // payload: custom string that will be send to all other players
    // tags:    custom tags to segment the player pool, e.g. "level1", "qa", etc
    // friends: group the player with his friends. If any of the friends doesn't show up the request will fail
    public static void Match(string region, string team, string payload, string[] tags, string[] friends, OnMatch callback)
}

Example

Matchmaker.Match("eu", "blue", "car:volvo,rifle:glock", (res, match) => {
    if (res == Result.Timeout) {
        // timed out, inform the player
        return
    }
    
    // match.players contain all the matched players and their data
    // including the this player
}

Last updated 3 years ago

Was this helpful?