Microsoft DirectX 9.0 SDK Update (Summer 2003) |
Lobby Clients
A lobby client is an application that is implemented by the lobby server vendor and installed on each player's computer. It handles communication between the players and their game applications, and the lobby server. A common way to install a lobby client is to have the user download it from the lobby server's Web site as part of the sign-up procedure.
The following is a typical scenario.
- A new player goes to the Web site and signs up.
- As part of the sign-up procedure, the lobby client is downloaded to the client's computer.
- The player determines which to play and asks to join a session.
- The Web site launches the lobby client on the player's computer. A typical launch mechanism is a URL that points to the lobby client's executable file.
- The lobby client handles the mechanics of arranging the session, and then launches the user's game application.
- If the game is a lobbyable application, the lobby client enables the game application to communicate with the lobby server. This connection enables the lobby server to keep track of events such as players entering and leaving the game and host migration.
Lobby clients do not necessarily have to be linked to a remote server. In another scenario the user launches the lobby client directly. The lobby client then lists the available games and sessions, perhaps among the people connected to the user's local area network (LAN) subnet. When the user chooses a game and session, the lobby client launches the game.
This section discusses some the general features of a lobby client. For more information about communicating between a lobby client and its associated lobby server, see Communicating with a Lobbied Application.
For more information about implementation details, see Implementing a Lobby Client or the LobbyClient sample application included in the software development kit (SDK).
Communicating with a Lobby Client
Much of the lobbied application's interaction with an associated lobby client is indirect. The application does something that affects the lobby client, Microsoft® DirectPlay® sends an appropriate message, and vice versa. For instance, if the application changes the connection settings, DirectPlay notifies the lobby client, and provides the new settings. However, there are two methods that provide information directly to the lobby client: IDirectPlay8LobbiedApplication::UpdateStatus and IDirectPlay8LobbiedApplication::Send.
You must notify the lobby client when any of the following changes in the game status take place.
- The session is connected.
- The session could not connect.
- The session has been disconnected.
- The session has been terminated.
- The session host has migrated.
- This computer has become the session host.
To notify the lobby client of one of these status changes, call IDirectPlay8LobbiedApplication::UpdateStatus, and set the dwStatus parameter to the appropriate value. The lobby client receives a DPL_MSGID_SESSION_STATUS message to notify it of the status change.
The IDirectPlay8LobbiedApplication::Send method enables the application to send a message directly to the lobby client. DirectPlay passes the data to the lobby client without modification. It is the responsibility of the lobby client to process that data.
The lobby client can also send data directly to the application. The data is passed to the lobby client's message handler with a DPL_MSGID_RECEIVE message. DirectPlay passes the data to the application without modification. The lobby client must process the data.