spectatorbeacon.DelayCancellationResponse

spectatorbeacon.DelayCancellationResponse

#Overview

name: spectatorbeacon.DelayCancellationResponse

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 spectatorbeacon.DelayCancellationResponse is to introduce a delay between receiving a cancellation response and notifying the system about it in the context of spectator beacons in Unreal Engine 5’s online subsystem.

This setting variable is primarily used in the Online Subsystem Utils plugin, specifically in the Spectator Beacon and Party Beacon systems. These systems are part of Unreal Engine’s networking and multiplayer functionality.

The value of this variable is set as a console variable, which means it can be adjusted at runtime. It is defined in the SpectatorBeaconConsoleVariables namespace and initialized with a default value of 0.0f.

This variable interacts with its associated variable CVarDelayCancellationResponse, which is used in both the SpectatorBeaconClient and PartyBeaconClient classes. They share the same purpose but are used in different contexts (spectator beacons vs. party beacons).

Developers must be aware that this variable is only effective in non-shipping builds (#if !UE_BUILD_SHIPPING). In shipping builds, the delay is always set to 0.0f, regardless of the console variable’s value.

Best practices when using this variable include:

  1. Use it for debugging and testing purposes only, as it artificially delays responses.
  2. Be cautious when setting high delay values, as it may impact the user experience and game responsiveness.
  3. Remember to reset it to 0.0f or remove any usage before shipping the game.

Regarding the associated variable CVarDelayCancellationResponse: Its purpose is similar to spectatorbeacon.DelayCancellationResponse but is used in the context of party beacons. It’s defined in the BeaconConsoleVariables namespace and is used in the PartyBeaconClient class. The usage and best practices are the same as for the spectator beacon variable, with the primary difference being the system it affects (party beacons instead of spectator beacons).

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    SpectatorBeaconConsoleVariables

Source code excerpt:

	/** 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")
		TEXT("Time in secs"),
		ECVF_Default);

	/** Time to delay delegates firing a reservation update response */

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    BeaconConsoleVariables

Source code excerpt:

		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")
		TEXT("Time in secs"),
		ECVF_Default);

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

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

Scope (from outer to inner):

file
function     void APartyBeaconClient::ClientCancelReservationResponse_Implementation

Source code excerpt:

	ensure(bCancelReservation);

	// Clear out any pending response handling (including failsafe timer)
	ClearTimers(false);
#if !UE_BUILD_SHIPPING	
	const float Rate = BeaconConsoleVariables::CVarDelayCancellationResponse.GetValueOnGameThread();
#else
	const float Rate = 0.0f;
#endif
	if (Rate > 0.0f)
	{
		UE_LOG(LogPartyBeacon, Verbose, TEXT("Party beacon cancellation response received %s, waiting %fs to notify"), EPartyReservationResult::ToString(ReservationResponse), Rate);

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

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

Scope (from outer to inner):

file
namespace    SpectatorBeaconConsoleVariables

Source code excerpt:

		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")
		TEXT("Time in secs"),
		ECVF_Default);

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

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

Scope (from outer to inner):

file
function     void ASpectatorBeaconClient::ClientCancelReservationResponse_Implementation

Source code excerpt:

	ensure(bCancelReservation);

	// Clear out any pending response handling (including failsafe timer)
	ClearTimers(false);
#if !UE_BUILD_SHIPPING	
	const float Rate = SpectatorBeaconConsoleVariables::CVarDelayCancellationResponse.GetValueOnGameThread();
#else
	const float Rate = 0.0f;
#endif
	if (Rate > 0.0f)
	{
		UE_LOG(LogSpectatorBeacon, Verbose, TEXT("Spectator beacon cancellation response received %s, waiting %fs to notify"), ESpectatorReservationResult::ToString(ReservationResponse), Rate);

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