The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

UE3:MeshBeaconHost (UDK)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UDK Object >> MeshBeacon >> MeshBeaconHost
Package: 
IpDrv

This class is used to handle connections from client mesh beacons in order to establish a mesh network.

Properties[edit]

bAllowBandwidthTesting[edit]

Type: bool

Modifiers: private

TRUE if new bandwidth test requests should be handled. Set to false to ignore any pending and new requests.

Default value: True

ClientConnections[edit]

Type: array<ClientMeshBeaconConnection>

Modifiers: const

The object that is used to send/receive data with the remote host/client

ConnectionBacklog[edit]

Type: int

Modifiers: config

The number of connections to allow before refusing them

OwningPlayerId[edit]

Type: OnlineSubsystem.UniqueNetId

Modifiers: const

Net Id of player that is hosting this beacon

PendingPlayerConnections[edit]

Type: array<OnlineSubsystem.UniqueNetId>

Modifiers: private

List of players this beacon is waiting to establish connections to.

Structs[edit]

ClientConnectionBandwidthTestData[edit]

Modifiers: native

Stats stored for the current bandwidth test on a client connection

MeshBeacon.EMeshBeaconBandwidthTestState CurrentState 
Current progress of bandwidth test. Only one client should be MB_BandwidthTestState_InProgress at a time.
MeshBeacon.EMeshBeaconBandwidthTestType TestType 
Type of bandwidth test currently running
int BytesTotalNeeded 
Total bytes needed to complete the test
int BytesReceived 
Total bytes received by the client so far
Object.double RequestTestStartTime 
Time when request was first sent to client to start the test
Object.double TestStartTime 
Time when first response was received from client to being the test
MeshBeacon.ConnectionBandwidthStats BandwidthStats 
Resulting stats from the bandwidth test

ClientMeshBeaconConnection[edit]

Modifiers: native

Holds the information for a client and whether they've timed out

OnlineSubsystem.UniqueNetId PlayerNetId 
The unique id of the player for this connection
float ElapsedHeartbeatTime 
How long it's been since the last heartbeat
pointer{FSocket} Socket 
The socket this client is communicating on
bool bConnectionAccepted 
True if the client connection has already been accepted for this player
ClientConnectionBandwidthTestData BandwidthTest 
Bandwidth test being run for the client
OnlineSubsystem.ENATType NatType 
The NAT of the client as reported by the client
bool bCanHostVs 
TRUE if the client is able to host a vs match
float GoodHostRatio 
Ratio of successful vs unsuccessful matches hosted by this client in the past
array<MeshBeacon.ConnectionBandwidthStats> BandwidthHistory 
Previous bandwidth history reported by the client ordered from newest to oldest.

New bandwidth tests that occur on this host also get added to this history.

int MinutesSinceLastTest 
Elapsed time in minutes since the last bandwidth test

Delegates[edit]

OnAllPendingPlayersConnected[edit]

delegate OnAllPendingPlayersConnected ()

Delegate called by the host mesh beacon when all players in the PendingPlayerConnections list get connections.

OnFinishedBandwidthTest[edit]

delegate OnFinishedBandwidthTest (OnlineSubsystem.UniqueNetId PlayerNetId, MeshBeacon.EMeshBeaconBandwidthTestType TestType, MeshBeacon.EMeshBeaconBandwidthTestResult TestResult, const out MeshBeacon.ConnectionBandwidthStats BandwidthStats)

Delegate called by the host mesh beacon when bandwidth testing has completed for a client connection. This occurs when the test completes successfully or due to error/timeout.

Parameters:

  • PlayerNetId - net id for player of client connection that finished the test
  • TestType - test that completed based on enum of EMeshBeaconBandwidthTestType supported bandwidth test types
  • TestResult - overall result from running the test
  • BandwidthStats - statistics and timing information from running the test

OnReceivedClientConnectionRequest[edit]

delegate OnReceivedClientConnectionRequest (const out ClientMeshBeaconConnection NewClientConnection)

Delegate called by the host mesh beacon after establishing a new client socket and receiving the data for a new connection request.

Parameters:

  • NewClientConnection - client that sent the request for a new connection

OnReceivedClientCreateNewSessionResult[edit]

delegate OnReceivedClientCreateNewSessionResult (bool bSucceeded, name SessionName, class<OnlineGameSearchSearchClass, const out byte PlatformSpecificInfo[68])

Delegate called by the host mesh beacon when it gets the results of a new game session creation on a client.

Parameters:

  • bSucceeded - TRUE if the the new session was created on the client
  • SessionName - the name of the session to create
  • SearchClass - the search that should be with corresponding game settings when creating the session
  • PlatformSpecificInfo - the platform specific binary data of the new session

OnStartedBandwidthTest[edit]

delegate OnStartedBandwidthTest (OnlineSubsystem.UniqueNetId PlayerNetId, MeshBeacon.EMeshBeaconBandwidthTestType TestType)

Delegate called by the host mesh beacon when bandwidth testing has started for a client connection. This occurs only when the client sends the start packet to initiate the test.

Parameters:

  • PlayerNetId - net id for player of client connection that started the test
  • TestType - test to run based on enum of EMeshBeaconBandwidthTestType supported bandwidth test types

Functions[edit]

Native functions[edit]

DestroyBeacon[edit]

native event DestroyBeacon ()

Overrides: MeshBeacon.DestroyBeacon

Stops listening for clients and releases any allocated memory

AllPlayersConnected[edit]

native function bool AllPlayersConnected (const out array<OnlineSubsystem.UniqueNetIdPlayers)

Determine if the players all have connections on this host beacon

Parameters:

  • Players - list of player ids we are searching for

Returns:

TRUE if all players had connections

CancelInProgressBandwidthTests[edit]

native function CancelInProgressBandwidthTests ()

Cancel any bandwidth tests that are already in progress.

CancelPendingBandwidthTests[edit]

native function CancelPendingBandwidthTests ()

Cancel any bandwidth tests that are pending.

GetConnectionIndexForPlayer[edit]

native function int GetConnectionIndexForPlayer (OnlineSubsystem.UniqueNetId PlayerNetId)

Determine if the given player has an active connection on this host beacon.

Parameters:

  • PlayerNetId - player we are searching for

Returns:

index within ClientConnections for the player's connection, -1 if not found

HasInProgressBandwidthTest[edit]

native function bool HasInProgressBandwidthTest ()

Determine if a client is currently running a bandwidth test.

Returns:

TRUE if a client connection is currently running a bandwidth test

HasPendingBandwidthTest[edit]

native function bool HasPendingBandwidthTest ()

Determine if a client is currently waiting/pending for a bandwidth test.

Returns:

TRUE if a client connection is currently pending a bandwidth test

InitHostBeacon[edit]

native function bool InitHostBeacon (OnlineSubsystem.UniqueNetId InOwningPlayerId)

Creates a listening host mesh beacon to accept new client connections.

Parameters:

  • InOwningPlayerId - Net Id of player that is hosting this beacon

Returns:

true if the beacon was created successfully, false otherwise

RequestClientBandwidthTest[edit]

native function bool RequestClientBandwidthTest (OnlineSubsystem.UniqueNetId PlayerNetId, MeshBeacon.EMeshBeaconBandwidthTestType TestType, int TestBufferSize)

Send a request to a client connection to initiate a new bandwidth test.

Parameters:

  • PlayerNetId - player with an active connection to receive test request
  • TestType - EMeshBeaconBandwidthTestType type of bandwidth test to request
  • TestBufferSize - size of buffer in bytes to use for running the test

Returns:

TRUE if the request was successfully sent to the client

RequestClientCreateNewSession[edit]

native function bool RequestClientCreateNewSession (OnlineSubsystem.UniqueNetId PlayerNetId, name SessionName, class<OnlineGameSearchSearchClass, const out array<MeshBeacon.PlayerMemberPlayers)

Sends a request to a specified client to create a new game session.

Parameters:

  • PlayerNetId - net id of player for client connection to send request to
  • SessionName - the name of the session to create
  • SearchClass - the search that should be with corresponding game settings when creating the session
  • Players - list of players to register on the newly created session

TellClientsToTravel[edit]

native function TellClientsToTravel (name SessionName, class<OnlineGameSearchSearchClass, const out byte PlatformSpecificInfo[68])

Tells all of the clients to go to a specific session (contained in platform specific info). Used to route all clients to one destination.

Parameters:

  • SessionName - the name of the session to register
  • SearchClass - the search that should be populated with the session
  • PlatformSpecificInfo - the binary data to place in the platform specific areas

Other instance functions[edit]

AllowBandwidthTesting[edit]

function AllowBandwidthTesting (bool bEnabled)

Enable/disable future bandwidth test requests and current pending tests.

Parameters:

  • bEnabled - true to allow bandwidth testing to be processed by the beacon

DebugRender[edit]

function DebugRender (Canvas Canvas, OnlineSubsystem.UniqueNetId CurOptimalHostId)

Render debug info about the client mesh beacon

Parameters:

  • Canvas - canvas object to use for rendering debug info
  • CurOptimalHostId - net id of player that should be highlighted as the current optimal host

DumpConnections[edit]

function DumpConnections ()

Logs the all the connected clients of this this beacon

SetPendingPlayerConnections[edit]

function SetPendingPlayerConnections (const out array<OnlineSubsystem.UniqueNetIdPlayers)

Set list of pending player ids we are waiting to connect with. Once all connections are established then the OnAllPendingPlayersConnected delegate is called.

Parameters:

  • Players - list of player ids we are waiting to connect