Game Development Community

Canvas.pushDialog(ChooseLevelDlg); change.

by Manni Medeiros · in Torque 3D Professional · 06/09/2011 (8:33 pm) · 4 replies

Ok this seems like it should be simple but i was not sure how to go about this. Instead of a level loader i would like to just load the level on the server and the play button should just connect them to the prespecified server but if it cannot i want to load a default level in the client. but im not sure how to go about this can anyone help?

About the author

Awkward Monkey was created by me and consists of me my wife and a few friends we are looking into expanding and love developing. Http://www.awkwardmonkey.com


#1
06/10/2011 (6:10 am)
Take the gui's apart in the GUI Editor and see what commands they use (for both single and multiplayer as you seem to want to combine them as a custom default). Also look in "netConnection.cs".
#2
06/10/2011 (8:23 am)
A server tells the client what mission to load, so that's already done for you. If you know the server's IP address then you can connect directly to it. This process can be hidden from the player if you wish.

Example connect method - may not work 'as is' for you since you've still got to pass the parameters needed
function connect(%ip, %pwd, %name, %gender)
{
   %conn = new GameConnection(ServerConnection);
   %conn.setConnectArgs(%name, %gender);
   %conn.setJoinPassword(%pwd);
   %conn.connect(%ip);
}
#3
06/10/2011 (8:52 am)
Ok so if the server tells the client what to connect to when connecting then I dont need the level in the client just on the server right? So the only level I need is the default level if it cannot connect.
#4
06/10/2011 (9:04 am)
All data for the level must be present on the client. If the client does not have that data then it will be forced to disconnect. The client has no concept of a loading a default level if the server tells it to load one it doesn't have. In this situation the client will be presented with a server disconnect message explaining they do not have the requisite artwork needed to play on this server.

As an alternative to a blatant disconnect you could add some code to silently shunt the player over to another server instance which has the 'default' level, but the client must still have that level data on their machine.


Just to note: In a multiplayer situation the ChooseLevelDlg would only ever by directly accessed by the server host, all clients go through the JoinServer process. This is the part you wish to hide.