iOS
Android
Unity
REST Api
BDArenaPlayConnector

Availability : ver 1.0 and later

Declared in : BDArenaPlayConnector.h

Sample code : -

Overview

The BDArenaPlayConnector class is the main interface for accessing the Arena Daemon multiplayer features.

 

BDArenaPlayConnector declares methods for performing registrations to tables, initiate challenges and obtaining information about available matches.

 

The BDArenaPlayConnector object is accessible through playConnector property of the unique BDArenaConnector instance. 

 

 

    BDArenaPlayConnector* playConnector = [BDArenaConnector getInstance].playConnector;

 

Methods

Connection to multiplayer daemon

- connect

- disconnect

- isConnected

 

Tables listing and players information

- getTablesList

- getPlayersListForTableWithId:

- getParamStringForTableWithId:

- getPlayerListForMatchWithId:

 

Actions on tables

- registerToTableWithId:

- unregisterFromTableWithId:

 

Challenges

- createChallengeWithName:withParam:withPlayersAuid:

- cancelChallengeWithId:

- acceptInvitationToChallengeWithId:

- refuseInvitationToChallengeWithId:

- leaveChallengeWithId:

- startChallengeWithId:

 

Match Management 

- sendMessage:ToPlayerWithAuid:inMatchWithId:

- sendMessageToPlayers:inMatchWithId: 

- leaveMatchWithId:

 

Player status

- getStatusForPlayerWithAuid: 

 

 


 

 

 

connect

 

Performs connection to multiplayer daemon.

 

- (void) connect;

 

Discussion

The results of this operation can be handled implementing arenaPlayConnectionEstabilished and 

arenaPlayConnectionFailedWithError: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

disconnect

 

Performs disconnection from multiplayer daemon.

 

- (void) disconnect;

 

Discussion

The result of this operation can be handled implementing arenaPlayConnectionDidClose protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

isConnected

 

Informs about connection status to multiplayer daemon.

 

- (BOOL) isConnected;

 

Return value

YES if a connection to the multiplayer daemon is already established. NO otherwise.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

getTablesList

 

Retrieves tables list.

 

- (ARENA_ERROR) getTablesList;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Discussion

The results of this operation can be handled implementing 

arenaPlay:tablesListReceived:activeMatches:activePlayers: and arenaPlay:requestDidFail: 

protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

getPlayersListForTableWithId:

 

Retrieves the list of players registered to a specific table.

 

- (ARENA_ERROR) getPlayersListForTableWithId:(NSString*)tableID;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Discussion

The results of this operation can be handled implementing arenaPlay:playersListReceived:forTableId: and arenaPlay:requestDidFail: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

getParamStringForTableWithId:

 

Retrieves the param string associated to a specific table.

 

- (ARENA_ERROR) getParamStringForTableWithId:(NSString*)tableID;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Discussion

The results of this operation can be handled implementing arenaPlay:paramReceived:forTableId: and arenaPlay:requestDidFail: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

  

getPlayersListForMatchWithId:

 

Retrieves the list of players that are playing in a specific match.

 

- (ARENA_ERROR) getPlayersListForMatchWithId:(NSInteger)matchID;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Discussion

The results of this operation can be handled implementing arenaPlay:playersListReceived:forMatchId: and arenaPlay:requestDidFail: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

  

registerToTableWithId:

 

Registers local player to a specific table.

 

- (ARENA_ERROR) registerToTableWithId:(NSString*)tableID;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Discussion

The results of this operation can be handled implementing arenaPlay:registrationSuccessfullyCompletedToTable:withMatchId:, arenaPlay:alreadyRegisteredToTableWithId: and arenaPlay:requestDidFail: 

protocol methods of BDArenaPlayConnectorDelegate.

If the operation succeeds, the matchID will be returned in order to manage

messages between players during match.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

unregisterFromTableWithId:

 

Unregisters local player from a specific table.

 

- (ARENA_ERROR) unregisterFromTableWithId:(NSString*)tableID;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Discussion

The results of this operation can be handled implementing arenaPlay:unregistrationSuccessfullyCompletedFromTableWithId:, arenaPlay:unregistrationFailedFromTableWithId:, arenaPlay:notRegisteredToTableWithId: and arenaPlay:requestDidFail:

protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

createChallengeWithName:withParam:withPlayersAuid:

 

Creates a new challenge.

 

- (ARENA_ERROR) createChallengeWithName:(NSString*)challengeName withParam:(NSString*)param withPlayersAuid:(NSArray*)playersAuid;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

challengeName

    A symbolic, user friendly name for the challenge.

param

    A user defined string associated with the challenge.

    The main purpose of this parameter is to provide a simple and fast way for sharing information

    about challenge to all players such as difficulty level of the match, filename for

    a custom background image and any other kind of customization parameters for current challenge.

playersAuid

    An array of player auids. This array contains the list of players to challenge.

 

Discussion

The results of this operation can be handled 

implementing 

arenaPlay:challengeCreationSuccessfullyCompletedWithChallengeId:
withChallengeName:withParam:withPlayers:withMatchId:
 and 

arenaPlay:challengeCreationFailedWithError: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

cancelChallengeWithId:

 

Cancel a previously created challenge.

 

- (ARENA_ERROR) cancelChallengeWithId:(NSString*)challengeId;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

challengeId

    The identifier of the challenge to cancel.

 

Discussion

The results of this operation can be handled implementing arenaPlay:challengeCancellationSuccessfullyCompletedForChallengeWithId: and 

arenaPlay:challengeCancellationForId:failedWithError: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

acceptInvitationToChallengeWithId:

 

Accepts an incoming invitation for a challenge.

 

- (ARENA_ERROR) acceptInvitationToChallengeWithId:(NSString*)challengeId;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

challengeId

    The challenge identifier.

 

Discussion

Once the challenge's organizer initiates a challenge creation through createChallengeWithName:withParam:withPlayersAuid: method,

each challenged player receives a notification through the arenaPlay:challengeInvitationReceivedFromPlayer:withChallengeId:withChallengeName:
withParam:withPlayers:withMatchId:
method of BDArenaPlayConnectorDelegate.

If this event occurs, the local player can accept or refuse challenge invitation through acceptInvitationToChallengeWithId: or refuseInvitationToChallengeWithId:. 

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

refuseInvitationToChallengeWithId:

 

Refuses an incoming invitation for a challenge.

 

- (ARENA_ERROR) refuseInvitationToChallengeWithId:(NSString*)challengeId;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

challengeId

    The challenge identifier.

 

Discussion

Once the challenge's organizer initiates a challenge creation through createChallengeWithName:withParam:withPlayersAuid: method, each challenged player receives a notification through the arenaPlay:challengeInvitationReceivedFromPlayer:withChallengeId:withChallengeName:
withParam:withPlayers:withMatchId:
 method of BDArenaPlayConnectorDelegate.

If this event occurs, the local player can accept or refuse challenge invitation through acceptInvitationToChallengeWithId: or refuseInvitationToChallengeWithId:. 

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

leaveChallengeWithId:

 

Forces the local player to leave a challenge that is not yet started.

 

- (ARENA_ERROR) leaveChallengeWithId:(NSString*)challengeId;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

challengeId

    The challenge identifier.

 

Discussion

The results of this operation can be handled implementing arenaPlay:challengeSuccessfullyLeftForChallengeWithId: and 

arenaPlay:leaveChallengeWithId:didFailWithError: protocol methods

of BDArenaPlayConnectorDelegate.

Once a challenge has started, in order to leave the generated match,

the local player needs to call leaveMatchWithId method.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

startChallengeWithId:

 

Starts a previously created challenge.

 

- (ARENA_ERROR) startChallengeWithId:(NSString*)challengeId;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

challengeId

    The challenge identifier.

 

Discussion

The challenge's organizer calls this method for starting the challenge.

The organizer, after the creation of a new challenge, can decide to wait for the responses

from challenged players before start the match or, alternatively, start the match while invitations

are pending response. When the organizer starts the challenge, each challenged player

which accepted the invitation, receives a notification through arenaPlay:matchDidStart:

protocol method of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

sendMessage:ToPlayerWithAuid:inMatchWithId:

 

Sends a message to a specific player playing a specific match.

 

- (ARENA_ERROR) sendMessage:(NSString*)message

        ToPlayerWithAuid:(NSInteger)auid inMatchWithId:(NSInteger)matchId;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

message

    The message to send all players playing the match.

auid

    The Arena daemon Unique Id (auid) of the requested player.

matchId

    The match identifier.

    This parameter is returned in arenaPlay:registrationSuccessfullyCompletedToTable:withMatchId: 

    protocol methods of BDArenaPlayConnectorDelegate after a successful call to registerToTableWithId: 

    methodThe same matchId is returned in the match data object provided by arenaPlay:matchDidStart: 

    protocol method of BDArenaPlayConnectorDelegate.

 

Discussion

The results of this operation can be handled implementing arenaPlay:messageSuccessfullySent:toPlayerWithAuid:inMatchWithId: 

and arenaPlay:requestDidFail: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

sendMessageToPlayers:inMatchWithId:

 

Sends a message to all players playing a specific match.

 

- (ARENA_ERROR) sendMessageToPlayers:(NSString*)message

        inMatchWithId:(NSInteger)matchId;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

message

    The message to send all players playing the match.

matchId

    The match identifier.

    This parameter is returned in arenaPlay:registrationSuccessfullyCompletedToTable:withMatchId:

    protocol methods of BDArenaPlayConnectorDelegate after a successful call to registerToTableWithId: 

    methodThe same matchId is returned in the match data object provided by arenaPlay:matchDidStart: 

    protocol method of BDArenaPlayConnectorDelegate.

 

Discussion

The results of this operation can be handled implementing arenaPlay:messageSuccessfullySent:inMatchWithId: 

and arenaPlay:requestDidFail: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

leaveMatchWithId:

 

Forces the local player to leave a specific match.

 

- (ARENA_ERROR) leaveMatchWithId:(NSInteger)matchID;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Discussion

The results of this operation can be handled implementing arenaPlay:matchSuccessfullyLeft: 

and arenaPlay:leaveMatchWithId:didFailWithError: protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h

 

 

 

getStatusForPlayerWithAuid:

 

Retrieves information about a specific player.

 

- (ARENA_ERROR) getStatusForPlayerWithAuid:(NSInteger)auid;

 

Return value

An ARENA_ERROR value indicating the result of the call.

 

Parameters 

auid

    The Arena Daemon Unique Id (auid) of the requested player.

 

Discussion

The results of this operation can be handled implementing arenaPlay:status:receivedForPlayerWithAuid: and arenaPlay:requestDidFail: 

protocol methods of BDArenaPlayConnectorDelegate.

 

Availability

available in SDK ver 1.0 and later

 

Declared in

BDArenaPlayConnector.h