Lobbyable Applications

DirectPlay

 
Microsoft DirectX 9.0 SDK Update (Summer 2003)

Lobbyable Applications


Lobbyable applications are designed to work with a lobby client based on Microsoft® DirectPlay®. While a lobby client can use DirectPlay to launch any application, lobbyable applications have a number of advantages.

  • The lobby client receives automatic updates when game status changes.
  • The lobby client can use a standard application programming interface (API) to communicate with the application.
  • The application can use a standard API to communicate with the lobby client.

In short, DirectPlay virtually eliminates the need for game-specific or lobby client-specific communication code. You can use a standard API for everything with little or no modification for the particular game or lobby client.

For a discussion of implementation details, see Implementing a Lobbyable Application or software development kit (SDK) samples such as SimplePeer, or StagedPeer.

Launching a Lobbyable Application

One of the first things a lobbyable application should do after it is launched is create a lobbied application object. Among other things, this object enables your application to determine whether it was lobby-launched. A lobbied application must also implement a message-handler callback function to receive messages from the lobby client. The basic procedure is:

  • Create a lobbied application object.
  • Initialize the object.
  • If the initialization method returns a valid connection handle, your application was lobby launched.
  • Examine the user context value that is returned by the initialization method. This value might contain game-specific information from the lobby client.
  • Examine the connection message received through the lobbied application message handler. This message carries with it a variety of information, including the identifier (ID) that you will use to send messages to the lobby client.

Once an application has been successfully lobby launched, DirectPlay can automatically send status updates to the lobby client when events such as host migration occur. To enable automatic status updates, call the RegisterLobby method of the IDirectPlay8Peer, IDirectPlay8Client, or IDirectPlay8Server interface. You can also use the lobbied application interface to send messages to the lobby client.

Be aware that your message handler function might receive messages from the lobby client before the initialization method returns. In addition to the connection message, the callback function receives messages when the lobby client changes connection settings, or it breaks the connection. The lobby client can also send messages directly to your message handler that contain game-specific information.

Note  It is possible to receive messages from more than one thread. To handle messaging properly, your lobbied application callback function should be re-entrant.

© 2003 Microsoft Corporation. All rights reserved.