Simple Game, Complex Networking

Started by
12 comments, last by OrangyTang 18 years, 10 months ago
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.
My Current Project Angels 22 (4E5)
Advertisement
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.
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...
enum Bool { True, False, FileNotFound };
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.
My Current Project Angels 22 (4E5)
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
Medium-simple sockets code (portable between UNIX and WinSock) using UDP can be found here.
enum Bool { True, False, FileNotFound };
try gnet.org.
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 :-)
enum Bool { True, False, FileNotFound };
gnetlibrary.org perhaps?
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.
My Current Project Angels 22 (4E5)

This topic is closed to new replies.

Advertisement