Share via


Creating and Managing Sessions

Warning: Microsoft DirectPlay has been deprecated. Deprecated components of Microsoft DirectX 9.0 for Managed Code are considered obsolete. While these components are still supported in this release of DirectX 9.0 for Managed Code, they may be removed in the future. When writing new applications, you should avoid using these deprecated components. When modifying existing applications, you are strongly encouraged to remove any dependency on these components.

A game session is an instance of a particular multiplayer game. A session has two or more users playing simultaneously, each with the same game client on his or her computer. A player is an entity in the game itself, and is defined by the particular game. Each user may have more than one player in a game. However, the game application must manage these players itself, using separate DirectPlay interfaces or objects for each player.

The first step in creating a session is to collect a group of users. There are two basic approaches:

  • Many game sessions are arranged by a lobby application running on a remote computer. This approach is used by most Internet-based games.
  • It is also possible to arrange games by having the individual users' computers communicate with each other. This approach is typically limited such situations as a group of potential users that are all on the same local area network (LAN).

Once the session has been arranged, the game is launched and gameplay begins. As the session proceeds, players may be eliminated from the session or new players added. The details are up to the individual game.

With a multiplayer game, each user's user interface (UI) can be synchronized with that of all other users in the session. Managing a multiplayer session thus requires a continual stream of messages to and from each user. For example, every time a player moves, a message must be sent to update that player's position on all the other game clients in the session. The core of DirectPlay is that part of the application programming interface (API) that supports efficient and flexible messaging between all the computers in a session.

There are two basic ways to structure the messaging topology of a session: peer-to-peer and client/server. Both topologies have their advantages and limitations, so you will need to evaluate which is most appropriate for your game.

This section includes the following topics.