Platform SDK: DirectX

Lobby Sessions

A lobby session closely resembles a DirectPlay client/server session (see the illustration in Client/Server Session). The term lobby session refers to a connection to a lobby server where clients and the server have not been specifically written to work together. The term application session refers to a traditional DirectPlay session in which all the clients and the server (if any) have been specifically written to work together.

The first step in using DirectPlay to communicate with a lobby server is to select which lobby provider to use and which lobby server to connect to. The available connections are enumerated just like other DirectPlay service providers, and the connection is made in the same way. See Basic Steps in Writing a DirectPlay Application.

The lobby client uses the same methods to locate and join a lobby session as an application client uses to locate and join an application session. (See Session Management.) Joining a lobby session gives the client application access to all the information on the lobby server and enables the user to interact with other users on the lobby server.

As in a DirectPlay application session, the player is the basic entity in a lobby session. Each player represents a user on a client computer connected to the lobby server. There is also the server player representing the lobby server. After a lobby client connects to a lobby server (by joining the lobby session), it must establish the user's presence by creating a player and adding the player to an initial group before the player can start communicating with the server and other players. In fact, other users connected to the session won't even be aware of the new user's presence until this happens.

The same player management methods used by application sessions are used to manage players in a lobby session. See Player Management.

Players in a lobby session cannot send ordinary messages to one another. In the DirectPlay lobby architecture, any application that uses the DirectPlay API can connect to any lobby server. This means that several different lobby client applications might be present in the same lobby session, all of which might use a different set of application-defined messages.

[C++]

Clients can, however, exchange messages with the lobby by using standard lobby messages and the IDirectPlayLobby3::SendLobbyMessage method. In addition, players can send text to one another by using the IDirectPlay4::SendChatMessage method. This method causes the lobby to send a system message to the recipient, containing the contents of the chat message.

[Visual Basic]

Clients can, however, exchange messages with the lobby by using standard lobby messages and the DirectPlayLobby3.SendLobbyMessage method. In addition, players can send text to one another by using the DirectPlay4.SendChatMessage method. This method causes the lobby to send a system message to the recipient, containing the contents of the chat message.

Groups take on more significance in a lobby session, because they are used to define the organization of the entire lobby server and for launching application sessions.

For the purposes of the lobby server, groups are classified as one of two types: rooms and staging areas.

A room is a standard group that can contain players and other groups. A room is primarily used as a meeting place for players to interact with other players in the context of the lobby. The room contains links to other rooms and links to the second type of group—a staging area.

A staging area group typically contains only players. A staging area is used to marshal players together in order to launch a new session. After the session has been launched, the staging area can either be destroyed or remain in existence so that new players can join the session in progress.

Room groups are organized primarily in a hierarchical structure. A few top-level groups are created and other groups are created within existing groups. The lobby client can enumerate all the top-level groups as well as the groups contained within a group. The lobby server can also organize the groups in a web structure. Once a group is created, you can add it to another group, which creates a link between the two groups. When a lobby client enumerates groups within a group, all subgroups and linked groups are returned.

The following diagram illustrates the organization of a lobby session.

Players cannot be seen until they are part of a group. Players can belong to more than one group at once.

In general, the scope of the lobby session visible to a player is limited by the groups the player is part of. This limitation reduces the amount of information that the server must download to the client. Players can navigate through the lobby server space simply by deleting themselves from their current group and adding themselves to a new group.