Recent from talks
Nothing was collected or created yet.
DirectPlay
View on WikipediaThis article needs to be updated. (October 2021) |
DirectPlay is part of Microsoft's DirectX API. It is a network communication library intended for computer game development, although it can be used for other purposes.
DirectPlay is a high-level software interface between applications and communication services that allows games to be connected over the Internet, a modem link, or a network. It features a set of tools that allow players to find game sessions and sites to manage the flow of information between hosts and players. It provides a way for applications to communicate with each other, regardless of the underlying online service or protocol. It also resolves many connectivity issues, such as Network Address Translation (NAT).
Like the rest of DirectX, DirectPlay runs in COM and is accessed through component object model (COM) interfaces. By default, DirectPlay uses multi-threaded programming techniques and requires careful thought to avoid the usual threading issues. Since DirectX version 9, this issue can be alleviated at the expense of efficiency.
Networking
[edit]DirectPlay is built on the User Datagram Protocol (UDP) to allow it speedy communication with other DirectPlay applications. It uses TCP and UDP ports 2300 to 2400 and 47624.[1]
Interfaces
[edit]- The primary interfaces (methods of access) for DirectPlay are:
- IDirectPlay8Server, which allows access to server functionality
- IDirectPlay8Client, which allows access to client functionality
- IDirectPlay8Peer, which allows access to peer-to-peer functionality
- Secondary interfaces are:
- Various lobby interfaces that allows players to find and prepare a game before it actually commences.
- Thread management interfaces that allows the programmer to fine-tune resource usage. This also allows for a general disabling of worker threads so that tricky multi-threaded issues are avoided at the cost of decreased responsiveness.
- Various network address translation (NAT) interfaces that make it easier for players behind routers to host games. Most players on broadband internet connections face this problem.
- Various voice communication interfaces known as DirectPlay Voice that make it easier to support audio communication and voice input in games.
- Various queue monitoring interfaces that allow the application to get feedback on how much data has been sent and received as requested. This allows an application to decrease/increase the amount of data sent in accordance with the capabilities of the receiver.
DirectPlay Voice
[edit]DirectPlay Voice was introduced in Windows Me as part of DirectX 7.1 for multiplayer games.[2] It is a voice communications, recording and playback API that allows gamers to use voice chat in games written to take advantage of the API, through a DirectPlay network transport session itself.
Current status
[edit]DirectPlay was traditionally one of the components of DirectX that received less attention, but for DirectX version 8 it received a major overhaul and became a relatively lightweight networking library. However, as part of Microsoft's unveiling of XNA in 2004, Microsoft announced that DirectPlay would be deprecated in favor of Games for Windows - Live technology already available on Xbox and being ported for use on Windows PCs. DirectPlay was supported in DirectX DLLs for the lifetime of Microsoft Windows XP. However, starting from the autumn of 2007, the headers and libraries — vital components if developers wanted to develop new programs utilizing the technology — were removed from the DirectX SDK.[citation needed]
In Windows Vista, DirectPlay has been deprecated and DirectPlay Voice and DirectPlay's NAT Helper have been removed.[3] In Windows 10, DirectPlay is fully deprecated, and modern game development has transitioned to more current technologies like Xbox Live and other networking APIs.[citation needed]
See also
[edit]References
[edit]- ^ "[MC-DPL4CS]: DirectPlay 4 Protocol: Core and Service Providers". 23 April 2024.
- ^ "Microsoft DirectX to Feature Real-Time Voice Technology". Microsoft News Center. 2012-10-23. Archived from the original on 2012-10-23. Retrieved 2020-01-25.
- ^ White, Steven. "DirectX Frequently Asked Questions - Win32 apps". Windows Dev Center. Archived from the original on 2020-01-25. Retrieved 2020-01-25.
External links
[edit]- Microsoft's DirectPlay documentation
- Microsoft DirectX 9 The last SDK to ship with DirectPlay headers and libraries.
Some alternative libraries which serve the same purpose as DirectPlay
- HawkNL at the Wayback Machine (archived 2014-07-08)
- OpenTNL at the Wayback Machine (archived 2016-04-23)
- Raknet
DirectPlay
View on GrokipediaIntroduction
Overview
DirectPlay is a high-level, COM-based application programming interface (API) developed by Microsoft as part of the DirectX multimedia suite, primarily intended for implementing multiplayer networking in games and other applications on Windows platforms.[5][1][6] Its core purpose is to facilitate peer-to-peer and client-server connectivity, allowing applications to exchange messages efficiently over diverse transport protocols such as IP networks, modems, or serial links, while abstracting underlying complexities like network hardware variations and NAT traversal through mechanisms including UPnP support.[7][8] It relies on UDP for communication, utilizing ports in the range of 2300–2400 for general data transmission and port 47624 for session enumeration.[9] By encapsulating low-level socket programming and providing tools for session management, user handling, and reliable messaging, DirectPlay significantly simplifies the development of multiplayer features, enabling developers to focus on game logic rather than network intricacies. Core functionality is exposed through COM interfaces such as IDirectPlay8, which evolved across DirectX versions to support these capabilities.[7]Development History
DirectPlay was first introduced with Microsoft DirectX 1.0 in September 1995, with significant updates in DirectX 5.0 released in August 1997, serving as a basic networking layer designed to simplify multiplayer connectivity for games by abstracting low-level network protocols.[10][2][11] This initial implementation focused on session-based multiplayer support, enabling developers to create reliable connections over LANs and modems without deep networking expertise.[12] A significant overhaul occurred with the release of DirectX 8.0 in November 2000, shifting DirectPlay to a peer-to-peer model through the new IDirectPlay8 interfaces, which replaced the earlier session-based approach with more flexible, scalable messaging capabilities.[13][14] This update emphasized client-server and peer topologies, improving support for internet-based multiplayer games. DirectPlay Voice was added in DirectX 7.1, released alongside Windows Me in September 2000, to enable in-game voice communication over network connections.[15] Microsoft announced the deprecation of DirectPlay in 2004, coinciding with the introduction of the XNA Framework, signaling a transition away from the API in favor of newer cross-platform development tools.[16] The headers and libraries for DirectPlay were subsequently removed from the DirectX SDK in the August 2007 release, marking the end of official development support.[17] DirectPlay received full support in Windows XP, including all core features and extensions like Voice and NAT Helper. In Windows Vista, support became partial, with DirectPlay Voice and the NAT Helper component removed due to security and architectural changes. On modern platforms such as Windows 10 and 11, DirectPlay operates in legacy mode, available only through optional installation via the "Legacy Components" feature in Windows settings.[15][18]Technical Architecture
Networking Model
DirectPlay's networking model is founded on a User Datagram Protocol (UDP)-based transport layer, enabling low-latency, connectionless communication ideal for real-time multiplayer gaming applications. This foundation prioritizes speed over inherent reliability, as UDP does not guarantee packet delivery, ordering, or error correction; instead, DirectPlay allows developers to opt for reliability on specific payloads through protocol-level mechanisms such as sequence numbers assigned to each packet and acknowledgments (ACKs) from recipients. Reliable payloads trigger retransmissions if not acknowledged within a timeout period or if gaps are detected via selective ACKs (SACKs), while unreliable payloads are discarded upon loss to maintain performance. A sliding window mechanism limits the number of unacknowledged packets in flight, preventing network congestion.[19] The model accommodates diverse connectivity modes to support various hardware and network environments, including Internet Protocol (IP) over both TCP for reliable streams and UDP for datagrams, Internetwork Packet Exchange (IPX) for LANs, serial cable connections for direct peer linking, and modem dial-up for remote sessions. For IP-based setups, particularly in NAT-constrained networks, DirectPlay incorporates traversal aids like the NAT Locator protocol extensions and the DirectPlay NAT Helper component, which negotiate port mappings and enable peer discovery without manual configuration; these were effective for pre-Windows Vista systems but removed in later versions due to evolving networking standards. Service providers abstract these modes, allowing seamless switching between transports while maintaining a unified API for data exchange.[20][7] Session management in DirectPlay revolves around flexible topologies to synchronize multiplayer interactions, including peer-to-peer configurations where each participant maintains direct connections to others for decentralized messaging, client-server hierarchies that route all traffic through a central host for authoritative control, and group-based addressing for broadcasting updates to subsets of players. These structures ensure efficient data propagation, with the host overseeing session lifecycle events like player joins and departures. Keep-alive packets, sent periodically as empty reliable frames, maintain connection viability during idle periods.[21][22] To integrate with performance-sensitive game engines, DirectPlay emphasizes multi-threading compatibility via asynchronous operations, where receive and send callbacks execute on worker threads without blocking the primary game loop, thus supporting non-blocking I/O for continuous rendering and input handling. Default port allocation includes the range 2302–2400 (UDP/TCP) for active sessions and 47624 (UDP) for host enumeration queries, with developers able to override these via address components for custom firewall rules.[23][24]Core Interfaces
DirectPlay's core functionality is exposed through a set of Component Object Model (COM) interfaces, primarily designed for developers to implement multiplayer networking in applications. These interfaces form the foundational building blocks for creating, managing, and communicating within sessions, supporting both peer-to-peer and client/server models. They rely on asynchronous message handling and transport abstraction to enable reliable data exchange over various network protocols.[25] The primary interfaces for session management include IDirectPlay8Peer, IDirectPlay8Client, and IDirectPlay8Server, each tailored to specific networking topologies. The IDirectPlay8Peer interface facilitates peer-to-peer sessions, where any participant can host or join without a dedicated server; key methods includeHost to initiate a session, Connect to join an existing one using a provided address, SendTo for targeted message transmission to specific peers or groups (supporting both synchronous and asynchronous modes), and message reception handled via callbacks. This interface is instantiated via CoCreateInstance with the CLSID_DirectPlay8Peer, followed by Initialize to bind a transport provider such as TCP/IP.[26][27][28]
In contrast, IDirectPlay8Client supports client-side operations in a client/server architecture, created using CLSID_DirectPlay8Client and initialized similarly; it features Connect to establish a connection to a server address, Send to transmit data to the server (with options for reliability and ordering), and Receive integration through system messages like DPN_MSGID_RECEIVE, where applications must manage buffer ownership via ReturnBuffer. The IDirectPlay8Server interface, instantiated with CLSID_DirectPlay8Server, enables server-side hosting with methods such as Host to start the session, Send for broadcasting or unicasting responses to clients, and group management functions like CreateGroup and DestroyGroup to organize participants. Both client and server interfaces emphasize centralized control, with the server handling authentication and session state.[29][30][31]
Addressing and discovery are managed via IDirectPlay8Address and IDirectPlay8EnumHosts. The IDirectPlay8Address interface abstracts network endpoints as URL-like strings (e.g., "x-directplay:/protocol:ip:port"), with methods like BuildFromURL to construct addresses from strings and GetURL to serialize them, allowing seamless integration with transport providers for device or host specification. Host discovery employs IDirectPlay8EnumHosts, created through CoCreateInstance with CLSID_DirectPlay8EnumHosts; its EnumHosts method asynchronously queries available sessions based on application GUIDs and filters, invoking a callback to process results for connection decisions.[32][33]
Event-driven communication is achieved through the IDirectPlay8MessageHandler callback interface, which applications implement to process incoming data and system events; it includes HandleMessage for user data reception and HandleEvent for notifications like player joins or disconnections, ensuring non-blocking operation. All core methods return HRESULT codes for error handling, where S_OK indicates success and values like E_FAIL or DPERR_* denote specific failures, requiring developers to check returns and propagate errors appropriately. The overall programming model involves COM instantiation, provider initialization, session setup, and looped message dispatching, abstracting underlying UDP-based transports while providing guarantees for message delivery and ordering.[34][28]
