Hey Guys,
Does anybody know how you would setup a multiplayer game ONLY on your local network??
Does anybody know how you would setup a multiplayer game ONLY on your local network??
AppTitle "Fastalker" Graphics 800,600,0,2 FileOut = ReadFile("IP.txt") Global Name$ = ReadLine(FileOut) Global NumberOfPlayers = ReadLine(FileOut) Global Signin$ = ReadLine(FileOut) Global Signout$ = ReadLine(FileOut) ;Global Signature$ = ReadLine(FileOut) Global MessageSound% = ReadLine(FileOut) Dim IPAdress%(NumberofPlayers) For Loop = 1 To NumberofPlayers IPAdress(Loop) = ReadLine(FileOut) Next Global Sound = LoadSound("ReceivedMessage.wav") Global Stream% = CreateUDPStream(828) Global NewStream% = CreateUDPStream(79) Repeat IP = RecvUDPMsg(NewStream) For Loop = 1 To NumberofPlayers If IP = IPAdress(Loop) Message = 1 Next If Message = 1 Message = 0 If MessageSound = 1 PlaySound Sound String1$ = ReadString$(NewStream) Print String1 EndIf If KeyHit(28) FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,0) FlushKeys EndIf If KeyHit(2) And NumberOfPlayers >=1 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,1) FlushKeys EndIf If KeyHit(3) And NumberOfPlayers >=2 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,2) FlushKeys EndIf If KeyHit(4) And NumberOfPlayers >=3 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,3) FlushKeys EndIf If KeyHit(5) And NumberOfPlayers >=4 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,4) FlushKeys EndIf If KeyHit(6) And NumberOfPlayers >=5 FlushKeys Variable$ = Name + ": " + Input(Name + ": "); + Signature Broadcast(Variable,79,5) FlushKeys EndIf If KeyHit(7) And NumberOfPlayers >=6 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,6) FlushKeys EndIf If KeyHit(8) And NumberOfPlayers >=7 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,7) FlushKeys EndIf If KeyHit(9) And NumberOfPlayers >=8 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,8) FlushKeys EndIf If KeyHit(10) And NumberOfPlayers >=9 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,9) FlushKeys EndIf If KeyHit(11) And NumberOfPlayers >=10 FlushKeys Variable$ = Name + ": " + Input(Name + ": ") Broadcast(Variable,79,10) FlushKeys EndIf ;sign in and out If KeyHit(199) FlushKeys Variable$ = Name + ": " + Signin Print Name + ": " + Signin Broadcast(Variable,79,10) FlushKeys EndIf If KeyHit(207) FlushKeys Variable$ = Name + ": " + Signout Print Name + ": " + Signout Broadcast(Variable,79,10) FlushKeys EndIf Until KeyHit(1) WaitKey End Function Broadcast(Message$,Port,Recipient);Message is the stream that is being broadcasted. Port is the Destination Port. If Recipient = 0 For Loop = 1 To NumberofPlayers WriteString(Stream,Message) SendUDPMsg Stream,IPAdress(Loop),Port Next Else WriteString(Stream,Message) SendUDPMsg Stream,IPAdress(Recipient),Port EndIf End Function
Global connect = OpenTCPStream("My IP",1) game = StartNetGame() If game = 0 Print "Failed." ElseIf game = 1 Print "Joined." ElseIf game = 2 Print "Started." EndIf WaitKey CloseTCPStream connect
port=input("What port: ") tcp=CreateTCPServer(port)
serverip$="192.168.1.1" port=8080 tcp=OpenTCPStream(serverip$,port)