beacon.DelayReservationResponse

beacon.DelayReservationResponse

#Overview

name: beacon.DelayReservationResponse

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of beacon.DelayReservationResponse is to introduce a delay between receiving a reservation response and notifying the client in the party and spectator beacon systems. This setting is primarily used for debugging and testing purposes in non-shipping builds of Unreal Engine.

This setting variable is utilized by the Online Subsystem Utils plugin, specifically within the party and spectator beacon systems. These systems are responsible for managing player reservations and spectator slots in multiplayer games.

The value of this variable is set through the Unreal Engine console or configuration files. It’s defined as a TAutoConsoleVariable, which allows it to be changed at runtime.

The associated variable CVarDelayReservationResponse directly interacts with beacon.DelayReservationResponse. They share the same value and purpose, with CVarDelayReservationResponse being the actual C++ variable used in the code.

Developers must be aware that this variable is only active in non-shipping builds (#if !UE_BUILD_SHIPPING). In shipping builds, the delay is always set to 0.0f. This variable affects the responsiveness of the reservation system, so it should be used carefully during development and testing.

Best practices when using this variable include:

  1. Only use it for debugging and testing purposes.
  2. Reset it to 0.0f before building for release.
  3. Be cautious when setting high delay values, as it may negatively impact the user experience.
  4. Use in conjunction with logging (UE_LOG) to track reservation responses during development.

Regarding the associated variable CVarDelayReservationResponse:

The purpose of CVarDelayReservationResponse is to provide a programmatic interface to the beacon.DelayReservationResponse setting. It’s used within the C++ code to retrieve the current delay value and apply it to the reservation response system.

This variable is used in both the PartyBeaconClient and SpectatorBeaconClient classes, which are part of the Online Subsystem Utils plugin. It’s specifically used in the ClientReservationResponse_Implementation functions of these classes.

The value of CVarDelayReservationResponse is set through the beacon.DelayReservationResponse console variable. It’s accessed in the code using the GetValueOnGameThread() method.

CVarDelayReservationResponse directly interacts with beacon.DelayReservationResponse, as they represent the same setting in different contexts (console variable and C++ variable).

Developers should be aware that this variable is wrapped in #if !UE_BUILD_SHIPPING preprocessor directives, meaning it’s only available in non-shipping builds. In shipping builds, the delay is always 0.0f.

Best practices for using CVarDelayReservationResponse include:

  1. Use it for debugging and testing network behavior in development builds.
  2. Ensure all code referencing this variable is properly wrapped in #if !UE_BUILD_SHIPPING directives.
  3. Consider adding additional logging or debugging features when this variable is set to a non-zero value to make the most of the introduced delay.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconClient.cpp:13

Scope (from outer to inner):

file
namespace    BeaconConsoleVariables

Source code excerpt:

	/** Time to delay delegates firing a reservation request response */
	TAutoConsoleVariable<float> CVarDelayReservationResponse(
		TEXT("beacon.DelayReservationResponse"),
		0.0f,
		TEXT("Delay time between received response and notification\n")
		TEXT("Time in secs"),
		ECVF_Default);

	/** Time to delay delegates firing a cancel reservation request response */

#Associated Variable and Callsites

This variable is associated with another variable named CVarDelayReservationResponse. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconClient.cpp:9

Scope (from outer to inner):

file
namespace    BeaconConsoleVariables

Source code excerpt:


namespace BeaconConsoleVariables
{
#if !UE_BUILD_SHIPPING
	/** Time to delay delegates firing a reservation request response */
	TAutoConsoleVariable<float> CVarDelayReservationResponse(
		TEXT("beacon.DelayReservationResponse"),
		0.0f,
		TEXT("Delay time between received response and notification\n")
		TEXT("Time in secs"),
		ECVF_Default);

	/** Time to delay delegates firing a cancel reservation request response */
	TAutoConsoleVariable<float> CVarDelayCancellationResponse(
		TEXT("beacon.DelayCancellationResponse"),
		0.0f,
		TEXT("Delay time between received cancel response and notification\n")

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconClient.cpp:485

Scope (from outer to inner):

file
function     void APartyBeaconClient::ClientReservationResponse_Implementation

Source code excerpt:

void APartyBeaconClient::ClientReservationResponse_Implementation(EPartyReservationResult::Type ReservationResponse)
{
	if (!bCancelReservation)
	{
#if !UE_BUILD_SHIPPING
		const float Rate = BeaconConsoleVariables::CVarDelayReservationResponse.GetValueOnGameThread();
#else
		const float Rate = 0.0f;
#endif
		if (Rate > 0.0f)
		{
			UE_LOG(LogPartyBeacon, Verbose, TEXT("Party beacon response received %s, waiting %fs to notify"), EPartyReservationResult::ToString(ReservationResponse), Rate);

			FTimerDelegate TimerDelegate;
			TimerDelegate.BindLambda([this, ReservationResponse]()
			{
				ProcessReservationResponse(ReservationResponse);

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/SpectatorBeaconClient.cpp:9

Scope (from outer to inner):

file
namespace    SpectatorBeaconConsoleVariables

Source code excerpt:


#if !UE_BUILD_SHIPPING
namespace SpectatorBeaconConsoleVariables
{
	/** Time to delay delegates firing a reservation request response */
	TAutoConsoleVariable<float> CVarDelayReservationResponse(
		TEXT("spectatorbeacon.DelayReservationResponse"),
		0.0f,
		TEXT("Delay time between received response and notification\n")
		TEXT("Time in secs"),
		ECVF_Default);

	/** Time to delay delegates firing a cancel reservation request response */
	TAutoConsoleVariable<float> CVarDelayCancellationResponse(
		TEXT("spectatorbeacon.DelayCancellationResponse"),
		0.0f,
		TEXT("Delay time between received cancel response and notification\n")

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/SpectatorBeaconClient.cpp:294

Scope (from outer to inner):

file
function     void ASpectatorBeaconClient::ClientReservationResponse_Implementation

Source code excerpt:

void ASpectatorBeaconClient::ClientReservationResponse_Implementation(ESpectatorReservationResult::Type ReservationResponse)
{
	if (!bCancelReservation)
	{
#if !UE_BUILD_SHIPPING
		const float Rate = SpectatorBeaconConsoleVariables::CVarDelayReservationResponse.GetValueOnGameThread();
#else
		const float Rate = 0.0f;
#endif
		if (Rate > 0.0f)
		{
			UE_LOG(LogSpectatorBeacon, Verbose, TEXT("Spectator beacon response received %s, waiting %fs to notify"), ESpectatorReservationResult::ToString(ReservationResponse), Rate);

			FTimerDelegate TimerDelegate;
			TimerDelegate.BindLambda([this, ReservationResponse]()
			{
				ProcessReservationResponse(ReservationResponse);