This method of the DirectPlay2 Class creates a local player for the current session.
public int createPlayer(String friendlyName, String formalName, int receiveEvent, byte[] data, int dataSize);
Returns a unique DirectPlay ID that identifies the new player.
formalName | The formal name of the player. Use null to indicate that the player has no formal name information. |
friendlyName | The friendly name of the player. Use null to indicate that the player has no friendly name. |
receiveEvent | An event object created by the application that will be triggered by DirectPlay2 when a message addressed to this player is received. |
data | A block of application-defined remote data to associate with the group ID. Null indicates that the group has no initial data. The data specified here is assumed to be remote data that will be propagated to all the other applications in the session as if setPlayerData were called. |
dataSize | The size, in bytes, of data. |
A single process can have multiple local players that communicate through a DirectPlay object with any number of other local or remote players running on multiple computers. The player ID returned to the caller should be used to identify the player for message passing and data association. Player and Group IDs assigned by DirectPlay will always be unique within the session.
The application can associate an initial name with the player at its creation (see setPlayerName). The names in friendlyName and formalName are provided for human use only; they are not used internally and need not be unique.
Upon successful completion, this method sends a DPSYS_CREATEPLAYERORGROUP system message to all the other players in the session announcing that a new player has joined the session.
DPMSG_CREATEPLAYERORGROUP, destroyPlayer, enumPlayers, receive, send, setPlayerName