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

UE3:PartyBeaconHost (UDK)

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

This class is used to create a network accessible beacon for responding to reservation requests for party matches. It handles all tracking of who has reserved space, how much space is available, and how many parties can reserve space.

Properties

bBestFitTeamAssignment

Type: bool

Force new reservations to teams with the smallest accommodating need size, otherwise team assignment is random

Clients

Type: array<ClientBeaconConnection>

Modifiers: const

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

ConnectionBacklog

Type: int

Modifiers: config

The number of connections to allow before refusing them

NumConsumedReservations

Type: int

Modifiers: const

The number of slots that have been consumed by parties in total (saves having to iterate and sum)

NumPlayersPerTeam

Type: int

Modifiers: const

The number of players required for a full team

NumReservations

Type: int

Modifiers: const

The number of players that are allowed to reserve space

NumTeams

Type: int

Modifiers: const

The number of teams that these players will be divided amongst

OnlineSessionName

Type: name

The online session name that players will register with

Reservations

Type: array<PartyBeacon.PartyReservation>

Modifiers: const

The list of accepted reservations

ReservedHostTeamNum

Type: int

Modifiers: const

The team the host (owner of the beacon) is assigned to when random teams are chosen

Structs

ClientBeaconConnection

Modifiers: native

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

OnlineSubsystem.UniqueNetId PartyLeader 
The unique id of the party leader for this connection
float ElapsedHeartbeatTime 
How long it's been since the last heartbeat
pointer{FSocket} Socket 
The socket this client is communicating on

Delegates

OnClientCancellationReceived

delegate OnClientCancellationReceived (OnlineSubsystem.UniqueNetId PartyLeader)

Called by the beacon when a client cancels a reservation

Parameters:

  • PartyLeader - the party leader that is cancelling the reservation

OnReservationChange

delegate OnReservationChange ()

Called by the beacon when a reservation occurs or is cancelled so that UI can be updated, etc.

OnReservationsFull

delegate OnReservationsFull ()

Called by the beacon when all of the available reservations have been filled

Functions

Native functions

DestroyBeacon

native event DestroyBeacon ()

Overrides: PartyBeacon.DestroyBeacon

Stops listening for clients and releases any allocated memory

AddPartyReservationEntry

native function PartyBeacon.EPartyReservationResult AddPartyReservationEntry (OnlineSubsystem.UniqueNetId PartyLeader, const out array<PartyBeacon.PlayerReservationPlayerMembers, int TeamNum, bool bIsHost)

Add a new party to the reservation list. Avoids adding duplicate entries based on party leader.

Parameters:

  • PartyLeader - the party leader that is adding the reservation
  • PlayerMembers - players (including party leader) being added to the reservation
  • TeamNum - team assignment of the new party
  • bIsHost - treat the party as the game host

Returns:

EPartyReservationResult similar to a client update request

AppendReservationSkillsToSearch

native function AppendReservationSkillsToSearch (OnlineGameSearch Search)

Appends the skills from all reservations to the search object so that they can be included in the search information

Parameters:

  • Search - the search object to update

GetMaxAvailableTeamSize

native function int GetMaxAvailableTeamSize ()

Determine the maximum team size that can be accommodated based on the current reservation slots occupied.

Returns:

maximum team size that is currently available

HandlePlayerLogout

native function HandlePlayerLogout (OnlineSubsystem.UniqueNetId PlayerId, bool bMaintainParty)

Called when a player logs out of the current game. The player's party reservation entry is freed up so that a new reservation request can be accepted.

Parameters:

  • PlayerId - the net Id of the player that just logged out
  • bMaintainParty - if TRUE then preserve party members of a reservation when the party leader logs out

InitHostBeacon

native function bool InitHostBeacon (int InNumTeams, int InNumPlayersPerTeam, int InNumReservations, name InSessionName)

Creates a listening host beacon with the specified number of parties, players, and the session name that remote parties will be registered under

Parameters:

  • InNumTeams - the number of teams that are expected to join
  • InNumPlayersPerTeam - the number of players that are allowed to be on each team
  • InNumReservations - the total number of players to allow to join (if different than team * players)
  • InSessionName - the name of the session to add the players to when a reservation occurs

Returns:

true if the beacon was created successfully, false otherwise

TellClientsHostHasCancelled

native function TellClientsHostHasCancelled ()

Tells all of the clients that the host has cancelled the matchmaking beacon and that they need to find a different host

TellClientsHostIsReady

native function TellClientsHostIsReady ()

Tells all of the clients that the host is ready for them to travel to the host connection

TellClientsToTravel

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

Tells all of the clients to go to a specific session (contained in platform specific info). Used to route clients that aren't in the same party 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

UpdatePartyReservationEntry

native function PartyBeacon.EPartyReservationResult UpdatePartyReservationEntry (OnlineSubsystem.UniqueNetId PartyLeader, const out array<PartyBeacon.PlayerReservationPlayerMembers)

Update a party with an existing reservation Avoids adding duplicate entries to the player members of a party.

Parameters:

  • PartyLeader - the party leader for which the existing reservation entry is being updated
  • PlayerMembers - players (not including party leader) being added to the existing reservation

Returns:

EPartyReservationResult similar to a client update request

Events

RegisterPartyMembers

event RegisterPartyMembers ()

Registers all of the parties as part of the session that this beacon is associated with

UnregisterParty

event UnregisterParty (OnlineSubsystem.UniqueNetId PartyLeader)

Unregisters each of the party members that have the specified party leader

Parameters:

  • PartyLeader - the leader to search for in the reservation array

UnregisterPartyMembers

event UnregisterPartyMembers ()

Unregisters each of the party members at the specified reservation with the session

Other instance functions

AreReservationsFull

function bool AreReservationsFull ()

Determine if the beacon has filled all open reservation slots

Returns:

TRUE if all reservations have been consumed by party members

DumpReservations

function DumpReservations ()

Logs the reservation information for this beacon

GetPartyLeaders

function GetPartyLeaders (out array<OnlineSubsystem.UniqueNetIdPartyLeaders)

Gathers all the unique ids for party leaders that have reservations

GetPlayers

function GetPlayers (out array<OnlineSubsystem.UniqueNetIdPlayers)

Gathers all the unique ids for players that have reservations