Documentation

Did you find this helpful?

Monitoring Game Sessions

When having ongoing multiplayer game sessions, you might want to inspect certain details and check if anything is going wrong with the session. This guide explains how to gain in-depth information about each game session and monitor both logic flow and technical details.

Note: This guide assumes you already have a spinning Server and a working client for testing purposes. 

Techniques

Server instance has several options to report activity back to you. Writing PlayStream events is a good choice:

PlayFabServerAPI.WritePlayerEvent(
    new WriteServerPlayerEventRequest() {
        EventName = "player_killed_enemy",
        PlayFabId = playerId,
        Body = new Dictionary<string, object>() {
            {"EnemyType", "Goblin"},
            {"GameSessionId", "Some unique game session id"}
        }
    }, 
    result => { }, // Handle success 
    error=> { } // Handle error
);

You may include fields like "GameSessionId" so that you can search for events specific for this game session.

You may also bring all kinds of loggers on the table and utilize `-log_file_path` argument to log into a file. This file will become available once the session is terminated.

Finally, you may be creative and embed monitoring frameworks. Since the server is exposed via IPv4, you may create utility connections and transmit any monitoring data to a 3rd party service. This is, though, beyond the scope of this guide.

Crash Course

Let's briefly go through the techniques that are available out of the box. First, let's make sure we have a running server.

Once the server is running, you may navigate to "Multiplayer" left-menu (1), then to "Servers" tab (2). A table will open that contains all the server instances currently running. Server is uniquely described by an IPv4 address and ID (3). Each server runs for a specific region (4) and may be in several states (5) such as "Initializing" and "Running". If the number of running games (6) exceeds the "Max Games" (7) value, a new instance of the server will run to balance the workload. One server may run one version of the build (8).  Finally, we can check for the up-time and last-pinged time (9):

Next, let's see what the running game looks like. By default, no games are running. To ensure a running game, please have a client connect to your server. This will allocate new running game for that client. Once the last player disconnects, that allocated game will terminate in 2-3 minutes due to inactivity.

Navigate to "Active Games" subtab (1). A table will open with a list of all running games. Each game is uniquely described with the start time (2) and lobby information (3), which includes lobby ID and server configuration excerpt. Timeline (4) shows you how long the game is running for. Players column (5) shows the list of players participating in the game. Click each player ID to visit personal page of that player. Game mode column (6) is self-describing:

Additionally, you may click "Lobby Events" button to open Event History tool configured to show events for the current Lobby:

Next, please let your client disconnect from the server and wait for 2-3 minutes so that active game is terminated and archived.

Navigate to "Archived Games" tab (1). The result table (2) is almost identical to "Active Games" table. Let's focus on the only thing that is really different: "Log File" (3) and "Output Files" (4):

Click "Log File" to download the log file. It is not much different from any other log file you may have seen:

Info: Recieved 0 Title Data Keys 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Connection Timeout 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Log: connection {1} has been disconnected by timeout; address {::ffff:178.162.200.48:64480} 
Info: A Unity Client Disconnected 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Chat Server, A user Diconnected. 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Member found in channel General, Removing User. 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Info: Player Has Left:D829461E7664711D 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Info: No Connections were made, shutting down. 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Application.Quit Called Immediately After this message. 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) 
Setting up 1 worker threads for Enlighten. 
	Thread -> id: 718 -> priority: 1 

You may also download "Output files", which are arbitrary files constructed during the active game (ex. Replay Data).

This concludes a basic course on game sessions monitoring.



Did you find this helpful?