Interface with NP systems, including signaling
PS3 NP systems offer the concept of rooms and lobbies. Sony also hosts servers used for NAT traversal. With the use of the Lobby2Client_PS3 plugin, these services are offered through and interface with RakNet in an easier to use fashion.
The sample is located in the solution RakNet_PS3_VS2005.sln under the project np_matching2_lobby. This is the np_matching2 sample that comes with the PS3 SDK, but has been modified to interface with RakNet. If you look at the source under Lobby2Client_PS3.cpp and Lobby2Message_PS3.cpp, you'll see that much of the code is lifted right out of the sample. This is to ensure compliance with the PS3 TCRs.
Attach an instance of Lobby2Client_PS3 to an instance of RakPeer. Most operations are performed through the SendMessage() or SendMsgAndDealloc() methods, however the class does contain some functions for utility. For example, IsInRoom() returns if you are currently in a room or not. GetNumFriends() returns the number of friends online. See the class for the full list of methods.
Available operations are found in Lobby2Message_PS3.h. The operations themselves are documented in the file. See the bottom of the file for a full list of operations.
All files immediately under DependentExtensions\Lobby2, except Lobby2Server.h and Lobby2Server.cpp. These are common files for all platforms.
RakNet::Lobby2Message* startupMsg = messageFactory->Alloc(RakNet::L2MID_Client_Login);
Attach plugin and register for callbacks
struct PS3Results : public RakNet::Lobby2Callbacks
// Attach the plugin and register the callback
// Update PS3Results class with this code
1. To use this system, you must start RakNet before sending the Client_Login message. Furthermore, in the SocketDescriptor passed to Startup(), you must specify remotePortRakNetWasStartedOn_PS3. If all your systems start on the same port, then SocketDescriptor::remotePortRakNetWasStartedOn_PS3 should be equal to SocketDescriptor::port.
2. When RakNet is not running, you have to call Lobby2Client_PS3::Update() manually or callbacks will not be called.