Results 1 to 4 of 4

Thread: Net work game

  1. #1

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774

    Talking Net work game

    Haveing carefully put togeather and tested my latest project I find that it is now time to look at the final stage. NETWORK play. the whole design is so that it will work over a LAN (peer-to-peer). I would prefer to ensure it works over the WWW as well.

    How do I go about doing this (the LAN bit)? How do I send data from one example of the game to the other.

    BTW: what's a good working practice to ensure that the data held by both does not differ.
    ?
    'What's this bit for anyway?
    For Jono

  2. #2
    Hyperactive Member VBD's Avatar
    Join Date
    Apr 2001
    Location
    The Place Above The Place Below Heavin
    Posts
    278

    Internet Version.

    This will work over the internet. Have each user select wether they are a host or a client. Then if they are a client have them specify the IP address of a host.
    the code could look something like this.
    Also, put a winsock control on the from
    Sub ConnectToOtherComputer_Click()
    If host = true then
    Winsock1.Localport = 954
    Winsock1.Listen
    Else
    Winsock1.Connect TextboxRemoteUser.Text,954
    End If
    Close
    Private Sub Winsock1_ConnectRequest(RequestID as integer)
    If host = true then
    winsock1.accept requestid
    end if
    End Sub
    Private Sub Winsock1_Connect()
    MsgBox("Connected")
    end sub
    Private Sub Winsock1_DataArrival(BytesTotal as Long)
    Dim DataX as String
    Winsock1.Getdata Datax 'Store the data
    'the other'computer 'sent 'in variable called DataX
    End Sub
    Sub SendDataToOtherComputer(Data as String)
    Winsock1.Senddata Data
    End Sub


    You get the idea, use Winsock1.Localport = 943 Winsock1.Listen to host
    Use Winsock1.Connect RemoteIP,943 to connect.
    Use Winsock1.Accept RequestID to accept a connecting User.
    The Connect Sub is for if a client connects to you.
    To getdata create a variable and go Winsock1.GetData Variable
    To senddata Winsock1.Senddata Data. there should be lots of tutorials on this.
    Hello

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Crappy formatted code..

    *cough*

    Just wanted to say: LAN or internet means the same as long as you connect through TCP/IP. In most cases internet connections are way slower, you might want to take care about this by interpolating movement however.

  4. #4

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    Ok thanx. (I think)

    I've not experimented with LANs n WANs up till now. I think I get the drift. Hopefully the actuall data sent shouldn't be too big. As the state of playing peaces is secret I wonder if the two program examples should tell each other what is held or ask each other for results....

    hmmm...
    ?
    'What's this bit for anyway?
    For Jono

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width