Jump to content
  • Advertisement
Sign in to follow this  
Sir Sapo

Simple Game, Complex Networking

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

I have been trying to get a small simple networking game running for the past 2 days now and I am stuck. I have been using Winsock, but I think its a bit over my head. My question to you guys is, is there anyway to get something networked without going through all the winsock creation and socket binding. All I need to do for this game is to send x and y values back and forth to the server and then to the other client and vice versa.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
There are higher-level socket libraries than WinSock. In .NET and Java, you can get normal output streams to/from sockets. For just plain C++, one that I heard of is http://enet.cubik.org/, but there may be better ones as well.

Share this post


Link to post
Share on other sites
The Forum FAQ is a good place to start; it lists a number of libraries.

However, distributed programming is, in general, hard, and you can't expect to get it all right in just two days of work. Two days isn't much compared to the ten years it takes to become an expert in a field...

Share this post


Link to post
Share on other sites
I dont plan on being an expert on the subject, but being the only programmer in my indie team puts some pressure on me to know a bit of everything. Anyways, thanks for the help, I'll try some of those libs. The main problem I had with Winsock was that I could get the server to work because it is usually written as a simple console app in tutorials, however the client is the hard part because all the tutorials I have found on Winsock Game Programming have had the client be some fancy DirectX app with lots of stuff in the code not pertaining to networking at all. Anyways, if anyone knows of a place with a sample server and client that just connect to eachother and do nothing else, please let me know.

Share this post


Link to post
Share on other sites
If you are doing it with UDP then the server and client is almost identical, just one sends the first message, and the other waits

Share this post


Link to post
Share on other sites
Quote from www.gnet.org:

Quote:
GNET is an award-winning environmental technology, news and business center that promotes the use of innovative environmental technologies. This site is made possible by a cooperative agreement from the National Energy Technology Laboratory and the Department of Energy's Office of Science and Technology.


I don't think that's what you actually meant :-)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
gnetlibrary.org perhaps?

Share this post


Link to post
Share on other sites
Thanks for all the replies guys, but I just got Winsock to work and I think I will stick to that. I do have a nother question however. When I send my packet containing playerdata, should I create a struct that hold all the data and then just send one packet that contains the struct, or should I send all the variable seperately in 4 or 5 packets?

I have 8 possible players in a game at one time, so if I send them all the other players information(x position, y position , angle , weapon , name , etc) seperately it comes out to something like 400 packets every tick.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!