Changing server connection during play
by Laurence Grant · in Torque Game Engine · 01/16/2007 (6:16 am) · 2 replies
I'm new to Torque, so I apologize if this is lame.
If I'm using all the native TGE functionality, and I'm developing a multi-player game, can the client disconnect from one server and connect to another server dynamically while the game is in progress (obviously with some overhead and delay)?
I'm considering using different servers for different areas so no one server gets overloaded, and as the player travels through game elements (portals, elevators, etc) have them connect to different servers.
If I'm using all the native TGE functionality, and I'm developing a multi-player game, can the client disconnect from one server and connect to another server dynamically while the game is in progress (obviously with some overhead and delay)?
I'm considering using different servers for different areas so no one server gets overloaded, and as the player travels through game elements (portals, elevators, etc) have them connect to different servers.
#2
01/16/2007 (7:53 am)
That's great, thanks. I suspected most of my questions were all doable, but just wanted some confirmation before I do a deep dive.
Employee Michael Perry
ZombieShortbus
First and foremost, you'll get some code samples and more specific help if you ask for more than just "Is it possible?" Having access to the source code and full control over the scripting makes ANYTHING possible =).
Specific to this case, you would have a function that would be similar to this:
[b]// Given %var is an IP address of the server you are switching to[/b] function switchServers(%var) { disconnect(); // Get off the current server // Set up the new connection %conn = new GameConnection(ServerConnection); %conn.setConnectArgs($pref::Player::Name); %conn.setJoinPassword($Client::Password); // Connect %conn.connect(%var); }Now, this is a "bare-bones" example. You'd probably want to do some safety checks to make sure you are connecting to a valid server, and some GUI magic to show what's happening (ie displaying a pic of a cave entrance if you are going into a dungeon)
Hope that sends you in the right direction =)