Pro in DirectPlay, newbie to Winsock API

Started by
3 comments, last by Almar Joling 23 years, 6 months ago
Title: Pro in DirectPlay, newbie to Winsock API Hi, I''m working on a MMOG game named Quadrant Wars. For this game I''ve always been using DirectPlay. But, DirectPlay was annoying more more and more lately. It lacks the functions I need (Like sending data before a connection). I''ve created a "Lite" version of my game, containing only multiplayer code. This still uses DirectPlay. Now I''d like to port this to the Winsock API. I''ve already spend a day on it, preparing the decalrations and adding comments to it what it does. I also think that adding the code for sending and receiving shouldn''t be any problem too. (Btw, I''m using VB6, and have lots of experience with the Winsock control) But, I do like to hear some other information about the Winsock API. I think the most Winsock programmers can tell me :o) (If needed, I can read Pseudo code, and also understand a bit C) 1) If I want to sent messages to every one in my game. Do I just make a For...Next loop like this?: For I = 1 to intTotalPlayers SendSomething (Message, Socket(I)) Next I 2) I''m a bit confused with all those names. A SOCKET connects to a PORT. Can 40 SOCKETS connect to one port? 3) Is it true that it''s only possible to have 64connections/thread? Or can I just set FD_SETSIZE to something else? 4) Sending data(UDP) at a fast rate, will this mess up messages? (two msgs become one?) 5) Is there anything special I should know? Very much thanks in advance, Almar
Advertisement
I don''t normally suggest this, but if you already know and like DirectPlay, DirectPlay 8 is a complete overhaul of the API. Great new features. DX8 should be out in a matter of weeks, we''re already in RC1 on the beta which will probably be the last RC.

I personally think that DPlay is an easier interface than Winsock if you''re using VB. To get really high performance from Winsock, you''d probably want to go with overlapped I/O and I just can''t see a good way to do this in VB. I''m sure there are controls out there, but I dunno.

A Socket is a handle to a send/receive point. Think of it as a file that when written to, the data is sent across the network. Just as every file on a system has a unique path and file name, each socket has unique IP addresses and Ports(there are exceptions, but it''s not important for normal use).

You can have MANY more than 64 Sockets open in a thread, what you''re refering to is the limit on the number of sockets you can call select() on. If the Winsock control uses select() then I suppose that limit would be accurate for it.

UDP packets _NEVER_ get combined or fragmented like you''re talking about. One send() = one recv() with UDP.

Like I said, if you were writing your App in C/C++, I''d say go ahead and learn Winsock, but with it being in VB, I honestly think that you might get better performance with DirectPlay. And DirectPlay 8 is much nicer.

Good Luck,
Jon


If you are trying to send from one network entity to all others, you may want to use multicast instead of your loop. With multicast, you do not need to worry about how many entities are receiving it. Time to send remains constant.

You may want to read "Windows Sockets Network Programming" by Quinn and Shute. They do a very good job of explaining windows sockets.
The problem with multicast is that you can''t rely on the average ISP to support it. Most of them only offer it as some kind of premium or at least some kind of request. In a talk with Bob Quinn, he explained that he believed less than 1/2 of all users had access to Multicast.

http://www.sockets.com has some good information on the Multicast initiative and its'' progress.
Thanks.

I''ll have another look at DirectPlay8.
That was actually my first plan, but it''s delayed :o(

Almar

This topic is closed to new replies.

Advertisement