Simple game for 2 to run over network.
Simple game for 2 to run over network.
(OP)
Some time ago I created a simple game for 2 players in VB6.
(basically a VB version of the Connect4 game.)
I no longer have the code so I'm going to re-write it in VB.net but was wondering how to make it playable for 2 users across a network.
It isn't for any commercial gain, just for my own interest and also to help my son into programming - when he leaves school this summer he will go on to start a Software Development course at college in September.
Any help would be appreciated.
(basically a VB version of the Connect4 game.)
I no longer have the code so I'm going to re-write it in VB.net but was wondering how to make it playable for 2 users across a network.
It isn't for any commercial gain, just for my own interest and also to help my son into programming - when he leaves school this summer he will go on to start a Software Development course at college in September.
Any help would be appreciated.
bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.
Where would we be without sat-nav?





RE: Simple game for 2 to run over network.
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
Chinese prisoner wins Nobel Peace Prize
RE: Simple game for 2 to run over network.
bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.
Where would we be without sat-nav?
RE: Simple game for 2 to run over network.
I suggest using a TCP connection for communication between the 2 computers. I guess you will need you add a setup page to the game where you would enter if the computer is acting as a client or server. The server would listen for a connection request from any other computer. The client would also need to know the IP address of the server computer so it knows where to connect. I think the general rule of thumb is you can use any port number over 50000 for this type of application.
RE: Simple game for 2 to run over network.
1) sockets by UDP. If the packets are small, they normally work fine. Basically you make up your own protocol.
2) sockets by TCP - as suggested. Again, you make up your own protocol
3) mailslots - this is a very simple mechanism which is used in the net send command. It is available on all versions of windows so you can even play someone on W3.1! This is similar to sockets but at a slightly higher level and a lot easier to program.
4) RPCs - remote procedure calls. This is fairly complex and not very easy to debug
With 1 & 2, it is no different to sending stuff over a serial port. The thing to note is that if you are testing it on one machine, use a broadcast address (last octet is 255 if it is a LAN) otherwise the packets don't get reflected off the switch and only one app gets to read the traffic. The other alternative is to use multicast.
Not many people know about mailslots. I only stumbled across them by accident 10 years ago - they'd been around for a very long time.
RE: Simple game for 2 to run over network.
bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.
Where would we be without sat-nav?