永続的なセッションを設定する
Overview
AccelByte Gaming Services (AGS) Session features the ability to create persistent sessions. Persistent sessions ensure that sessions remain active during events such as player absences, dedicated server crashes, or session timeouts, among others.
For example, in survival games, servers frequently operate continuously to accommodate the constant flow of players entering and exiting. However, extended periods of dedicated server operation often result in performance degradation. While dedicated servers perform optimally with continuous operation, maintaining consistent performance is essential. Game developers require a solution that ensures uninterrupted 24/7 session availability for players while maximizing dedicated server performance.
How it works
The persistent session configuration cannot be modified dynamically. It adheres strictly to the persistent configuration set during initialization when the template is configured.
Here's a flowchart showing how persistent sessions work in AGS.
Here are some considerations regarding persistent sessions:
- The Session service keeps player history in the session for 24 hours (default) before removing the player from the list. The data size will increase with the growing list of players, potentially affecting query performance. To prevent that, AccelByte recommends limiting the number of active players in a session.
- It's important to manage server lifecycle to lower the likelihood of the dedicated servers experiencing performance degradation or hanging.
Configure a persistent session in the Admin Portal
It's essential to delete the persistent session when it's not actively in use. Extended periods of inactivity can lead to significant resource consumption, as the session may repeatedly spawn dedicated servers over several days or even months.
On the Admin Portal sidebar, go to Multiplayer > Matchmaking > Session Configuration.
Under the Session Template tab, click + Add Session Template. A pop-up menu will appear for adding the new session template.
Within the Add Session Template creation, populate the Session Type field and select DS - AMS or DS - Armada (Deprecated) from the options.
Toggle the Set as Persistent to enable this template for persistent sessions.
Click the Add button to finalize the creation of the session template.
Persistent sessions with AccelByte Multiplayer Servers
AccelByte Multiplayer Servers (AMS) is AccelByte's dynamic dedicated server management offering. If you're using AMS for your dedicated server management needs, you'll need to extend the session duration by periodically resetting the session timeout for the server to prevent it from being automatically cleaned up after the configured period.
With the SDK
If you've integrated your dedicated server with AMS using the AGS Game SDK, you should make use of the ResetDSTimeout
function.
- Unreal
- Unreal OSS
- Unity
FRegistry::ServerAMS.ResetDSTimeout();
SessionInterface->ResetServerTimeout();
AccelByteSDK.GetServerRegistry().GetAMS().ResetDSTimeout();
Without the SDK
Alternatively, if your dedicated server is integrated with AMS outside of the AGS Game SDK, it should directly send a reset_session_timeout
message to the watchdog over a websocket connection. See AMS watchdog protocol for more information.