ASpectatorBeaconHost

A beacon host used for taking reservations for an existing game session

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

OnlineSubsystemUtils

Header

/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/SpectatorBeaconHost.h

Include

#include "SpectatorBeaconHost.h"

Syntax

UCLASS(Transient, NotPlaceable, Config=Engine)
class ASpectatorBeaconHost : public AOnlineBeaconHostObject

Remarks

A beacon host used for taking reservations for an existing game session

Variables

Name Description

Protected variable UProperty Config

bool

 

bLogoutOnSessionTimeout

Do the timeouts below cause a player to be removed from the reservation list

Protected variable

FOnCancelationR...

 

CancelationReceived

Delegate fired when the beacon indicates a reservation cancellation

Protected variable

FOnSpectatorDup...

 

DuplicateReservation

Delegate fired when the beacon detects a duplicate reservation

Protected variable

FOnNewPlayerAdd...

 

NewPlayerAddedDelegate

Delegate fired when reservation has been added

Protected variable

FOnReservationU...

 

ReservationChanged

Delegate fired when the beacon indicates a reservation add/remove

Protected variable

FOnReservationU...

 

ReservationsFull

Delegate fired when the beacon indicates all reservations are taken

Protected variable UProperty Transient, Config

float

 

SessionTimeoutSecs

Seconds that can elapse before a reservation is removed due to player not being registered with the session

Protected variable UProperty

TObjectPtr< USp...

 

State

State of the beacon

Protected variable UProperty Transient, Config

float

 

TravelSessionTimeoutSecs

Seconds that can elapse before a reservation is removed due to player not being registered with the session during a travel

Protected variable

FOnSpectatorVal...

 

ValidatePlayers

Delegate fired when asking the beacon owner if this reservation is legit

Constructors

Name Description

Public function

ASpectatorBeaconHost

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Virtual

ESpectatorRe...

 

AddSpectatorReservation

(
    const FSpectatorReservation& Reser...
)

Attempts to add a spectator reservation to the beacon

Protected function Const

bool

 

DoesSessionMatch

(
    const FString& SessionId
)

Does the session match the one associated with this beacon

Public function Virtual Const

void

 

DumpReservations()

Output current state of reservations to log

Public function Virtual Const

int32

 

GetMaxReservations()

Get the maximum number of reservations allowed inside the beacon

Public function Virtual Const

int32

 

GetNumConsumedReservations()

Get the number of reservations actually used/consumed across all parties inside the beacon

Public function Virtual Const

bool

 

GetPlayerValidation

(
    const FUniqueNetId& PlayerId,
    FString& OutValidation
)

Obtain player validation string from spectator reservation entry

Public function Virtual Const

int32

 

GetReservationCount()

Get the current reservation count inside the beacon

Protected function Virtual Const

TSubclassOf<...

 

GetSpectatorBeaconHostClass()

Public function Const

USpectatorBe...

 

GetState()

Public function Virtual

void

 

HandlePlayerLogout

(
    const FUniqueNetIdRepl& PlayerId
)

Notify the beacon of a player logout

Public function Virtual

bool

 

InitFromBeaconState

(
    USpectatorBeaconState* PrevSta...
)

Initialize the spectator host beacon from a previous state/configuration all existing reservations and configuration values are preserved

Public function Virtual

bool

 

InitHostBeacon

(
    int32 InMaxReservations,
    FName InSessionName
)

Initialize the spectator host beacon

Protected function

void

 

NewPlayerAdded

(
    const FPlayerReservation& NewPlaye...
)

Handle a newly added player

Protected function

void

 

NotifyReservationEventNextFrame

(
    FOnReservationUpdate& ReservationE...
)

Public function

FOnCancelati...

 

OnCancelationReceived()

Delegate fired when a the beacon host cancels a reservation

Public function

FOnSpectator...

 

OnDuplicateReservation()

Delegate fired when a the beacon detects a duplicate reservation

Public function

FOnNewPlayer...

 

OnNewPlayerAdded()

Delegate fired when the beacon host adds a new player

Public function

FOnReservati...

 

OnReservationChanged()

Delegate fired when a the beacon host detects that all reservations are full

Public function

FOnReservati...

 

OnReservationsFull()

Crossplay Delegate fired when a the beacon host detects a reservation addition/removal

Public function

FOnSpectator...

 

OnValidatePlayers()

Delegate called when the beacon gets any request, allowing the owner to validate players at a higher level (bans,etc)

Public function Virtual Const

bool

 

PlayerHasReservation

(
    const FUniqueNetId& PlayerId
)

Does a given player id have an existing reservation

Public function Virtual

void

 

ProcessCancelReservationRequest

(
    ASpectatorBeaconClient* Client,
    const FUniqueNetIdRepl& Spectator
)

Handle a reservation cancellation request received from an incoming client

Public function Virtual

void

 

ProcessReservationRequest

(
    ASpectatorBeaconClient* Client,
    const FString& SessionId,
    const FSpectatorReservation& Reser...
)

Handle a reservation request received from an incoming client

Public function

void

 

RegisterAuthTicket

(
    const FUniqueNetIdRepl& InSpectato...,
    const FString& InAuthTicket
)

Register user auth ticket with the reservation system Must have an existing reservation entry

Public function Virtual

ESpectatorRe...

 

RemoveSpectatorReservation

(
    const FUniqueNetIdRepl& Spectator
)

Attempts to remove a spectator reservation from the beacon

Protected function

void

 

SendReservationUpdates()

Update clients with current reservation information

Overridden from AActor

Name Description

Public function Virtual

void

 

Tick

(
    float DeltaSeconds
)

Function called every frame on this Actor.

Overridden from UObject

Name Description

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.