Client connection issues with a simple static "connect" button
by Corey · in Torque Game Engine · 06/11/2007 (6:16 pm) · 2 replies
It's kind of embarrassing, but I can't get a simple "connect" button on the main menu to work. All I want it to do is that when it's clicked, it connects the client to a server predefined in code or script. I have pretty much completely reorganized the folder structure of my Torque project, so don't assume the presence of anything - I could easily have missed something in the common code or anywhere else when copying everything over.
What I do have so far is that a copy of serverConnection.cs from starter.fps is there and is being compiled. The button itself calls a function called LaunchGame() which is defined to do the following:
(the if-statement there is to allow for a sort of singleplayer dev-mode I have set up. That DOES work)
The problem is that when I click the connect button, it enters this function and echoes "Sending Connection Request Challenge" about four or five times, then displays a "timed-out" error. The server NEVER displays any signs of ever seeing this request. If I try to connect to this very same server using starter.fps, I CAN see it when I query LAN and I CAN connect to it (of course, I'm also immediately rejected for not having the correct mod and all, but at least I notice that the server does recognize the incoming connection).
I have read and reread the networking chapter of 3D Game Programming All In One and nothing jumped out at me, so any suggestions are greatly appreciated.
What I do have so far is that a copy of serverConnection.cs from starter.fps is there and is being compiled. The button itself calls a function called LaunchGame() which is defined to do the following:
(the if-statement there is to allow for a sort of singleplayer dev-mode I have set up. That DOES work)
function LaunchGame()
{
%conn = new GameConnection(ServerConnection);
%conn.SetConnectArgs($pref::Player::Name);
%conn.SetJoinPassword("none");
if($dir $= "creator")
%conn.ConnectLocal();
else
%conn.Connect("IP:192.168.0.157:28000");
}The problem is that when I click the connect button, it enters this function and echoes "Sending Connection Request Challenge" about four or five times, then displays a "timed-out" error. The server NEVER displays any signs of ever seeing this request. If I try to connect to this very same server using starter.fps, I CAN see it when I query LAN and I CAN connect to it (of course, I'm also immediately rejected for not having the correct mod and all, but at least I notice that the server does recognize the incoming connection).
I have read and reread the networking chapter of 3D Game Programming All In One and nothing jumped out at me, so any suggestions are greatly appreciated.
About the author
#2
Thanks, again.
06/11/2007 (8:47 pm)
Goodness, SetNetPort(0) is exactly what was missing. Many, many thanks! Being new to this and all, I wasn't quite sure what I was looking for, so I was looking in everything that dealt directly with connecting. I didn't even think to check client initialization. SetNetPort and AllowConnections were both already covered in copied common code, though, so I didn't have to include those.Thanks, again.
Associate Matt Fairfax
PopCap
That was the piece I was missing the other day when I was doing manual connections and kept getting the behavior you are describing.