Microsoft DirectX 8.1 (Visual Basic) |
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 Microsoft® 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.
Once the session has been arranged, the game is launched and game play begins. As the session proceeds, players may be eliminated from the session, or new players added. The details depend on the individual game.
With a multiplayer game, each user's UI can be synchronized with that of all the 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 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.