Microsoft Corporation
December 1999
Summary: This article is an overview of the Microsoft DirectPlay model of network game programming and an explanation of why the DirectPlay 7.0 API can be a technical foundation for the entire online entertainment industry. (6 printed pages)
In the 1890s, the film industry was a sideshow curiosity. Making a movie involved custom-built camera, projection, and lighting systems, whipping up a proprietary batch of film stock, and building custom movie theaters for each different type of presentation. The explosive growth of the movie industry happened only because of the separation of tasks: the technical issues of creating and projecting film, the creative challenges of making movies, and the marketing problems of building theatres and attracting customers. In the same way, the explosive growth projected for the online gaming market will require a similar separation of tasks: the technical issues of high-performance routing and delivery of network messages, the creative challenges of developing and delivering interactive entertainment to thousands of people simultaneously, and the marketing problems of attracting and retaining customers.
This updated article is an overview of the Microsoft® DirectPlay® model of network game programming and an explanation of why the DirectPlay 7.0 API can be a technical foundation for the entire online entertainment industry. It does this by adhering to a fundamental design philosophy of providing maximum flexibility with a negligible performance penalty. This allows different companies and different programming teams to concentrate on their areas of expertise, secure in the knowledge that DirectPlay will provide a high-performance networking bridge.
DirectPlay is a hub around which different specialists can add value. Game programmers can write to DirectPlay assured that their game can be deployed on a wide variety of networks. Game networks can write to DirectPlay assured that they can host a wide variety of games. Tool companies can create layers on top of DirectPlay to deliver a competitive advantage to their customers. All of this is true because DirectPlay has a limited, but crucial, role: to stand between the details of network and hardware protocols and the creativity and expressive power of media-rich, multiuser digital entertainment.
DirectPlay 7.0 has three main features: a transport-independent way of sending and receiving messages, a service-independent way of creating and communicating with game sessions, and a user interface-independent way of structuring and accessing networked resources such as players. Furthermore, since DirectPlay 7.0 delivers these features through COM interfaces, it is independent of any one language or development environment. Programmers who know COM will find the DirectPlay 7.0 API straightforward and, conversely, learning DirectPlay 7.0 will familiarize new programmers to this important standard.
New to DirectPlay 7.0 is the support of ripple launching. Ripple launching is defined as using an intermediary application to launch the desired application. This is a common scheme used in CD anti-piracy. Ripple launching an application breaks the normal technique for lobby launching an application. In DirectPlay 7.0, a solution is provided.
DirectPlay, like most networking protocols, uses a layered approach to simplify the challenge of writing networked code. The DirectPlay model uses four layers, as illustrated in this table.
Layer: | Written By: | Responsibilities: | Quantity: |
Application | Game developers | Create game-meaningful objects and events. | Great |
DirectPlay | Microsoft | Provide a bridge between game developers and various network service providers. | 1 |
Service Provider | Game Networks | Provide lobby-to-game integration, simplify network addressing. | Few |
Network | Networking Companies | Move data from source to destination. | Many |
In this model, every layer relies on the services of the next-lower layer. DirectPlay functions as a bridge between the game-oriented higher levels and the network-oriented lower levels. Before DirectPlay, game developers faced the no-win choice of programming to a proprietary high-level network interface (which might make their job easier, but would limit their market) or programming for several low-level APIs such as Winsock or TAPI. DirectPlay’s existence allows game developers to focus on developing their applications and not the networking layer.
Studying the DirectPlay model reveals something interesting: There is virtually no competitive advantage that a game company or gaming network can derive from foregoing DirectPlay. Productivity-related competitive advantages can be had by building or using tools for the higher levels, and performance-related competitive advantages can be had by improving the lower-level delivery mechanisms, but unless you’re in the operating system business, the DirectPlay level isn’t important to your core business.
This layered architecture maximizes flexibility, reuse, and localizes dependencies at the cost of a negligible loss of efficiency, the possibility of wasted work in which a lower layer does more work than the application ultimately needs, and cascades of changing behavior. However, the communications bottleneck is the transmission medium, so the time spent in the added layers is lost in the noise. This final liability (the transmission medium) is especially important to network game programmers. Although DirectPlay makes programming for a LAN or for a modem connected to the Internet transparent, it does not magically replace the characteristics of these lower-level devices. The behavior, reliability, bandwidth characteristics, and latency issues of different networks and network terminal devices will affect your game. Although DirectPlay 7.0 has certain features (particularly message throttling and guaranteed delivery) to help you deal with these issues, DirectPlay does not and cannot completely eliminate them.
At best, DirectPlay can supply accurate performance characteristics to the application and let it decide the best strategy for messaging. This flexibility means that DirectPlay is appropriate for every type of network game from chess to location-based entertainment. A game such as chess can be implemented with a straightforward messaging strategy and could be played over 14.4 baud modems connected to the Internet; an arcade network of combat simulators would have a much more sophisticated messaging strategy and be built on top of a high-speed Windows NT®-based network. With the DirectX® set of APIs, the entire spectrum of network games can be developed with powerful, low-cost, standard Windows®-based development tools.
While network games can be enjoyable when played with friends over an office LAN (after hours, of course), dedicated game networks are as important to cracking the mass market as theater chains are to Hollywood. These gaming networks provide a virtual environment external to the game in which people can find other people to play with, discuss games, form strategies and leagues, and, most importantly, easily launch game sessions in which to cooperate or compete. The DirectPlay 7.0 API provides a standard way for users to interact with these Lobby Matchmaking services as well as allowing the services to have some control over how to launch your game and connect to a session. These services may be hosted on the Internet, on a high-performance dial-in network, or a hybrid of the two.
DirectPlay 7.0 achieves service independence through the DirectPlay lobby services. At the most basic level, a lobby simply tracks DirectPlay sessions and the network addresses of users who are not yet playing a game but who are online and searching for fun. At the most advanced level, a DirectPlay lobby can be the basis for a network theme park, providing a sense of “location” (perhaps, like a physical theme park, continuing the visual themes of an attraction or genre), socialization services (chat, bulletin boards, avatars, and so on), and commerce services (tracking use and membership, presenting advertising, managing pay-for-play transactions, and so on). The DirectPlay lobby services do not dictate the services, data structures, or event models used to create such an advanced theme park; these would be products layered on top of DirectPlay by larger entertainment companies or tool vendors. From the game developer’s point of view, DirectPlay lobby services provide the entrance and exit “doors” to DirectPlay games. Actual lobbies are left to the provider to design and develop—DirectPlay affords the opportunity to write portable applications.
DirectPlay 7.0 delivers even more value to the game network. DirectPlay 7.0’s lobby services and network independence separate the issues of being a lobby provider (essentially a customer-oriented challenge) and being a provider of high-performance network services (essentially a technological challenge).
The third major characteristic of DirectPlay is user-interface independence. DirectPlay does require some network-specific information from the individual game, such as the network transport to be used and the network address of the game session. Earlier versions of DirectPlay presented the gamer with Microsoft-designed dialog boxes for this information. Although these dialog boxes are still available for use if the game designer so chooses, DirectPlay 7.0 allows a game to customize or even eliminate all DirectPlay dialogs. A sample override exists that shows this.
Unlike those distributed computing APIs that dictate particular, user-interface-related data structures, traversal mechanisms, and event models (for example, VRML), DirectPlay provides maximum architectural flexibility to the individual development team. If VRML or another high-level descriptive structure is appropriate to a game or lobby, it can be used transparently on top of DirectPlay, but if a development team wishes to use a different game architecture, it is free to do so with DirectPlay.
To the game programmer, DirectPlay appears as a set of COM interfaces. COM and ActiveX® controls are technologies with many facets and implications, ranging from strategic issues important to corporations to system details important to device drivers, but for the game programmer, the most important thing about COM is its language independence and consistent programming model.
With the language independence of COM, game developers are free to choose the programming language most appropriate to their talents and performance needs. Game developers are free to choose whatever COM-compliant language and development-environment vendor they wish. With COM’s programming model, the programmer can know that, even if the consumer upgrades or changes hardware configuration and DirectX drivers, the game will work without reconfiguration, since the binding of DirectX services with the underlying service provider occurs at run time.
The services that DirectPlay 7.0 provides can be grouped in five categories:
A DirectPlay session represents, basically, an instance of a game running on a network. DirectPlay session management functions include the ability to create sessions, enumerate currently active sessions on a given network, discover the characteristics of an active session, join an active session, and close a session. Every session has a single host, which is the “owner” of the session. In the case of smaller peer-to-peer games, this host may reside on a player’s machine, but will more commonly reside on a fast server controlled by the service provider. New to DirectPlay 7.0 is the ability to dynamically discover characteristics of a session, including network bandwidth and latency.
DirectPlay does not let the hardware implementation intrude on the game. In keeping with this, DirectPlay works in terms of players, not network connections. As far as the game programmer is concerned, a message is not sent to a specific network address, it is sent to a specific player in the game. This is the most natural way for a game designer to work and allows the most flexibility and growth in terms of network topologies and server architectures. In addition to the ability to create, destroy, and enumerate players, DirectPlay has the ability to get and set game-meaningful data associated with players such as vital statistics. Access to this data is through a simple function call to GetPlayerData; DirectPlay automatically takes care of the messaging details.
Although SetPlayerData and GetPlayerData are the simplest ways to communicate data changes, most game developers will prefer to implement their own messaging strategy on top of DirectPlay’s messaging functions. Send and Receive functions are the most efficient way to send arbitrary data to other players within the game. The design of game message formats is left to the individual development team.
Larger games, and the emerging category of “massive multiuser entertainments,” require the ability to arbitrarily group players, spectators, and moderators. One can imagine grouping people by player type, status, location, and so forth. DirectPlay’s group management capabilities give complete administration, organization, and multicasting abilities in a straightforward manner.
Complex group management is not necessary for smaller games, but in those situations when it is necessary, it can become a major design issue. Because players can belong to more than one group, and because groups can contain other groups, DirectPlay is capable of supporting even the most complex grouping structure.
Many game companies will choose to distribute their games through an established network game service. Other companies, however, may want to exercise total control over the distribution of their games and host their own networks. Until recently, such a decision was prohibitive for all but the most committed and network-savvy companies. The Microsoft Commercial Internet System (MCIS) line of world-class server technologies (code-named “Normandy” during development) removes the formidable technical barriers to such an operation and gives your game company the ability to create a completely customized network presence locally hosted on servers running the Windows NT or Windows 2000 operating system. Windows 2000 is the ideal server platform for game networks, with its combination of familiar interface, simplified administration, development tools, remote administration, and price-performance advantages.
In particular, MCIS’s Chat Server and Membership Server are ideal technologies for game networks. For more information on MCIS technologies, consult www.microsoft.com/backoffice/.
DirectPlay 7.0 is a crucial milestone in the emergence of the online gaming industry. According to an earlier Forrester Research Report on Entertainment and Technology Strategies, online gaming revenues will reach $1.6 billion by the year 2001. Until now, the growth of this industry has been limited by the lack of a clear specification around which game developers, lobby providers, and network engineers could rally. DirectPlay 7.0, by presenting a flexible and efficient hub to which to program, separates these important, but disparate tasks. Individual companies can program to DirectPlay 7.0 secure in the knowledge that their software will run on the widest variety of hardware and integrate with a wide variety of software. DirectPlay 7.0 uses and extends other world-class Microsoft technologies to provide maximum benefit to individual companies without limiting their flexibility in their own field of expertise. For more information on DirectPlay and other DirectX technologies, consult www.microsoft.com/directx/.