DirectX SDK

Memory Sample

[C++]

This topic pertains only to application development in Visual Basic. See DirectPlay C++ Samples.

[Visual Basic]

Description

Memory is a simple network game for up to four players that demonstrates how to make a connection, create and join sessions, create players, and send and receive DirectPlay messages.

Path

Source: (SDK root)\Samples\Multimedia\VBSamples\DPlay\Src\Memory

Executable: (SDK root)\Samples\Multimedia\VBSamples\DPlay\Bin\Memory.exe

User's Guide

Click the Multiplayer button in order to create or join a network session. Choose a connection type and (optionally) change the player name, then click on OK. If hosting a session, you can cancel out of any service provider dialogs.

If you choose an TCP/IP connection, you can run multiple sessions and play a game on a single computer.

In the Join or Create Game dialog box, click New to create a new game, or select one from the list and click Join. Note that the list is not automatically updated, so if you're waiting for another player to create a game, you have to click the Refresh button periodically.

If creating a game, set the maximum number of players and the name, then click Create. The Waiting for Host to Start Game dialog box appears. You can start the game as soon as at least one other player is listed.

To play the game, wait till your name is highlighted on the scoreboard, then click on any two tiles. If you get a match, you play again. The winner is the player who gets the most matches. Unmatched tiles are hidden as soon as the next player clicks on a tile.

To send a chat message to all other players, press Enter.

If the host leaves the game prematurely, another player becomes the host.

Programming Notes

The application polls for messages in Sub Main, in GlobalModule.bas. Most of the forms have some DirectPlay code as well.