Multi Player Sample Help
-
Hello everyone. I have a simple request. I need a simple source code sample of how I would make a p2p style multi player game in Vb 2010. I know it would use a network stream and everything streamed would be in a class. But Ive never worked with network streams before so a very simple code sample would help me a lot. A simple input box, type in IP, connect type sample would be great. Thanks in advance.
-
Hello everyone. I have a simple request. I need a simple source code sample of how I would make a p2p style multi player game in Vb 2010. I know it would use a network stream and everything streamed would be in a class. But Ive never worked with network streams before so a very simple code sample would help me a lot. A simple input box, type in IP, connect type sample would be great. Thanks in advance.
Yes, you will need to do some stuff with network streams. The only network games I've written were over LANs (my home network). That's a lot easier, since you don't have to worry about security issues (at least at my house :) ), and you don't have to worry about dynamic ip addresses and all that... It is possible, but a little tricky. First, it's a good idea to do all of the network communications asyncronously (such as with a backgroundworker. I have a link to a vb source code I wrote to help me with developing a couple of network programs I wrote a while ago. It basically encapsulates all of the details of the network stuff in a class. You can take a look at it and how it works. You can take a look at http://lance.mckendree.edu/~klschaefer/temp/NetworkHelper.vb[^]. As the name suggests, it makes doing network stuff a little easier, but feel free to learn how it works and expand on it. If you haven't done any network stuff at all, I would suggest making a simple chat program just so you can get something under your belt. I would consider what I've done to be a server/client program, so one of the machines is designated as a "server" and the other as a "client", although beyond initially setting up the connection, that designation pretty much doesn't do anything: both can send and receive exactly the same. Anyways, I hope this helps!
-
Yes, you will need to do some stuff with network streams. The only network games I've written were over LANs (my home network). That's a lot easier, since you don't have to worry about security issues (at least at my house :) ), and you don't have to worry about dynamic ip addresses and all that... It is possible, but a little tricky. First, it's a good idea to do all of the network communications asyncronously (such as with a backgroundworker. I have a link to a vb source code I wrote to help me with developing a couple of network programs I wrote a while ago. It basically encapsulates all of the details of the network stuff in a class. You can take a look at it and how it works. You can take a look at http://lance.mckendree.edu/~klschaefer/temp/NetworkHelper.vb[^]. As the name suggests, it makes doing network stuff a little easier, but feel free to learn how it works and expand on it. If you haven't done any network stuff at all, I would suggest making a simple chat program just so you can get something under your belt. I would consider what I've done to be a server/client program, so one of the machines is designated as a "server" and the other as a "client", although beyond initially setting up the connection, that designation pretty much doesn't do anything: both can send and receive exactly the same. Anyways, I hope this helps!
thanks, its looks great. Ill have to play with it some.