Player Management

The most basic entity within a DirectPlay session is a player. A player represents a logical object within the session that can send and receive messages. DirectPlay does not have any representation of a physical computer in the session. Each player is identified as being either a local player (one that exists on your computer) or a remote player (one that exists on another computer). Each computer must have at least one local player before it can start sending and receiving messages. Individual computers can have more than one local player.

When an application sends a message, it is always directed to another player - not another computer. The destination player can be another local player (in which case the message will not go out over the network) or a remote player. Similarly, when an application receives messages they are always addressed to a specific (local) player and marked as being from some other player (except system messages, which are always marked as being from DPID_SYSMSG).

DirectPlay provides some additional player management methods that an application can use. These methods can save the application from having to implement a list of players and data associated with each one. You do not need these methods to use DirectPlay successfully. They enable an application to associate a name with a player and automatically propagate that name to all the computers in the session. Similarly, the application can associate some arbitrary data with a player that will be propagated to all the other computers in the session. The application can also associate private local data with a player that is available only to the local computer.

Basic Player Management Methods

DirectPlay provides several basic player management methods:

·IDirectPlay3::EnumPlayers enumerates all the players in the sessions.

·IDirectPlay3::CreatePlayer creates a local player.

·IDirectPlay3::DestroyPlayer destroys a local player.

Additional Player Management Methods

DirectPlay provides these additional methods to manage player information:

·IDirectPlay3::GetPlayerCaps gets a player's communications capabilities.

·IDirectPlay3::GetPlayerName gets a player's name.

·IDirectPlay3::SetPlayerName changes a player's name.

·IDirectPlay3::GetPlayerData gets the application-specific data associated with a player.

·IDirectPlay3::SetPlayerData changes the application-specific data associated with a player.

·IDirectPlay3::GetPlayerAddress gets a player's network-specific address.

·IDirectPlay3::GetPlayerAccount gets a player's account information.

·IDirectPlay3::GetPlayerFlags gets a player's flag settings.