Determining Player Profiles

Once you've connected an add-on to the session, you need to determine the characteristics of each of the other players in the session. The add-on must determine whether remote machines represent a "player" or an "observer." The add-on must also determine whether remote players will be sending or receiving detailed plane information.

A multiplayer session has two DirectPlay groups, FS61_REQUEST_PARAMS and FS61_REFUSE_PARAMS. Remote machines that belong to the FS61_REQUEST_PARAMS group are interested in receiving detailed aircraft information; remote machines that belong to the FS61_REFUSE_PARAMS group aren't interested in receiving detailed aircraft information.

To determine player profiles

  1. Use the DirectPlay EnumGroups function to create a list of groups in the session.
    The two groups used by the multiplayer system are FS61_REQUEST_PARAMS and FS61_REFUSE_PARAMS. The add-on will need to make its player a member of one of the FS61_REFUSE_PARAMS group.

  2. Using the group ID associated with the FS61_REFUSE_PARAMS group and the player ID of the add-on's player, call the DirectPlay function AddPlayerToGroup.

  3. Use the DirectPlay EnumPlayers function to create a list of the other players in the session and mark each player as having an "unknown" player type.

  4. Step through the list of players and send each player a QUERY_PLAYER_TYPE packet.
    Wait for a CHANGE_TO_PLAYER or CHANGE_TO_OBSERVER message that identifies a player's type. (The CHANGE_TO_PLAYER or CHANGE_TO_OBSERVER message can come from the session host as well as from the unknown player.) Use the player_id field in the packet to determine which player's information should be updated.

  5. Every 30 seconds or so, scan the known player list and send any "unknown" players a QUERY_PLAYER_TYPE packet.

It's possible for a player to join a session after the add-on creates a player. In that case, DirectPlay sends a message, DPMSG_CREATEPLAYERORGROUP.

When a new player notification is received

  1. Add the new player to the current player list and tag that player as unknown.

  2. Send the new player a QUERY_PLAYER_TYPE packet.
    Wait for a CHANGE_TO_PLAYER or CHANGE_TO_OBSERVER message that identifies the player's type. The CHANGE_TO_PLAYER or CHANGE_TO_OBSERVER message can originate from the unknown player or the session host.

  3. Use the player_id field in the packet to determine which player's information to update.