Represents a room in a PlayStation Network (PSN) game.
You can create a new room by calling Network.create_psn_room(), or join an existing one by calling Network.join_psn_room().
Constructors and accessors
Other related reference items
game_session_host ( room ) : string?Returns the game session host for the room.
|
room : | The PSN room whose host you want to set. |
string? |
The peer ID of the host of the game session for the room, or nil if no game session host has been set. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
If a peer detects that a game session host has been set, it should typically first load the level map and then send a message to the game session host saying that it wants to drop into the session. Upon receiving that message, the game session host should call GameSession.add_peer() to add the peer to the game session.
member ( room, index ) : network_psn_room_memberRetrieves detailed information about the room member at the specified index.
|
room : | The PSN room whose member you want to retrieve. | |
index : | integer | The index of the member you want to retrieve. |
A table that contains information about the member. |
Other related reference items
num_members ( room ) : integerReturns the number of members currently in the room.
|
room : | The PSN room whose members you want to retrieve. |
integer |
The number of members in the room. |
owner ( room ) : stringRetrieves the current owner of the PSN room.
|
room : | The PSN room whose owner you want to retrieve. |
string |
The peer ID of the room's owner. |
set_data ( room, value )Stores a single opaque data value for the room.
|
room : | The PSN room whose data you want to set. | |
value : | string | A string value to store for the room, maximum 255 bytes. |
This function does not return any values. |
Other peers will be able to access this value in the data table returned by PsnRoomBrowser.room(). You can use this mechanism to store descriptive information about the room, such as the name of the host, the name of the game, the name of the level or map that will be played, etc. Your game can then present this information to other prospective players, in order for those players to decide whether or not to join the room.
The data this string represents and the format of the string are entirely up to you to decide.
Other related reference items
set_game_session_host ( room, peer_id )Sets the host of the game session to the specified peer.
|
room : | The PSN room whose host you want to set. | |
peer_id : | string? | The ID of the peer that should become the host of the game session, or nil to clear the game session host. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
This is used by the room host in order to indicate to all connected peers that the game session has started.
set_name ( room, name )Stores a name for the room.
|
room : | The PSN room whose name you want to set. | |
name : | string | The name for this room, as it should be visible to other peers that may want to join. |
This function does not return any values. |
Other peers will be able to access this value in the data table returned by PsnRoomBrowser.room(). Your game can then present this information to other prospective players, in order for those players to decide whether or not to join the lobby.
Other related reference items
state ( room ) : integerIndicates the current state of the room, and whether or not this peer has joined successfully.
|
room : | The PSN room whose state you want to retrieve. |
integer |
An element from the State constants that indicates the current state of the room. |
Other related reference items
The constants in this section may be returned by PsnRoom.state() in order to describe the current state of the room.
CREATING : integerIndicates that the creation of the room has started.
|
If the room is successfully created, the state changes to PsnRoom.JOINED. If the creation fails, the state changes to PsnRoom.FAILED.
Other related reference items
FAILED : integerThis state indicates that this peer has been rejected by the room host, or has dropped out of the room due to a problem such as a bad connection..
|
Other related reference items
JOINED : integerIndicates that the player is in the room.
|
Other related reference items
JOINING : integerThe state of the room after it has been joined by a call to Network.join_psn_room().
|
This state means the room is waiting for the room owner to accept this peer as a room member. When this peer is accepted, the state changes to PsnRoom.JOINED. If this peer is not accepted, the state changes to PsnRoom.FAILED.
WAITING_TO_CREATE : integerIndicates that the room is queued to be created, but PsnClient.ready() does not yet return true.
|
This is the state of the room after it has been created with Network.create_psn_room(). When PsnClient.ready() returns true, the state changes to PsnRoom.CREATING.