Archived

This topic is now archived and is closed to further replies.

DirectPlay or Socket

This topic is 4943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 ).

Share this post


Link to post
Share on other sites
quote:
Original post by circlesoft
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.



Two of the games I''ve worked on (the only ones that had network/internet support) use it, Pac-Man:Adventures in Time [Hasbro Interactive/Infogrames] and Rally Championship [Actualize/EA].

The following Microsoft games are meant to use DirectPlay:

Age of Empires
Age of Empires II: The Age of Kings
Age of Empires Expansion: The Rise of Rome
Age of Empires II Expansion: The Conquerors
Age of Empires II Gold Edition
Allegiance
CART Precision Racing
Close Combat for Windows
Close Combat: A Bridge Too Far
Close Combat III: The Russian Front
Combat Flight Simulator: WWII Europe Series
Combat Flight Simulator 2: WWII Pacific Theater
Flight Simulator 98
Flight Simulator 2000
Golf 1998 Edition
Golf 1999 Edition
Golf 2001 Edition
Links LS 2000
Links 2001
MechCommander 2.0
MechWarrior 4: Vengeance
MechWarrior 4: Mercenaries
Midtown Madness 2
Monster Truck Madness
Monster Truck Madness 2
Motocross Madness
Motocross Madness 2
StarLancer
Urban Assault

Some others which are meant to use DirectPlay (from a quick Google - but I can''t confirm):

Dungeon Siege
Civilization 3: Play the World
Homeworld 2
Commandos 3
Commandos 2
Railroad Tycoon 3
Industry Giant 2
Total Annihilation
Sacrifice
Sudden Strike I and II
Starfleet Command 2: Empires At War
Starfleet Command 2: Orion Pirates
Star Wars: Galactic Battlegrounds
Baldur''s Gate
Sega Rally 2
Icewind Dale
Heroes of Might and Magic 3
Diablo II
BattleCom v0.1
M1 Tank Platoon II
Worms 2
Aliens vs. Predator

BTW on the issue of UDP vs TCP or both, the following may be of interest: http://www.u.arizona.edu/~trw/games/ports.htm

Share this post


Link to post
Share on other sites
I second S1CA - DirectPlay provides a lot of functionality built on top of WinSock that you may well want. I wrote a LAN chat app recently and decided to go with DirectPlay because it meant I could get up and running very quickly (and I did - took me about 20 minutes to implement the entire network code for my app).

TCP and UDP aren''t totally interchangable, so it''s not really a question of learning one over the other. Again, I second S1CA - you''ll probably want to use both, TCP for the important but infrequent messages (e.g. player joined game, map change, chat command) and UDP for the less important but more frequent messages (player moved). A key criterion is asking what happens if a message is lost - in the case of a ''player moved'' message, having the message contain the absolute coordinates of that player means that it''s not a problem if a message is dropped, because it''ll be corrected the message afterwards.

One other thing to note is that you may find it difficult networking DirectPlay-based apps with non-DirectPlay-based apps, as you may need to do if you want to support platforms other than Windows. Because it''s all on sockets it''s theoretically possible, but DirectPlay uses a protocol which AFAIK is proprietary for MS. So you''d have to reverse-engineer that, which may be both difficult and against the terms of the license (IANAL).

Share this post


Link to post
Share on other sites
quote:
Original post by S1CA
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

Dear Mr.O'Connor,

I want to contact you.
Could you tell me your email address?


Sungkwan Park
My Email : skpark@softweb.co.kr
My MSN Messenger : sungkwanpark@hotmail.com
My Phone : +82-11-256-9917

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




[edited by - softweb on May 31, 2004 1:04:44 PM]

Share this post


Link to post
Share on other sites