DirectPlay or Socket

Started by
11 comments, last by Robinhood 19 years, 10 months ago
I want to develop a small net game(small scale game but many players),but I don''t Know which to choose.
Advertisement
I personally have not use DirectPlay but I found WinSock easy enough to use. I started reading a DirectPlay tutorial but it seemed like more hassle than it was worth. You''re probably best with WinSock for a small application (assuming Windows).

Red Sodium
Build a man a fire, and he''ll be warm for a day. Set a man on fire, and he''ll be warm for the rest of his life. - Terry Pratchett
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius
Basically, DirectPlay is just a wrapper around winsock. Since professional game developers knew this, most of them decided to go straight to winsock, instead of dealing with dplay and all of it''s overhead. As a result, nobody uses dplay, since it''s just easier (and faster) to just use winsock. This is why Microsoft is no longer supporting or updating DirectPlay.

The answer: go with winsock.


Dustin Franklin
Mircrosoft DirectX MVP
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Tip: Learn UDP instead of TCP with WinSock. It''s less code and most games use it.

--
You''re Welcome,
Rick Wong
- Google | Google for GameDev.net | GameDev.net''s DirectX FAQ. (not as cool as the Graphics and Theory FAQ)
Seriously, Pipo? I thought UDP was best for things such as streaming and file transfer. Oh well, you are obviously more correct.

Red Sodium
Build a man a fire, and he''ll be warm for a day. Set a man on fire, and he''ll be warm for the rest of his life. - Terry Pratchett
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius
The book ''Advanced 3D Game Programming with DirectX 8.0'' by Peter walsh has a decent chapter on UDP (it actually has nothing to do with dx, so I don''t know why it''s in there).

You should actually be using UDP because, like pipo stated, it''s less complicated. UDP is like a bare-bones version of TCP. It''s much smaller, and much faster. However, TCP adds a lot of stability to your network transmissions, where UDP isn''t as reliable.

Most (if not all) professional games use UDP.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Although DirectPlay isn't perfect, there ARE commercially released games using it!.

DirectPlay does provide extra functionality such as NAT support, session management, lobbying and voice communication. If you need that functionality, with sockets you'll need to implement it yourself. Additionally DirectPlay comes with tools for simulating various networking scenarios and connection types.

If support for DirectPlay is dropped altogether (as opposed to being "feature frozen"), IMO it'd be likely that a replacement would be released - likely tied into XNA.


The main advantages of sockets are the lower-level control over the connection and they're cross platform which may be handy if you're going for client-server based architechture where the persistent server stuff has to run on a flavour of *NIX.


On the UDP vs TCP issue, you'd likely want to use BOTH. Which one you use depends on what the purpose of the data being communicated is. For lobbying and setting up the session you'd probably want TCP for its guaranteed (but slow) nature and less reliable (but fast) UDP with your own dead-reckoning plus packet verification for the in-game packets.


Whichever you decide to go for (sockets or DirectPlay), do pay particular attention to the security of your code and make sure it works properly with firewalls (such as the one built into Windows XP and enabled by default in SP2).

Simon O'Connor
Game Programmer &
Microsoft DirectX MVP

[edited by - s1ca on May 31, 2004 8:50:42 AM]

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Couldn''t you use reliable UDP packets to send such information?

--
You''re Welcome,
Rick Wong
- Google | Google for GameDev.net | GameDev.net''s DirectX FAQ. (not as cool as the Graphics and Theory FAQ)
It''d be far easier to just use TCP/IP. You could implement a reliable UDP protocol, but then you need to spend time implementing it and testing it. The lag you get with TCP/IP doesn''t matter too much in lobby servers, since you''re just trying to match people up.

quote:Original post by S1CA
Although DirectPlay isn''t perfect, there ARE commercially released games using it!.
Really? Do you know which games use it? Now that I think about it, I think the Microsoft Flight Simulator series uses DirectPlay.

On the XNA topic, I bet that Microsoft will do just that. It should be very exciting, especially the merging of the XBOX and the PC. It''s probably going to involve a lot of gameplay decisions by the developer, though. For example, the XBOX will always have a disadvantage in first person shooters, since it doesn''t have a mouse (yet ).
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )

This topic is closed to new replies.

Advertisement