🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DP Groups

Started by
8 comments, last by dachande 22 years, 6 months ago
Hey, Could some one give me a small example of using groups in Direct play 8? The dx docs aren''t very insightful This would be much appreciated, Thanks, Dachande
Advertisement
I think directplay groups are the worst part of the directplay interfaces. The function you call to create them doesn''t get the DPNID of the group you created, instead you have to retrieve that from your server or peer''s message handler. It''s just more difficult than if you create your own groups.
How does DP handle sending to groups?

I am thinking that using a SendTo function to send data to each client in the ''group'' will be slower than using direct plays groups, which I assume handles it differently.

So for speed reasons, as far as I can see... I will still need to use Direct Plays group functions... which leads me to needing an example still

Any other suggestions?

Thanks,

Dachande
There''s no performance gain (from a networking perspective) from sending to groups vs. sending to multiple clients. DirectPlay 8 doesn''t use multicast or broadcasts for any of that, so sending to a group still results in DPlay sending one message to each of the clients in the group.

It''s feasible that in the future, they could use multicast or broadcasting or some type of intelligent branching for sending to multiple members of the session, but for now they don''t do it. My thoughts are that they will clean up the group creation a bit before they add any of those enhancements.

For now, all you need to do to work with groups is call CreateGroup(), then handle the DPNMSG_CREATE_GROUP message in your message handler. Call AddPlayerToGroup to add a client to a group, then you can send to that group all you want. When you''re done, DestroyGroup() destroys the group and frees resources.

Not sure what kind of examples you want, any specifics?
Search for my name... I believe I once posted VB code for this.
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/>
Thanks,

but what I''m looking for is examples of the functions in use.. with all the parameters being used.

I know which functions to call... I''m just not totally sure about what the functions want, and how to get the information I want from them.

If anyone has used groups, a quick cut and paste job would be great

Thanks,

Dachande

BTW... If using goups is the same as using a sendTo to all clients... then there is still one advantage to groups that I can see. You only add one send messge to the list, so yuor not clogging up your system. This is correct enless dp converts yor one send to multiple items on the list that is.
Well, about the message allocation:

That''s probably correct. But if you want to prevent buffer copies etc... I''d suggest creating a message class that supports reference counting and use the DPNSEND_NOCOPY flag in your send / sendto calls. Then just call AddRef() during the send, and Release() in the DPNMSG_SEND_COMPLETE handler. That way, you can send the message to as many clients / peers as you want with the same copy of the message.
Thanks, but I''m still looking fora good c++ example of using dp8 groups
quote: dachande wrote:
BTW... If using goups is the same as using a sendTo to all clients... then there is still one advantage to groups that I can see. You only add one send messge to the list, so yuor not clogging up your system. This is correct enless dp converts yor one send to multiple items on the list that is.


Hi, I think your missing what DP is doing when you send to a group. I''m not completely sure but I think all DP is doing underneath is calling sendto() for each member of the group. So, there really isn''t much of a performance gain.

Someone correct me if I''m wrong here but from my understanding of Multicast - it''s really dependent on the network that your on... the routers do all the work for you when you send a multicast message. Games that are played on LANs may be able to take advantage of multicasting but games that are played on the internet are limited at this point to using multiple sendto() commands.


I will say this much... Back in ''96 I was convinced that DP was the way to go for network programming. I was with a startup company and started implementing the network portion of the game with DP. About two months into the project - I decided that DP wasn''t what we needed. Sure the lobby is nice and it''s pretty easy to get that stuff working but I just needed more ability to control what was actually going on. I switched to UDP using winsock. I will caveat this by saying that that was over 6 years ago and I haven''t looked at what DP has to offer now...




Dak Lozar
Elysian Productions, Inc.
Dave Dak Lozar Loeser
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous
Dak is right about multicast, there is an initiative called ''mbone'' which is setting up a multicast backbone for use on the internet. It still isn''t very often used. But DPlay doesn''t use multicast at all in DX8. Every client you send to is a unique message/packet.

This topic is closed to new replies.

Advertisement