Archived

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

Kinslayer

Winsock vs. DirectPlay for professional games.

Recommended Posts

Kinslayer    122
Forgive me for making a post about the oldest and most flogged subject in the forums . I''d like to assemble everybody''s thoughts in one coherent thread (please no off-topic posts). Please bear in mind that I am not trying to generate the general differences between these two methods of network communication. What I think is more interesting is a discussion on which is a better choice when developing a professional game where issues of accessibility, compatibility, security and also developer-friendliness are major issues.

Share this post


Link to post
Share on other sites
KalvinB    102
DirectPlay is far more developer friendly than Winsock. Those of you who can''t get it going...I got it going in 2 hours having never used it before. Winsock would have taken months to develop libraries that DPlay has prewritten.

Accessability? Not sure what you mean.

Compatability is a loaded question. Most people who have Linux also have Windows so it''s not an issue consumer side. If you care about compatibility then you have to use Winsock.

Security in games is a prorgamming issue not a WinSock or DPlay issue. Though DPlay allows enxrypted packets with no additional programming.

Ben
http://www.icarusindie.com

Share this post


Link to post
Share on other sites
Shannon Barber    1681
I''m curious how the DP client/server scales.

It''s the same old story, if you can live with the limitations of existing code then use it; if you can''t then, well, it''s a long road to make your own so make sure you can''t live with those limiations.

DP features:
Standardized Lobby Support
Packet reliability settable per packet
Priorized Packet Queue
Multi-threaded network handlers
Voice Chat support

Winsock features:
Works on non-windows machines


Some time ago, the guys working on DP kicked around the idea of opening up the protocol so that servers could be made for other OS''s, but I don''t think it ever materialized.

I had a winsocket connection in about 20minutes. It took several hours with DP. For how easy it makes the other features, you''d think connecting wouldn''t be a big deal...

Share this post


Link to post
Share on other sites
KalvinB    102
The scaling is the only thing I''m not sure about. I had 12,000 NPCs running around using a single connection and it handled fine. It took about 16 seconds to get them all updated. That''s about 53KB per second. 72Bytes per character * 12,000 / 16

I doubt that''s a DPlay limit. WinME blows for CPU intensive apps which the NPC client was running on. I should be able to update all 12,000 within 5 seconds. Which would allow me to split the work onto 5 computers which is acceptable.

I''m going to do more testing but that basically shows that bandwidth won''t kill you.

I still need to test connections though as more are added there''s no real decrease in server speed.

I think the connection limit is based on the speed of the processor and the amount of memory as well as how intensive the server program is.

2 hours to get a DPlay connection isn''t too bad considering once you have the connection there''s really nothing left to do. Figuring out how to do dynamic size messages took only an hour or so and that was it. I havn''t touched DPlay since.

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
In a past thread "Heh, Sweeney''s opinion on DirectPlay", the thread creator (civguy) quoted Sweeney from an interview. Anyone have a link to the full interview?

Share this post


Link to post
Share on other sites
ajoling    202
That article is only an opinion, which I think is incorrect. and besides, DirectPlay8 can''t be compared in any way to previous versions

Almar

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
The DX 7.0 version of DirectPlay had security measures and support for message encryption etc... I can''t find any mention of these features in DirectPlay 8.... are they still implemented in the API?

Share this post


Link to post
Share on other sites
ajoling    202
No, I searched for it today, and couldn''t find it myself. I''ve searched for some nice encryption methods, like RC4, TripleD, BlowFish, TEA, and choose one that performed best for me without making the packetsize too big... I''ve just let it run over the byte buffer that DP8 uses (-in VB)

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Shannon Barber    1681
Sorry for the off-topic post, but you can execute a VBScript trojan ust by reading an eMail - or just looking at it in the preview pane in Outlook. Outlook allows "stationary" to be attached to an email, which is html code that is displayed in the background. A vbscript can be stuffed inside the stationary that can do whatever it wants; twiddle the registry, download other files, delete stuff, whatever...
If you set Outlook to use the "restricted" internet zone it disables or prompts to execute scripts. By default Outlook runs in the trusted zone, or medium security i forget - that allows the scripts to run unannouced.

...
In DP8 you have to implement your own packet queue; I hear previous version did this for you. DP8 was supposedly redesigned with MMORPGs in mind. And by setting a couple of flags, I think you can remove any extra information DP would normally attach to the message (like DPNIDs etc...).
So all DP8 is, is a packet sender & receiver. There''s nothing to stop you from using DP8 right away and reimplementing the network code to send and receive the same messages later using WinSock when/if desired. Take the OOD approach, and it''ll be painless.

Magmai Kai Holmlor
- Not For Rent

Share this post


Link to post
Share on other sites
DarkTerrax    122
Ummm... how is getting an outlook VBScript virus a security concern on a server?

I don''t use any of my servers for checking my personal mail. As was mentioned before, windows is no less secure if used properly.

I do have a quick question about DPlay, can DPlay and winsock be mixed and matched? If client uses DPlay, is the server then forced to? Or can the DPlay client communicate with a Winsock server?

Share this post


Link to post
Share on other sites