Jump to content
  • Advertisement

Archived

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

BrianNaughton

Testing the water

This topic is 6536 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

Hi, I have written a DirectX game which has multiple players. However, in my ignorance I programmed it so all four players could use the same keyboard to play, you know, like in the good old days. Of course, modern keyboards are unhelpful in this respect, beeping all the time. So you can play the game as a single player against the computer but not multiplayer. What I''d like to know is, how difficult would it be to adapt the game so it ran on a network, without totally restructuring the game. I imagine it would be a lot of work but I just thought I''d check. Bear in mind that I don''t know a single thing about networks. Thanks, Brian

Share this post


Link to post
Share on other sites
Advertisement
I know how you feel, as I literally just had the same problem - except I caught it in the design and testing phase so I''ve proceeded to re-structure my game for networking accordingly.

You say you know nothing about networks, well this is probably a bad thing if your going to attempt a conversion
Yes, it will probably take an amount of re-structuring to get a network version up and running, as you are going to have to design what data needs to be sent each frame, what kind of network architecture you will use, how you are going to parse out data packets on other machines et cetera.

I recommend a gamedev.net article on Winsock, since it should give you some reasonable foundation on network programming and some actual code to muck around with, you can find it in the gamedev.net programming section and scroll down the previous articles until you find ''winsock 2 for games''.

It can probably be done, it will just require some reasonable thought and time.

Regards,

-Mezz

Share this post


Link to post
Share on other sites
For my current project, i have an independant class for network activities. It contains all winsock variables as well as a text buffer for every client (char buffer[MAXCLIENT][MAXBUFFERSIZE]) that is used to store packets to be sent to allow multiple packets of data to be sent to one user in one reasonable size packet. Using this correctly will keep yuo from sending data to a single client every cycle, with a good timer you would only send data to a user every few cycles unless its very urgent information.

Server side i have functions for things such as init Network, check for connections, check for incoming messages, recieve incoming messages, and send messages out. Client side is similar, but a bit more simplistic as it only handles the connection to a server, rather than connection to however many clients are connected.

The only difficult parts about it are deciding where to call the functions and how often for best results, and having a method for carrying out commands by clients(such as, if the server recieves a message asking to move to the right, you need to have a way to actually call a function that tests if moving there is ok, and if so, do it) It''s not such a complex system when you''re only dealing with a few clients, its when you want a shitload of clients that you have to work out problems for lag reasons. Even then, adding in timers to do certain tasks every few cycles rather than performing everything every cycle can fix alot of lag problems.

Anyway, thats just my 2 cents from my experience, if I''m wrong please correct me, I''d love to know another way if it was easier or alot faster.

Spartan
Cabal Ent.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!