Archived

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

DirectPlay or Sockets?

This topic is 5668 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sometime in the future I plan on making an online tile based chatroom in which you control a character and interact with other people. The graphics and input will both be DirectX oriented. But now I need to know which way to go. Should I use DirectPlay or Windows sockets (or any other means of networking tools not DirectX based)? Here''s a list of what I''m looking for: 1. I have no need for a lobby, and I would prefer that I avoid a one at all costs. Yet I''m not entirely sure how it works, so I''d like a good explaination on what a lobby functions like. 2. Full power of communication is another thing. Maybe sockets have something that DirectX doesn''t. Or maybe computer support is an issue. I want to make sure that I can get a wide audience of people that can all use that chatroom. 3. Speed. The chatroom isn''t going to be very complex at all, maybe it''ll even use a 256 color palette. Even if that is the case, will I have to worry about the speed of the application if I go with sockets? 4. Simplicity. I heard neither DirectPlay or sockets are easy to work with, but it''s the lowest concern I have. I hate MFC, yet if that is the only way to use sockets, I''ll be okay, I just won''t like it. 5. Program distribution. If I want to give the chatoom to anyone for free, will I have to register anything? Do I need permission from anyone? This is what I hate the most. I''d just like to give the program without any technical and legal trash.

Share this post


Link to post
Share on other sites
I just recently got the book "Multiplayer Game Programming". Pretty good book so far, by the way.

He mentions that DirectPlay does a lot of things automatically, so you have somewhat less control. Also, DirectPlay is Windows only, so UNIX servers can''t take advantage of it (some say UNIX is more stable).

I would say if your chat program isn''t going to take a lot of huge intensive management of any sort, you''ll probably be ok with DirectPlay and save yourself the trouble of coding some things from scratch.

Share this post


Link to post
Share on other sites
I''ll be honest, while I''m tolerant of most API''s and libraries, I ''hate'' DirectPlay (as much as one can ''hate'' something like that). My advice is to not use DirectPlay unless:
  • You''re going to use most or all of its features. Otherwise it''s just added effort for what you could through together in Winsock.
  • You''re 100% sure you''ll never want a Mac or Unix server or _client_ ever connecting with your game.
  • You''re 100% sure you''ll never reuse the code you''re writing for a project that might have potentially had a Mac or Unix server or client.

    Share this post


    Link to post
    Share on other sites
    As you present it, I''d use directinput, directplay and plain sockets. Sockets are easy to use (you don''t need MFC btw) and will not slow down your game. Anyway, you''ll probably need (or want) a separated thread to handle comunications.

    As Null and Void, I think that DirectPlay is not a friendly API to deal with... I only see a good thing and is its management of something-like-DSM (Distributed Shared Memory).

    Plus, if you use sockets you can easily write a unix/linux server.

    Real programers are not afraid from maths!
    (from an Asfixia Member I think)
    JJpRiVaTe (Private Zone)

    Share this post


    Link to post
    Share on other sites
    Alright! Thanks everybody! By the way, I did see that book you were talking about, "Multiplayer Game Programming" at Barnes and Noble a while back, and I was planning on getting it, but I''m glad I asked for help as well. I love Barnes and Noble.

    "I am a chicken from the kitchen, and I ain''t kiddin'' although nothing is written"

    Share this post


    Link to post
    Share on other sites
    I used DirectPlay long ago because I saw it as easier which is true when considering how many features it has done for you. But for my latest project I decided to switch it up a bit and use Winsock. I don''t have UDP support in it but TCP/IP is a breeze. Also TCP/IP with winsock does everything for you that DPlay does with whatever it uses (guarenteed packets, zero data corruption, ect).

    DPlay guarenteed packets may be faster than TCP/IP with Winsock but I havn''t verified that. But for chat, speed isn''t really an issue. Also, lobbies aren''t too difficult. I wrote one for my current project in about a day or two. You just have to know how to use dynamic memory and break it down to it''s component parts.

    Ben


    IcarusIndie.com [ The Rabbit Hole | The Labyrinth | Programming | Gang Wars | The Wall | Hosting]

    Share this post


    Link to post
    Share on other sites
    I once coded for directplay, it was long, tedious and cumbersome, but that was a long time ago, first release even I think. By now it''s probably easier.

    However, sockets are fast, cross platform, and aren''t that hard to learn at all. It''s what I turn to first now.

    If I was trying to make some real game where I had a lobby and could have a plethora of chat rooms, I might consider DirectPlay.

    Share this post


    Link to post
    Share on other sites
    If TCP will do for you, DirectPlay probably isn''t worth the time. However, TCP presents some problems for networking in a typical game. DirectPlay will take care of a lot of the things you''d need to do with UDP, such as packet ordering, integrity, delivery, etc. It makes it a little more like TCP, but with most of UDP''s benefits, as well as a level of abstraction above the protocol level, which might be useful at some point as it was when we used modems.

    Share this post


    Link to post
    Share on other sites
    Sockets easy to use? HAH!!! Network programming with sockets is like coding for Satan

    Anyways, DP is easy to use and flexable in terms of message sending and reviving. I suggest you use DP for learning how to program multiplayer games first

    Share this post


    Link to post
    Share on other sites
    quote:

    which might be useful at some point as it was when we used modems.



    I don''t know about other modem users but that makes me feel like technology just sped past me laughing..

    * Case 1 *

    Assuming you will be using DirectX for drawing and input you''ve pretty much said you''ll be using windows. So as for the networking I''d say go with DirectPlay, keep with the Direct* theme

    * Case 2 *

    Assuming you will be using DirectX for drawing and input you''ve pretty much said you''ll be using windows. So as for the networking I''d say go with Sockets, so when you decide to port it to a different platform you''ll have less to change.

    Share this post


    Link to post
    Share on other sites