Jump to content
  • Advertisement

Archived

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

ri3eboi

Newbie needs Networking Help, Please read.

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

Hey guys: I am a networking newbie who is trying to implement the multiplayer version of a already made single player air hockey game. After reading Beej''s Guide and SDL_Net documentation, I learnt how to implement a simple message server that listens for connection, receives message, and a client that sends messages. But this is far less than the knowledge I need to implement the game. So I am writing to ask for some help from you guys on the overal network architecture of the game (by architecture I mean how to implment the server and client version of the game, because I am having so much problems trying to come up with a synchronization scheme). The game server and client both needs to send and receive data, but how do I sort through the data received, and how to put the data received into the correct places? Please let me know if there are any guides/tutorials on how to implement the multiplayer version of a game similar to mine (air hockey game). This is what I need to implement: a 2 player game that uses Client/Server architecture. One player acts as the server who hosts the game, another acts as the client who joins the game using IP address of the server. I am planning on using UDP protocol. The single player game is already implemented, it is time based, implemented in C++ using SDL and GLUT. Thanks a lot in advance.

Share this post


Link to post
Share on other sites
Advertisement
I found this site from another thread, and am just wondering if it will work for my game. I do not have much time so I do not want to spend too much time reading through a lot of premade libraries that might not suit my job. Please share your experiences with this library if you have used it. It is written in C, do I have to change anything to make it work in C++? sorry I am a C++ newbie too

http://gameprogrammer.com/net2/net2-1.html

Share this post


Link to post
Share on other sites
I would strongly recommend checking out the Zap example game for the Torque Network Library (http://www.opentnl.org). It''s a full client/server team arcade action game with prediction, interpolation and extrapolation models, multiplayer physics and more.

- Mark

Share this post


Link to post
Share on other sites
Hey Mark,

I''ve noticed your affection for TNL, whats the link between you and the lib? Do you work for GarageGames or just a fan of TNL (which seems good and my roommate has already scrapped his project''s network code and switched over to TNL.)

Share this post


Link to post
Share on other sites
I just happen to be looking up on the same thing Just so you know, the socket library for python that comes with it is wonderful and gives you the same amount of power as the C interface to it.

But anyways, I've been going off of this guide for creating servers. Here's basically how I plan to do it:
The server is in a continuous loop and checks every 33 milliseconds for new clients, and then for messages. Messages are resolved like this: a unique ID number is attached to the packet when it is sent and it is used, along with the ip number and port, to update that player's informationyou don't need to do that if you use tcp, because you have a seperate connection to each one already. The only thing that should be sent to the server are changes in states, e.g. if the player pressed the left arrow and he wasn't already going that direction then a Move event would be sent along with the direction that he would be going and his speed. The server keeps the entire game world on its side and the clients keep one on their side so that they can use dead reckoning. I got most of this from the very nice Networking articles on this site and from the book "Programming Role Playing Games in DirectX."
EDIT:
One more thing: I recommend you use tcp instead of udp, because if the server doesn't recieve one of the packets then the data is going to be wrong. That's only if you send changes in state instead of the position, which I recommend you do because it prevents cheating and cuts down on bandwidth used. I should be finishing a mockup server for a little test game I did to get acquainted with networking soon, so I can post it here if you want.

[edited by - bytecoder on June 2, 2004 1:24:58 PM]

Share this post


Link to post
Share on other sites
I am a cofounder of GarageGames and wrote most of TNL -- which is one of the reasons I''ve been pimping it. The other reason I''ve been pimping it is that it''s really good tech that will save a LOT of headaches in getting a multiplayer game up and running.

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!