DirectPlay Concepts

[Previous] [Next]

There are a few key terms and concepts in DirectPlay that you should be aware of before you start using it. Once you understand these terms, it will be easier to follow what the DirectPlay methods are used for.

DirectPlay allows players to connect to each other for multiplayer games in several ways: via serial cable, modem, or some sort of network connection. Each kind of connection is referred to as a service provider or connection type. It is possible for game developers or network companies to provide custom service providers for DirectPlay, but most of the time your choice of connection type will be between the standard types that DirectPlay provides: TCP/IP, IPX, modem, and serial. DirectPlay provides a method to enumerate the currently available service providers. Once the user has selected one, a connection can be initialized. Initialization of a connection often involves specifying information such as the phone number (for a modem connection) or the Internet address (for a TCP/IP connection).

Once a connection is initialized, it is possible to enumerate the available sessions. A session is a particular game being played by multiple players. A player, not surprisingly, is a participant in a session. Each player has a name and a numeric player ID. There is a special, "virtual" player in every session that is known as the host. The host doesn't represent a human player but rather manages system-level messages and operations for the session.

After everyone has joined the session, the game itself can begin. Players can all send DirectPlay messages to each other to indicate their status and actions. The structure of most messages is determined by the needs of the game, but there are some predefined messages, called system messages, that indicate game-level operations such as players entering or leaving the session.

DirectPlay also provides support for lobbies, which are places where users can launch applications, arrange game sessions, and exchange messages. Lobbies make it easy for users to create a session with other players. Because lobbies dictate the service provider that players must use, they enable users to easily find available opponents. In addition, lobbies provide the network address or configure the network if necessary, pass the name of the player (entered by the user upon connecting) so that he or she can join the game, and maintain a list of sessions in progress that users can join. Furthermore, lobbies can acquire final scores and maintain player-ranking information for tournaments. If the game isn't started from a lobby, the game itself needs to determine the connection type, enumerate available sessions (games in progress), and either join an existing session or create a new session.

If you like analogies, you might find a restaurant metaphor useful for understanding all these DirectPlay terms. Picking a service provider is like deciding what kind of restaurant to eat at or perhaps what neighborhood you want to eat in. After enumerating the available types, you can choose a particular restaurant and go there, which is like initializing a connection. Inside the restaurant, there are several eating "sessions" going on at different tables. You can either create a new session by sitting down at an empty table and waiting for people to join you, or you can join an existing session where people are already eating (or waiting for you). The host is like the waiter, who directs the process and disseminates information that is useful to all the players. Using a lobby is a bit like getting some friends on a conference call in advance and deciding on where exactly to meet, right down to the table number in the restaurant. Once you've all agreed, you can all head straight for that restaurant and table without making any further decisions. DirectPlay messages are comparable to conversations between those who are eating. Without them, you might as well be eating alone!



Inside Direct3D
Inside Direct3D (Dv-Mps Inside)
ISBN: 0735606137
EAN: 2147483647
Year: 1999
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net