beacon.DelayFullResponse

beacon.DelayFullResponse

#Overview

name: beacon.DelayFullResponse

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.DelayFullResponse is to introduce a delay between receiving a full 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 the game.

This setting variable is relied upon by the Online Subsystem Utils plugin, specifically within the party and spectator beacon systems. These beacons are used for managing multiplayer game sessions and spectator connections.

The value of this variable is set through the Unreal Engine console variable system. It can be modified at runtime using console commands or through configuration files.

The associated variable CVarDelayFullResponse interacts directly with beacon.DelayFullResponse. They share the same value and purpose.

Developers must be aware that:

  1. This variable is only effective in non-shipping builds (#if !UE_BUILD_SHIPPING).
  2. The delay is measured in seconds.
  3. When set to a value greater than 0, it introduces an artificial delay in notifying clients about full reservations.

Best practices when using this variable include:

  1. Use it only for debugging and testing purposes.
  2. Keep the value at 0 for production builds to ensure responsive user experience.
  3. When testing, use reasonable delay values to simulate network conditions or server processing time.

Regarding the associated variable CVarDelayFullResponse:

The purpose of CVarDelayFullResponse is to provide a programmatic interface to the beacon.DelayFullResponse console variable within the C++ code. It allows the code to read and apply the delay value set by the console variable.

This variable is used in both the PartyBeaconClient and SpectatorBeaconClient classes to implement the delay functionality. It’s accessed using the GetValueOnGameThread() method to retrieve the current delay value.

The value of CVarDelayFullResponse is set automatically by the console variable system when beacon.DelayFullResponse is modified.

Developers should be aware that:

  1. This variable is of type TAutoConsoleVariable, which means it’s automatically synchronized with the console variable system.
  2. It’s defined within namespace scopes (BeaconConsoleVariables and SpectatorBeaconConsoleVariables) to avoid naming conflicts.

Best practices for using CVarDelayFullResponse include:

  1. Access it only in non-shipping builds to avoid unnecessary overhead in production.
  2. Use it consistently across related beacon systems (party and spectator) to maintain uniform behavior.
  3. Consider wrapping access to this variable in a helper function to centralize its usage and make it easier to modify or remove in the future if needed.

#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:37

Scope (from outer to inner):

file
namespace    BeaconConsoleVariables

Source code excerpt:

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

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    BeaconConsoleVariables

Source code excerpt:

		TEXT("Delay time between received update response and notification\n")
		TEXT("Time in secs"),
		ECVF_Default);

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

	/** Whether to restrict party reservation RPCs to require that the initiator is the party leader. */
	TAutoConsoleVariable<bool> CVarRequireInitiatorIsPartyLeader(
		TEXT("beacon.RequireInitiatorIsPartyLeader"),
		true,

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

Scope (from outer to inner):

file
function     void APartyBeaconClient::ClientSendReservationFull_Implementation

Source code excerpt:

void APartyBeaconClient::ClientSendReservationFull_Implementation()
{
	if (!bCancelReservation)
	{
#if !UE_BUILD_SHIPPING
		const float Rate = BeaconConsoleVariables::CVarDelayFullResponse.GetValueOnGameThread();
#else
		const float Rate = 0.0f;
#endif
		if (Rate > 0.0f)
		{
			UE_LOG(LogPartyBeacon, Verbose, TEXT("Party beacon reservations full, waiting %fs to notify"), Rate);

			FTimerDelegate TimerDelegate;
			TimerDelegate.BindLambda([this]()
			{
				ProcessReservationFull();

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

Scope (from outer to inner):

file
namespace    SpectatorBeaconConsoleVariables

Source code excerpt:

		TEXT("Delay time between received update response and notification\n")
		TEXT("Time in secs"),
		ECVF_Default);

	/** Time to delay delegates firing a reservation full response */
	TAutoConsoleVariable<float> CVarDelayFullResponse(
		TEXT("spectatorbeacon.DelayFullResponse"),
		0.0f,
		TEXT("Delay time between received full response and notification\n")
		TEXT("Time in secs"),
		ECVF_Default);
}
#endif

/** Max time to wait for a response from the server for CancelReservation */
#define CANCEL_FAILSAFE 5.0f

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

Scope (from outer to inner):

file
function     void ASpectatorBeaconClient::ClientSendReservationFull_Implementation

Source code excerpt:

void ASpectatorBeaconClient::ClientSendReservationFull_Implementation()
{
	if (!bCancelReservation)
	{
#if !UE_BUILD_SHIPPING
		const float Rate = SpectatorBeaconConsoleVariables::CVarDelayFullResponse.GetValueOnGameThread();
#else
		const float Rate = 0.0f;
#endif
		if (Rate > 0.0f)
		{
			UE_LOG(LogSpectatorBeacon, Verbose, TEXT("Spectator beacon reservations full, waiting %fs to notify"), Rate);

			FTimerDelegate TimerDelegate;
			TimerDelegate.BindLambda([this]()
			{
				ProcessReservationFull();