• Benvenuto in Making Videogames!
  • Dai sfogo alla tua fantasia!
  • Crea il tuo Videogioco!
Benvenuto ospite! Login Registrati




Valutazione discussione:
  • 0 voto(i) - 0 media
  • 1
  • 2
  • 3
  • 4
  • 5
TCP/IP for Directplay non funziona?
#1
Avevo in progetto di realizzare un gioco ma sto trovando difficoltà ad hostare/joinare alla partita. Il fatto è che io uso il protocollo TCP/IP che dovrebbe funzionare con internet se non erro? Può essere che sbaglio qualcosa oppure xk sono collegato a internet in wifi? Il Firewall è disattivato

[Immagine: tcpip.png]

Codice Host:
[SPOILER]
Codice PHP:
Startserver(TCPIPCheck())

Disable escapekey

Do
    
REM TERMINA SESSIONE SE VIENE PREMUTO ESC
If escapekey()=1
    Free net game
    
Print "Server siession terminated. Press any key to exit"
    
Suspend for key
    end
Endif
    
Loop

Function TCPIPCheck()
    
    Print 
"Performing network connections checklist" wait 50
    Perform checklist 
for net connections
    
    
If checklist quantity()=
        
Print "Error: No network options avaible"
        
Print "Press any key to End"
        
Wait key
    
Endif
    
    Print 
"Checklist completed, checking list for TCP/IP"
    
    
Netoption$ = "Error"
    
    
For x=1 to checklist quantity()
        If 
checklist string$(x)="Internet TCP/IP Connection for Directplay"
            
NetOption$=str$(x)
        Endif
    
Next x
    
    
If netOption$="Error"
        
Print "Sorry, TCP/IP is not availible"
        
Wait key
        End
        
Else
        Print 
"Checklist check complete, TCP/IP is availible at slow number "+NetOption$
    Endif
    
Endfunction NetOption$


Function 
StartServer(Newoption$)
    
    Print 
"Setting Network Connection"
    
Set Net Connection val(NewOption$), "127.0.0.1"
    
Print "Starting Server..."
    
Create Net Game "My Test Server","Host",2,
Endfunction[/SPOILER]


Codice Client:

[SPOILER]
Codice PHP:
IpAdd$="127.0.0.1"
Netlist$="Error"

Print "Scanning for network connections"
Wait 50
Perform checklist 
for net connections
Print "Scanning for TCP/IP Connection"

For index=1 to checklist quantity()
    If 
checklist string$(Index)="Internet TCP/IP Connection For DirectPlay"
        
Netlist$=str$(Index)
    Endif
Next index

If Netlist$="Error"
    
Print "Scanning complete. TPC/IP not availible"
    
Wait key
    End
    
    
Else
    
    Print 
"Scanning Complete. TPC/IP is availible, proceding with host scan"
Endif

wait 50
Print "Searching for Server on ",IPAdd$
Print 
"Plese Wait..."
Sleep 50

Set net connection val
(Netlist$), IPAdd$
Perform checklist for net sessions

If checklist Quantity()=0
    
Print "No Server detect, please ensure it is running, and that you're setup firewalls are setup correctly"
    
Print "Press any key to exit"
    
Wait key
    End
Endif

Print 
"The following servers where detected, please select the server to join"
For x=1 to checklist quantity()
    Print 
str$(x)+". "+Checklist string$(x)
Next x

Repeat
    
Print
    
Input "Enter you selection: ",Server$
    If 
val(Server$)<or val(Server$)>Checklist quantity()
        Print 
"That is not a valid choice, please select on of the options above"
    
Endif
Until val(Server$)>and val(Server$)<=Checklist quantity()

Print 
"Connecting to "+Checklist string$(val(Server$));"..."
Sleep 50

Join net game val
(Server$),"Client"

wait 50
If Net game exists()=1 then Print "Connection sucessful. PRess any key to quit Client." : Else : Print "Connection wasn't established, press any key yo quit"
wait 50
Free Net Game
End 
[/SPOILER]


Ovviamente ho fatto pure in modo che si potesse inserire manualmente l'ip del proprio host/client. A voi la parola ora Smile
 
Rispondi
#2
cmq secondo hai sbagliato qualcosa, non c'entra nnt il fatto del wifi....
 
Rispondi
#3
Codice PHP:
Set Net Connection val(NewOption$), "127.0.0.1" 

Non si dovrebbe cambiare l'ip locale con il tuo ip di rete ? (Non so nulla di Dark Basic però vedendo il codice mi è venuto questo dubbio)

Codice PHP:
Set Net Connection Impostare la connessione di rete 
 
Rispondi
#4
Con un comando input ho permesso pure di inserire l'ip (l'avevo scritto mi pare nel primo post) ma non ho risolto mettendo manco 192.168.1.19 che è il mio ip di internet. Tra l'altro quello della creazione del server è uno step successivo infatti prima verifica se il TCP/IP è disponibile. Guazie comuqnue per le risposte Smile
Diamine ma manco con gli esempi già fatti di Dark Basic funge! :O
 
Rispondi
#5
Uhm, come ho detto non ne capisco molto di Dark Basic, e specialmente nella creazione di un server, comunque secondo il mio punto di vista, questo codice non può andare, perché anche se hai messo la funzione input, come dici tu, dovresti mettere l'input dell'utente al posto di quel ip, altrimenti il programma non va a prendere l'ip che l'utente ha messo, ma va a prendere sempre quel ip (secondo me dando una occhiata veloce al codice).

E vedo anche un codice troppo semplice e corto per funzionare... forse perché sono abituato ad altri linguaggi xD.
 
Rispondi
#6
Si Kira quello che dici già l'avevo pensato da me XD e non funge lo stesso Smile Adesso sto provando MultiSync 1.4 per vedere se funge Wink
 
Rispondi
#7
Ho Provato con MultiSync 1.4 ed ecco l'esito dei test con un mio amico:
- Hosto io, Lui partecipa senza successo
- Hosta lui, Io partecipo e riesco ad entrare ma non riesco a mandargli nessun messaggio (Stringa)

Quindi avrò qualche problema ad hostare forse io. Sad Comunque sia appena avrò il codice pronto e funzionante lo posto e ne fate quello che volete Smile XD
 
Rispondi
#8
Ma stai usando hamachi oppure stai usando l'ip del tuo pc ? (Te lo domando perché ho visto dallo screen l'ip che hai inserito nel programma)

[Edit]
Se lo posterai il source, te ne sarò grato, cosi mi studio il codice xD.
 
Rispondi
#9
Ho usato sia l'ip di hamachi sia di internet Wink Cmq appena il codice è completamente funzionante lo posto. Io ciò messo 4 giorni a capire le basi e non vorrei che qualcun'altro si scervellasse come ho fatto io xD
 
Rispondi
  


Vai al forum:


Browsing: 1 Ospite(i)