Player Management

Your application can use DirectPlay's player-management methods to manage the players in a session. In addition to creating and destroying players, your application can enumerate the players or retrieve a player's communication capabilities.

The IDirectPlay2::CreatePlayer and IDirectPlay2::DestroyPlayer methods create and delete players in a session. When the player is created, the application can supply friendly and formal names for it, as well as some initial remote data. (For more information, see Data Management.) DirectPlay assigns the player a player ID, which the application and DirectPlay use to route message traffic. The application and DirectPlay use the player ID to route message traffic. DirectPlay does not use the friendly and formal names, but the application can use them to identify players.

Your application can use the IDirectPlay2::EnumPlayers method to determine which players are in a current session and what their friendly and formal names are. Your application should typically call this method immediately after the IDirectPlay2::Open method opens a session. Your application can use the IDirectPlay2::EnumPlayers method to enumerate all the players in a session. If your application needs information about the speeds of the players' connections to the session, it can use the IDirectPlay2::GetPlayerCaps method.

Your application can change the name associated with a player by using the IDirectPlay2::SetPlayerName method. This method sends a system message to the other players informing them that a player's name has changed. These players can determine the new name from the DPMSG_SETPLAYERORGROUPNAME system message, or by using IDirectPlay2::GetPlayerName.