@startuml
'https://plantuml.com/sequence-diagram
actor "Player One" as Player1
actor "Player Two" as Player2
participant Matchmaker
participant Agones
participant "GameServer\nResource" as GameServer
box "Game Server Pod"
participant "Game Server\nProcess" as Binary
participant SDK
end box
activate GameServer
== No allocated GameServers ==
Player1 -> Matchmaker: Requests a game session
Matchmaker -> Agones: Create: GameServerAllocation
note left
GameServerAllocation implemented to
optionally select an already allocated GameServer
if one exists. At this stage, one does not, so
Agones will allocate a Ready GameServer.
end note
Agones -> GameServer: Finds a Ready GameServer,\nsets it to Allocated State
Matchmaker <-- Agones : GameServerAllocation is returned\nwith GameServer details\nincluding IP and port to connect to.
Player1 <-- Matchmaker : Returns GameServer connection information
Player1 -> Binary : Connects to game server process
Binary -> SDK : SDK.Alpha.PlayerConnect(id)
note right
Process calls PlayerConnect(...)
on player client connection.
end note
GameServer <-- SDK : Increments Status.Players.Count\nand add id to Status.Players.Ids
== Allocated GameServers with player(s) on them ==
Player2 -> Matchmaker: Requests a game session
Matchmaker -> Agones: Create: GameServerAllocation
note left
The GameServerAllocation will this time
find the Allocated GameServer that "Player One"
is currently active on.
end note
Agones -> GameServer: Finds the Allocated GameServer\nwith player capacity.
note right
This is the same GameServer that "Player One"
is currently playing on.
end note
Matchmaker <-- Agones: returns Allocated GameServer record
Player2 <-- Matchmaker : Returns GameServer connection information
Player2 -> Binary : Connects to game server process
Binary -> SDK : SDK.Alpha.PlayerConnect(id)
GameServer <-- SDK : Increments Status.Players.Count\nand add id to Status.Players.Ids
@enduml