[ Pobierz całość w formacie PDF ]
.Thiscollected data can then be compiled into lists or statistics and perhaps presented on a webpage somewhere.A good way to use this data would be to host tournaments, perhapsgiving prizes to the top 10 scores in each lobby over a certain period of time.To write code for a game that implements a DirectPlay lobby, you will be using objectsbased on both the IDirectPlayLobby3 and IDirectPlay4 interfaces.As you will seeshortly, the two interfaces go hand-in-hand, and you ll need an instance of both to performall of the functions a lobby will need.Because DirectPlay can be written to use a variety of connection schemes, such asclient/server and peer to peer and because writing a lobby server is very involved, for therest of this hour, you will concentrate simply on adding lobby code to a game that alreadyis DirectPlay-able.Writing a full-fledged lobby and game server is usually a large commer-cial venture, complete with advertising and Web sites geared towards presenting game playdata and tournaments.Lobby and game servers usually require logging data to a databaseover time, which is too large a project to learn in an hour (let alone a day).We will coverthe concepts and goals of a lobby server next, though, so you ll have an idea of how yourgame might work on a larger scale not just on a modem between you and your buddy.A full-fledged lobby client will be written using the Lobby Provider SDK fromMicrosoft.The presentation of the lobby concept to a user could easily be handled by acombination of Web browsing and a lobby client (perhaps an ActiveX component), orjust by a sophisticated, standalone lobby client.For more information on how to writeyour own sophisticated lobby client or server, you should contact Microsoft for moreinformation on the lobby provider kit.A lobby provider is a client component (DLL) supplied by the developer of aNEW TERMlobby server.It implements communication functions with the lobby server asrequested by DirectPlay. 29 1634xCH21 11/13/99 11:17 AM Page 431Game Central Creating Lobbies 431Don t be discouraged by the fact that we won t be covering how to write alarge-scale lobby server or sophisticated lobby client.The DirectX SDKincludes a test lobby server, which should be more than adequate to testyour game with.If you are successful at writing a game with DirectPlay fea-tures built-in, you can always consider having the game hosted on a large-scale game hosting site.One of the benefits of using the DirectPlayarchitecture and supporting DirectPlay lobbies is that if you write the APIcorrectly, your game should be hostable on almost any of the game hostingsites.I ll leave that as something for you to look into.The Game ServerThe lobby server will most likely be database driven and should be very scalable becausethe idea is to get a large amount of players together the more the merrier.It will alsomost likely be tied to the Web, somehow.As you look at the large commercial ventures,you will see that they tie a large amount of information together, such as tournament andgame info, and present it on a Web site.They also track your player information andstore that in a database as well.As mentioned previously, the lobby server might or might not be the same as the gameserver, and they might not even be running on the same computer, nor even located closeto each other physically.It is possible for a lobby server to be running on the Internetsomewhere, perhaps in conjunction with a Web site, and for the actual game session tobe hosted via some dialup service.Remember that it is the lobby client s responsibility toobtain the game connection information from the server and to send that information tothe game client.The lobby client could connect to the Internet via the DirectPlay TCP/IPservice provider, but the game session could be played over the DirectPlay modem ser-vice provider.This might be likely if the game play was to take place over a proprietarylow-latency network.Making a DirectPlay Application LobbyableWhen a user decides to join a session in-progress or start a new game when all playershave joined, the DirectPlay Lobby interface, IDirectPlayLobby3, enables you to launchthe actual game program automatically.The capability for DirectPlay (via the lobbyinterface) to launch your application means that your application is lobby-aware.21A lobby-aware application is a DirectPlay application capable of being launchedNEW TERMby a lobby and is capable of obtaining its connection parameters from a DirectPlaylobby. 29 1634xCH21 11/13/99 11:17 AM Page 432432 Hour 21For a DirectPlay game to connect to other clients or servers running on other computers,it must use a network connection.Without lobby support, this is usually accomplished byasking the user for connection parameters (for example, an Internet address for a TCP/IPtype of connection).The user fills in a dialog box presented by DirectPlay with the para-meters needed for DirectPlay to successfully complete the connection.A DirectPlay game can also get its connection information from a lobby because a lobbywould have specific information on a game session, including connection parameters.Tomake a game  lobbyable, a small amount of code change is needed to an already DirectPlayenabled game to accommodate this.A DirectPlay enabled game can also include the codenecessary to provide a lobby interface internally, thereby also taking advantage of obtainingconnection parameters from the lobby.Thus, there are three possible ways in which aDirectPlay game can be written.They are as follows:" Stand-Alone This type of client does not know about lobbies, nor how to use them." Lobby-Aware This type of client can be launched by an external lobby and isaware of how to obtain information about the game session (including connectionsettings) from the lobby that launched it." Self-Lobbied This type of game contains code to provide lobby client functionsinternally, so it does not require an external client to launch it.It is the last two types of game that you will now learn how to build.The first type, Stand-Alone, you already know how to build from the last hour.With very little change to the codeof a Stand-Alone type of game, you will be able to write games that are Lobby-Aware orSelf-Lobbied.The IDirectPlayLobby InterfaceThe IDirectPlayLobby3 interface is, like the rest of DirectX, based on COM [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • andsol.htw.pl