Winsock vs. DirectPlay for professional games.

Started by
20 comments, last by Kinslayer 22 years, 8 months ago
For most professional projects you would use C/C++ with WinSock. DirectPlay is not good for beginners. You should learn about networking, and how to write the code for it, so that you can later understand what it is that DirectPlay is (and isn't!) doing for you should you still choose to use it. The BSD socket API has been around a long time now, and is supported on many, MANY platforms(including WinSock). The new MacOS should run socket programs easily if they written against the BSD socket API, since the new Mac is based on FreeBSD. And um, not all Mac users have a Windows machine...(per the previous posters comment about Linux)

Another reason most people don't use DP in commercial products is performance tuning. It's simple, you cannot tune a library shipped by Microsoft without source code. Writing your own network library, you can tweak performance anyway you want. I personally like to write my own queueing code, to take advantage of memory reuse and shared memory. This cuts out the time taken to allocate memory for messages. Remember, memory allocation is about the slowest operation you can do outside of hitting the disk.

The vast majority (all that I know of) of commercial MMORPG are using a UNIX backend. Right there, you lose any hope of running DP. They are running UNIX for good reasons. Whether it's security, scalability, or just the fact that Oracle runs like CRAP on M$ systems...

Now, for hobby developers who have NO intention of ever working in industry, go ahead and use DP and VB. You probably aren't going to have hundreds or thousands of connections to deal with, and the performance might not kick your butt. And if you have fun doing it, then awesome! Keep at it. If you plan to work in industry however, you should invest the time to learn C/C++ and Socket programming.

[edit]
As far as developer friendly, WinSock without a doubt. Now, beginning programmers might like the fact that they get alot of canned functionality out of DP, but developers want the options provided by the actual socket code. There's no such thing as a free lunch Learn about networking before you dive in. It will help you when dealing with bugs in your game, and you will likely be able to get your game running faster. If, after understanding whats actually going on, you determine that DP fits your needs, then go for it.
[/edit]

Good luck whatever you decide to use.

Tim

Edited by - fingh on August 1, 2001 1:06:52 PM
Advertisement
Accessibility:
I am not sure what you mean by this issue.

Compatibility:
DPlay works only on Windows. Sockets work on multiple operating systems.

Security:
Both sockets and DPlay can be as secure as you want them to be.

Developer-friendliness:
This one is in the eye of the beholder.

With the advent of DirectPlay version 8, I very much like DPlay. I can honestly say that I could''nt stand it before. DPlay8 has written most of the core code for you. You do not have to reinvent the wheel. If you are only familiar with DPlay7< then you need to forget everything you know or think about it. Version 8 is a completely new set of code.

I also happen to use sockets. Now, in Windows, I usually only use sockets for things like HTTP,FTP, and SMTP. I used to use sockets for all game communication but then I sat down and learned DPlay8. Now I just use DPlay8.

As far as commercial solutions go, there are professional games written with both APIs.

If you are ever going to port to another OS besides Windows, then you will probably use sockets. Personally, I only write games for Windows, so I use DPlay. My unix code uses sockets (no games though.)

Bottom Line:
Do what I did, learn both, then determine which one to use at the product level. Its kind of like OpenGL vs. D3D. Learn both, figure out which one works best for you and use it. There is no clear-cut answer. Once you have learned one, the other should be easy to pick up.

LostLogicwww.GamerOutfit.comXBox 360 Community Games Reviews and NewsExisled - 2D/3D Shooter for XBox 360

Yeah, I have to agree with what fingh said above. For me, it''s about the tuning issues (and I guess a smidgeon of portability issues though it unclear if we''ll ever port to non-Win).

We went with Winsock on my latest project because we wanted the most control we could get. In retrospect I feel that it was the way to go in light of the things I''ve needed to tweak in the last few month especially.

Using UDP and implementing our own "reliabilty" code on top of that was certainly more work, but it freed us from the contraints of TCP and DP.

I certainly think DP would be easier to get up and running, but I think the control of using straight Winsock was worth it.

-B
If you''re my type of guy that wants to code everything himself then Winsock is definitely THE right choice.
Actually, Winsock is much more simple too - no unnecessary COM interface hassle and excess error checking routines are needed, just simple functions calls. Winsock is just like OpenGL - plain and simple but still feature-rich, whereas DirectX are the opposite. Though you need to do bit more work on sending and receiving properly. Just my 2 cents.
(First, sorry for my English...)

But which big and professional games (in market or development) makes use of DirectPlay 8?

Why others (in development after DP8 is available) does not?

What is the problem in using DirectPlay 8?

Performance of network?

Performance of the server? (Problems in making 'multiservers'?)

...?


Edited by - Jasperodus on August 2, 2001 1:41:53 PM
quote:
But which big and professional games (in market or development) makes use of DirectPlay 8?


I used to know everything of every game a few years ago, but I do not have the time anymore for it, and I only play Unreal Tourney. I can give you one name though: Quadrant Wars

(And yes, that's my own game )

quote:
Why others (in development after DP8 is available) does not?


It's just the decision of the developers. DirectPlay is not multiplatform. Many game engines are therefore written in OpenGL, or something else, that is not dependant on Windows.

quote:
What is the problem in using DirectPlay 8?


There is no problem, as far as I can think, except for the one mentioned above

quote:
Performance of network?


The performance wouldn't be terribly worse than using Winsock. Sure, DirectPlay is using the API, and that will slow it down a bit. It's just making a scripting language in C++. It needs to be interpreted first, which make's it a bit slower.

quote:
Performance of the server? (Problems in making 'multiservers'?)


multiserver: Like having two servers in one application?
- I have no problems with it, Everything works fine for me, and it takes less than 10 minutes to write a complete server in DirectPlay, andif I type really fast, including the Client too.

multiserver: Like dividing the game into multiple servers
- It would be a bit harder, but I've never tried, and do not have any knowledge how DirectPlay performs with it.



Edited by - ajoling on August 2, 2001 3:09:30 PM
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
We could actually talk about security in this context too...
The DP socket layer may be as secure as WinSock (which it is most likely layered on top of anyways), however DP server software will only run on Windows systems. Let''s face it, Windows systems aren''t nearly as secure as some other commercial OS, or even free OS for that matter. CodeRed and VBA come to mind immediately, followed by a host of other simple hacks...

Regardless of what networking API you choose to use, again as noted above, please learn the basics of network programming regardless of the fact that DP takes care of most it for you. I might have to work with you someday. And going from sockets to DP should be a breeze. Going the other way around might cause you some serious headaches. "You mean I have to write my own priority queue? It has to be how efficient?!? Sequence number? What''s that! ACK? " Obviously alot of the programmers here are above this level, however alot still seem to be less experienced and will face setbacks because they failed to grasp the basics and chose to let an extremely high-level library do their work for them...

regards,

Tim/Fingh
quote:
The DP socket layer may be as secure as WinSock (which it is most likely layered on top of anyways), however DP server software will only run on Windows systems. Let''s face it, Windows systems aren''t nearly as secure as some other commercial OS, or even free OS for that matter. CodeRed and VBA come to mind immediately, followed by a host of other simple hacks...


Yes. But those VBA scripts have nothing to do with DirectPlay. The people that get those virues are just a bit stupid that they do ot have adecent virusscanner isntalled, and still open attachments, and/or mail from people that they do not know...

For my packets I''m using RC4/TripleD/TEA/Skipjack/XOR encryption. Also I''m doing some other fancy things... At this state trying to make an aimbot will take lots of time. And these are just 2 of my 10 cheat protection schemes... the difficult thing will be the memory. And that is Windows stuff again, so I have to agree with you a bit on the above statement.

quote:
Regardless of what networking API you choose to use, again as noted above, please learn the basics of network programming regardless of the fact that DP takes care of most it for you. I might have to work with you someday. And going from sockets to DP should be a breeze. Going the other way around might cause you some serious headaches. "You mean I have to write my own priority queue? It has to be how efficient?!? Sequence number? What''s that! ACK? " Obviously alot of the programmers here are above this level, however alot still seem to be less experienced and will face setbacks because they failed to grasp the basics and chose to let an extremely high-level library do their work for them...


I totally agree with that. It''s like trying to make a Quake3 game the first day you''ve learned a programming language, and how to use "Hello World"

www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
You are correct, VBA viruses have nothing to do with DirectPlay per se, however they are an inherent problem with Windows, to which DP is explicitly bound. VBA was just an example of Windows security problems, there are many. Your packets may be safe, but they can not go anywhere if someone nukes your server...

This digresses from the true discussion, WinSock vs DP. I assume since those are the only options listed, that it is assumed that people will be using Window$. I apologize for the digression.

Tim/Fingh
Windows is no less secure than any other system when used properly.

Unless someone can figure out how to send a virus through a DPlay packet there''s nothing to worry about. And unless the Windows system is running anything other than the game server there''s nothing to worry about.

Or if you server allows auto execution of remote scripts.

Someone would have to tunnel through the open DPlay port to get to the system. Or get a torjan on the computer by some other means to open a port. Anyone who can write a multiplayer game should be smart enough to know how to not get a virus.

So no, security isn''t any more of an issue than using Linux or some other OS and Winsock.

Ben

Icarus Independent

Jump Down The Rabbithole

This topic is closed to new replies.

Advertisement