Master Server Toolkit (MST)

repository·master·Indexed 41 days ago

https://github.com/aevien/master-server-toolkit

A modular Unity framework for building multiplayer game backends, providing infrastructure for master servers, authentication, matchmaking, profiles, and room management. Includes bridges for FishNet networking and LiteDB for embedded database access.

Tokens
62.5K
Snippets
37
Records
314
Agent score
52%

What's inside Master Server Toolkit

  1. Overview of Built-In MST Modules

    master

    MST includes several pre-built modules for common master server requirements:

    ModuleDescription
    AuthenticationAccount registration, login (guest, token, password), email confirmation, and IUserPeerExtension.
    ProfilesObservable profile schema with loading/saving and dirty update synchronization between master, client, and room servers.
    RoomsRoom registration, public listing, access token flows, and player tracking.
    SpawnerSpawner registration, spawn queues, and managing room process lifecycles (launch/kill/finalization).
    LobbiesLobby factories, teams, membership, ready states, chat, and room spawning.
    MatchmakerAggregates public games/regions from room, lobby, and spawner providers.
    ChatChannels, messages, permissions, invites, bans, and user channel state.
    NotificationTargeted and room-wide notification delivery.
    RemoteConfigSmall remote key/value sets exposed to clients and rooms.
    WebServer & DashboardHTTP listener, routes, controllers, and admin UI/API pages.
    Gameplay SupportGeneric modules including Achievements, Leaderboards, Quests, AnalyticsModule, Censor, Ping, and WorldRooms.
    CommonShared packet types.
  2. Overview of the Matchmaker Module

    master

    The Matchmaker Module provides a generic system for game searching and region listing across registered game providers. It allows clients to discover available games and identify valid server regions.

    Core Components

    • MatchmakerModule: The authoritative server-side module responsible for managing matchmaker logic.
    • MatchmakerClient: The client-side facade used to perform searches for games and regions.
    • IGamesProvider: The interface/contract that must be implemented by providers to supply visible game data to the matchmaker.

    Wire Payloads

    Communication between client and server uses the following packet types:

    • GameInfoPacket
    • PlayersPacket
    • RegionInfo
    • RegionsPacket
  3. Overview of the Notification Module

    master

    The Notification Module provides a lightweight system for delivering server-to-client notifications. It is designed for transient messages rather than durable data storage.

    Core Concepts:

    • NotificationModule: The authoritative server-side module managing the system.
    • NotificationClient: The client-side component that receives messages.
    • NotificationServer: The server-side facade used to issue requests.
    • NotificationRecipient: Defines the target of a notification.
    • NotificationPacket: The actual payload sent over the wire.
  4. Overview of the MasterServer module

    master
    The MasterServer module is the core reusable backend and runtime framework of the Master Server Toolkit (MST). It provides the foundational infrastructure for server/client communication, including the static Mst facade, server behaviors, database interfaces, event systems, logging, localization, and argument parsing. It is designed to be game-agnostic.
  5. Overview of the Quests Module

    master

    The Quests Module provides a framework for managing generic quest data and quest progress packet types. It serves as a shell for defining quest catalogs and tracking player progress.

    Core Components:

    • QuestsModule: The main server module shell.
    • QuestsModuleClient & QuestsModuleServer: Facades intended for handling quest-related requests.
    • QuestData & QuestsDatabase: Definitions for the quest catalog.
    • IQuestInfo, QuestStatus, QuestState, & QuestProgressInfo: Types describing the state and progress of quests.
  6. Overview of the Authentication Module

    master

    The AuthModule is the authoritative account management system for MST. It provides a complete suite of identity services including:

    • Account Management: Creation, guest accounts, and account lookup for room servers.
    • Authentication Flows: Username/password login, token-based login, and email-based login.
    • Account Recovery: Password resets and email confirmation.
    • Identity Attachment: Attaches an IUserPeerExtension to an IPeer upon successful authentication.
    • Metadata: Handles client-writable account metadata.

    Key Components

    • AuthModule.cs: The server-side authority.
    • AuthClient.cs: The client-side facade for all sign-in/up/out and metadata operations.
    • AuthServer.cs: The room/server-side facade for looking up accounts by username or peer.
    • IAccountsDatabaseAccessor.cs: The persistence contract that database bridges must implement.
  7. Overview of MST Terminal

    master

    MST Terminal is a client-side command terminal designed for Unity players and WebGL builds. It is located under Assets/MasterServerToolkit/Tools/Terminal and consists of two layers:

    1. Terminal: A singleton backend responsible for command registration, execution, log management, history, autocomplete, and search.
    2. TerminalUI: A lightweight IMGUI renderer that draws only the lines visible within the current window height.

    The provided --TERMINAL.prefab is a single GameObject containing both components and does not require external UI assets like Canvas, TMP, or UGUI.

  8. Overview of Game Service Implementations

    master

    The GameServiceBridge provides a structured way to implement platform-specific services through generic contracts, reusable base classes, and concrete platform implementations. This allows the Master Server Toolkit (MST) to interact with various game platforms (like VK Play, Yandex Games, or Itch) using a unified interface.

    Service Families

    • Generic: Contains the core interfaces and service IDs used to identify and request services.
    • Base: Provides shared base implementations for both services and modules to reduce boilerplate.
    • EditorService: A specialized service for local testing within the Unity Editor.
    • DesktopService: The default fallback for native PC environments, including support for guest players.
    • ItchService: Provides integration for Itch desktop tokens/profiles and future Web support.
    • VKPlayService: Integration for the VK Play platform.
    • VkGamesService: Integration for VK Games (WebGL), covering launch, identity, storage, and platform features.
    • YandexGamesService: Integration for the Yandex Games WebGL SDK.
  9. Overview of Networking Scripts in MST

    master

    The Networking Scripts folder provides the transport-independent networking core used by all Master Server Toolkit (MST) modules. It defines the abstractions for peers, sockets, and message handling, allowing MST modules to remain decoupled from specific transport implementations (like WebSockets).

    Key components include:

    • Peer Abstractions: IPeer and BasePeer manage connected peer properties and response callbacks.
    • Socket Lifecycle: IClientSocket, IServerSocket, and BaseClientSocket define how connections are managed.
    • Messaging: IncomingMessage and OutgoingMessage handle opcodes, status, flags, ack IDs, and binary payloads.
    • Serialization: MessageFactory, Serializer, and SerializablePacket manage packet creation and binary serialization.
    • Handlers: PacketHandler and AsyncPacketHandler provide wrappers for processing messages.
    • Utilities: MstTimer and MstUpdateRunner handle timeouts/updates, while Utils provides endian-aware readers/writers.
  10. Overview of the World Rooms Module

    master

    The World Rooms Module is an extension of the standard RoomsModule designed for world-zone style room lookups. It allows for querying rooms based on specific zones rather than just individual room IDs.

    Key characteristics:

    • Inherits all functionality from RoomsModule.
    • Adds zone-based query capabilities via specific OpCodes.
    • Designed for generic zone routing; game-specific world-map policies should be implemented outside of this module.