Archived

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

MatuX

WinSock or DirectPlay?

Recommended Posts

The real question is another one (I didn''t know how to describe it in the subject ). So, what does most MMORPG uses to estabilish connections between computers? Do they just use DirectPlay? they work with WinSock 2.0? Do they code from scratch all the TCP/UDP system? I need to clear a little my path because I don''t want to start learning something that will make me lose my time. Thanks!

Share this post


Link to post
Share on other sites
Unfortunately there is not a "normal" way to create MMORPGs. Each implementation seems to vary greatly.

You can use DirectPlay if you want. DX8 has made DPlay much more robust and easier to use in my opinion. The main benefit to DPlay is that you do not have to "reinvent the wheel." It has a built-in mechanism for guaranteed packets (ordered also.) It also has grouping and lobbying mechanisms already created for you. The downside happens to be the upside. The fact that DPlay handles much of the work for you can be a negative for teams who want to create everything on their own. It also doesnt support UNIX/LINUX.

You can use Sockets if you want. The upside to sockets is that you have complete control over your network code. You can use UDP or TCP/IP. You get to write your own guaranteed mechanism for UDP if you want. It is also portable to UNIX/LINUX. The downside to sockets also happens to be the upside. You have to create much of the functionality on your own. The built-in libraries are meant to get the job done, not make it easier for you.

So, the bottom line:

PROS
1. DPlay handles much of the complexity for you by including functionality.
2. Sockets gives you complete control and works in UNIX/LINUX.

CONS
1. DPlay is not geared towards low-level socket type connections such as FTP or HTTP. It also doesnt work in UNIX/LINUX.
2. Sockets are not designed strictly for games;therefore, you have to create much of the functionality yourself (or use a pre-built library.)

Personally, I use both. I use DPlay for my game communication and I use sockets for FTP/HTTP/HTTPS type calls. I also use sockets for any UNIX solutions I develop.

THE BOTTOM LINE
You should try both methods and see which one best fits your needs. Regardless of what the evangalists may tell you, there is no magic bullet when it comes to game communication.

As for losing time, proper design and implentation of a MMORPG can take several "man" years. So, I wouldnt worry about sacrificing a little R&D time for a better product in the long run.


LostLogic
www.lostlogic.com
Author, Multiplayer Game Programming

Share this post


Link to post
Share on other sites
Thanks for the info, LostLogic

The game is already designed and running, the ugly stuff is that it uses something called "SocketWrench" which is an OCX that handles all the communication stuff using the TCP protocol. It didn''t give us any problem until now (+200 persons online), it starts to make the whole program not responding while trying to disconnect (somewhat)large amount of sockets at the same time.
So, we''re looking for a more professional way to handle the connections. And it would be neccessary to have it ready quickly, so, every second counts

BTW, it''s a 2D rectangular with pseudo 3d view ala Ultima 7.

Another question, anybody knows what API does Ultima Online uses to estabilish their connections?

Share this post


Link to post
Share on other sites
Since you are already using a sockets wrapper (I suppose that is what SocketWrench is,) you would probably be best off implementing "straight" sockets.

UDP is preferred for speed reasons. The main pain you will have to endure is to create your own guaranteed packet mechanism. Other than that, UDP is pretty easy to implement. Most other game developers I have talked to use it.


LostLogic
www.lostlogic.com
Author, Multiplayer Game Programming

Share this post


Link to post
Share on other sites
"The main pain you will have to endure is to create your own guaranteed packet mechanism."

Do you mean, developing a way to ensure the data reaches "in one piece"? (I know UDP isn''t realiable and it loses packets).

If that is what you mean, doesn''t DirectPlay8 has somewhat solved it in an easy way? (so I don''t have to code all the packet lost/recovery manually).

Share this post


Link to post
Share on other sites
Every version of DPlay has packets guarenteed to reach their destination 100% in tact if you want. You can go nonguarenteed as well which means they may not get there but if they do, they''ll be 100% in tact.

DPlay isn''t documented worth anything though. Getting it initialized is the challenge. Once it''s going, everything is easy. I used dpconnect.cpp and managed to get two computers connected within a couple hours.

Ben
http://therabbithole.redback.inficad.com

Share this post


Link to post
Share on other sites
Isn''t LostLogics book supposed to get you up and running with DirectPlay though? I bloody well hope so, cos I''ve pre-ordered it!



RM.


-=Kicking Butt and Writing Code=-

Share this post


Link to post
Share on other sites
MatuX,

I meant that if you do not go with DPlay, you will have to write your own guaranteed mechanism for UDP.

DirectPlay does include a guaranteed mechanism. That is one of the reasons I like it.

RageMatrix,

YES! It does show you how to use DPlay 8.0 as well as sockets. If you preordered it, you should have it any day now since it has been shipping for a week now. Let me know if you have any problems/questions with it.


LostLogic
www.lostlogic.com
Author, Multiplayer Game Programming

Share this post


Link to post
Share on other sites