Match flow and front end
The front end takes a player from the main menu into a match and back: Find match, Practice against bots or a custom game, then a lobby, champion select with picks and bans, and a loading screen everyone waits on together. All of it is CommonUI screens and plain rules in the UI module; finding a game goes through a matchmaking provider in the Net module, which you can replace with your own service.
From the menu to the match
- Main menu.
UMobaFrontEndSubsystem(one per game) knows which screen the player should see. Find match, Practice and Custom game ask the match connector to get the player into a lobby. - Lobby. A lobby is a server on the lobby map with
AMobaLobbyGameMode. It is one of three kinds:- Quick match (Find match): players are seated as they arrive. When every seat has a player, or 60 s (Bot Fill After) after the first player arrived, the match is found: bots take the empty seats, and every player has 10 s (Accept Time) to accept. Whoever declines or misses it goes back to the menu, and the others wait again.
- Practice: one player, bots in every other seat at once, no bans, nobody else can join.
- Custom game: players take seats; the host switches bot fill and each team's bot difficulty and starts the match. On a dedicated server the player who has been there longest is the host, and the match also starts by itself 10 s (Auto Start Delay) after every player is ready.
- Champion select. A ban phase (30 s, each team's first player, one ban per team by default, which a player may skip), a pick phase (60 s, or until everyone has locked in) and a final phase (10 s). Each player picks a champion and two summoner spells. A player who did not lock in gets the champion they looked at, or a random allowed one. Bots choose at the end of the pick phase.
- Loading. The lobby hands the roster to the match map. Everyone's load progress shows on the loading screen, and the match begins when every player has loaded or after 120 s (Load Timeout).
Who may know what
- The lobby's game state holds what everyone in the lobby may know: seats, the phase and its clock, the host's settings, the bans once both teams' are in, and the picks once the final phase begins.
- The lobby player controller holds what only its player may know: their own seat and, during champion select, their own team's hovers, picks, spells and bans in the making. The other team's game never receives a hover or a pick before the final phase.
- Chat goes to everyone in a lobby, and only to the sender's team during champion select.
Into the match
What the lobby decided is on the game instance as UMobaMatchHandover::GetMatchSetup(): every seat's player, team,
slot, champion, spells and, for a bot, its difficulty.
- Team, champion and spells are applied for you. While the loading screen is up, the server puts each player's
AMobaPlayerStateon their seat's team with the champion and the two summoner spells picked, and starts the player at that team's player start. - Bots take their seats when the match begins, played by the Match settings' Bot Controller Class, with their seat's champion, spells and difficulty.
- The match clock waits while players load, so waves, gold and camps start when the match begins.
A match map played without a lobby, as in Play In Editor, seats each player who joins on the smaller team with the game mode's Default Champion and default spells, and fills the empty seats with bots.
The main menu's Champions and Settings
- Champions lists every champion on the Match Flow page: its portrait, its name, and the passive and four abilities with their keys.
- Settings is the same panel the match shows on Escape. Display and sound: graphics quality, window mode, VSync, master volume and HUD scale (75% to 150%). Camera: edge pan, edge pan speed (25% to 200%), whether a match starts with the camera locked, and Keep cursor in window. Casting: the cast mode of each ability key, Q, W, E, R, D and F, and whether the move key cancels an aim.
Everything saves to the player's GameUserSettings.ini and applies at once.
The maps
The framework ships two empty maps, /PioneerMOBA/Maps/L_MainMenu and /PioneerMOBA/Maps/L_Lobby, and the settings
name them by default.
- Menu map: set the project's Game Default Map to
L_MainMenuso the game opens on the menu. To use your own map, set its World Settings game mode toMobaMenuGameModeand name it as Menu Map. - Lobby map: nobody is spawned on it, so most projects keep
L_Lobby. - Match map: your level, such as Riftwood's
L_Riftwood, named as Match Map on the Match Flow page. It keeps its own game mode.
When a lobby opens, the server writes every setting that cannot work to its log (a missing map, champion select without
champions, bans that leave nothing to pick), in lines that start with
Project Settings > Pioneer MOBA Framework > Match Flow:.
Settings
| Page | What it holds |
|---|---|
| Front End | Menu Map and its game mode, the four screen classes, Accept Time (10 s), Bot Fill After (60 s), the Connector Class |
| Match Flow | Lobby Map, its game mode, Match Map, seamless travel, Match Rules, Auto Start Delay (10 s), Load Timeout (120 s), champion select on or off, the Champions list, Bans Per Team (1), the phase times (30, 60 and 10 s), Unique Picks (off), the Spell Pool and the bots' two spells, Fill With Bots, the bot difficulties; and the in-match settings for the kill feed, death recap, pings and surrender |
| UI | The HUD class, the theme, and the main menu's title |
The Champions list and the Match Map start as the sample's five champions and L_Riftwood. Name your own there: only
the champions in the list are offered in champion select and the Champions screen. See
Replace the sample's defaults. Champions, spells and bot difficulties travel over the network as their index in these lists, so a
server and its clients have to run the same settings.
Replace a screen
Each screen is a CommonUI activatable widget named on the Front End page: the main menu (which also shows Finding match and Match found), the lobby, champion select, and the loading screen (a plain User Widget, because it stays up across the map change). To replace one, make your own widget and name it there. The look of every screen comes from the theme; see HUD and theme.
A screen holds no state of its own. It reads UMobaFrontEndSubsystem (the state, the search clock, the notice, the
chat log, the loading view), the lobby's game state and the lobby player controller, and calls the subsystem
(FindMatch, StartPractice, HostCustomGame, JoinCustomGame, LeaveToMainMenu) and the player controller's
Server... functions (ServerTakeSeat, ServerAnswerReadyCheck, ServerHoverChampion, ServerLockChampion,
ServerSetSpell and the rest). The server decides; a request the rules refuse changes nothing.
The rules of the lobby and champion select are plain C++ with no engine objects (FMobaLobbyFlow,
FMobaChampionSelect, FMobaLoadGate), so you can read and test them on their own.
Reaching a server: the match connector
The menus never open a connection themselves. They talk to a UMobaMatchConnector, named on the Front End page.
UMobaSessionConnector, the default, finds games through the Online Subsystem and the matchmaking provider: Find match, Practice as a private lobby, and custom games by name or address.UMobaDirectConnectorneeds nothing but the engine: it opens lobbies on the player's own machine as a listen server and joins others by IP address. It cannot search, so Find match always hosts a new quick match.
To find games your own way, derive from UMobaMatchConnector: each function ends by travelling the player's game to a
lobby, or by broadcasting OnFailed with a text for the player.
Find match
Find match needs no backend. The connector asks a matchmaking provider for a game; the default,
UMobaSessionsMatchmaking, is a quick match over Unreal's sessions:
- It searches the open games of this project through the Online Subsystem. A project that configures none uses the Null subsystem, which finds games on the local network.
- It joins the open game with the most players that still has room, a dedicated server first. Games of another project, and custom games, are never found: every game advertises the project's name and its kind.
- With none, it advertises a new game, and the player's game opens a quick match lobby as a listen server.
- In the lobby, bots take every empty seat 60 s after the first player arrived, and the match is found.
When the match begins, the game is no longer advertised. Practice is never advertised. A custom game is advertised under its lobby name; Custom game > Join finds it by that name, or takes an IP address.
Dedicated servers advertise themselves the same way: a dedicated server that opens the lobby map with
?MobaKind=Quick (or Custom) creates the session itself, and again each time it opens the lobby after a match. See
Dedicated servers.
Steam and Epic Online Services go through the same Online Subsystem: enable the OnlineSubsystemSteam or
OnlineSubsystemEOS plugin and set [OnlineSubsystem] DefaultPlatformService=Steam (or EOS) with that subsystem's
settings in DefaultEngine.ini, as Epic's documentation describes; the framework's code does not change, and Find
match and Custom game sign the player in first (EOS needs it). In 1.0 Find match is tested on the local network
only. The Steam and EOS path is in the code but not yet tested; it comes tested in
1.1.
Project Settings > Pioneer MOBA Framework > Matchmaking:
| Setting | Default | What it does |
|---|---|---|
| Matchmaking Provider | UMobaSessionsMatchmaking | The class Find match asks for a game |
| Fallback To Sessions | off | When the provider's service does not answer, use the sessions quick match |
| Max Search Results | 50 | How many open games a search lists |
| Prefer Dedicated Servers | on | A dedicated server with room comes before a fuller player's game |
| Search Timeout | 10 s | How long a search may take |
| Game Name | the project's name | What games advertise and look for |
| Sample Adapter Url, Poll Interval, Request Timeout | http://localhost:8080, 1 s, 5 s | The sample HTTP adapter's service |
The player's region is in their own settings (UMobaUIPlayerSettings::SetRegion).
When something goes wrong
- The host quits while players wait: the others' games lose the connection and search again.
- Two players host at the same moment: both games stay open, and later searchers join the fuller one.
- The game that was found fills up first: Find match says so; press it again.
- The service does not answer: Find match says so and stops, or falls back to sessions.
The matchmaking hook
UMobaMatchmakingProvider is the interface for a real matchmaking service with skill-based queues and regions:
Queue(FMobaQueueRequest): the player's id, their Rating (from your service; the sessions quick match ignores it), their Region and their Party.Cancel(): leave the queue. Nothing is reported after it.OnMatchFound(FMobaMatchFound): the server address, and each player's team and slot where the service decides them. The player's game travels to the address.OnFailed(FText): a reason for the player. Find match shows it and stops; with Fallback To Sessions on, it tries the sessions quick match first.
Set your class as Matchmaking Provider and Find match uses it, with no menu changes.
The sample adapter
UMobaHttpMatchmaking talks HTTP and JSON to this contract:
| Request | Body | Answer |
|---|---|---|
POST {Url}/v1/queue | {"player": "...", "rating": 1500, "region": "eu-west", "party": ["..."]} | 200 {"ticket": "t1"} |
GET {Url}/v1/queue/{ticket} | 200 {"status": "waiting"} | |
200 {"status": "found", "server": "203.0.113.7:7777", "seats": [{"player": "...", "team": "Blue", "slot": 0}]} | ||
200 {"status": "failed", "reason": "..."} | ||
DELETE {Url}/v1/queue/{ticket} | 200, leaves the queue |
It asks for the ticket every Poll Interval. Any other answer, or none within Request Timeout, ends the search with "The
matchmaking service does not answer." To try it without a service of your own, the Net module has an in-memory mock,
FMobaMockMatchmakingService (PioneerMobaNet/Public/Tests/MobaMockMatchmaking.h), which answers the contract on a
port of your own machine and matches every two queued players of the same region whose ratings are within 100 of each
other.
Write an adapter for your own service
- In a module of your game that depends on
PioneerMobaNet, add a class derived fromUMobaMatchmakingProvider. - Override
Queue: send the request to your service and remember its ticket. OverrideCancelto leave the queue, andIsQueuedandGetNetworkName(what the menu shows, for example your service's name). - When your service has a match, broadcast
OnMatchFoundwith the server's address (host:port) and the seats. When it gives up or does not answer, broadcastOnFailedwith a text for the player. Broadcast exactly one of them perQueue, and nothing afterCancel. - Set your class in Project Settings > Pioneer MOBA Framework > Matchmaking > Matchmaking Provider.
- Test it against your service, or start from
UMobaHttpMatchmakingif your service can speak the contract above.
The lobby on the server seats players as they arrive. A server of your own that wants the service's seats reads them from its own copy of the match.
Console commands
Outside Shipping builds: Moba.Practice starts Practice from the main menu, as its button does.