Game Development Community

Loading a .mis file?

by James A. Burke · in Torque Game Engine · 05/28/2005 (4:28 am) · 4 replies

Hi,
I've been mucking around with the Torque MinApp and have been adding bits and pieces, etc. to it. I've been searching on and off for a while now, trying to find out how to load a mission file (.mis). Is there a simple function or anything that will do this? eg. load_mission(%filenmae). All the options I have found aren't for only loading a mission and I can't seem to find the answer.
Thanks,
James

#1
05/28/2005 (5:09 am)
Have a look at the starter.fps source, specifically the game.cs file. It does mission loading during the map cycle event.
#2
05/30/2005 (3:37 am)
Thanks, but is there anything more 'solid' I could look into, a tutorial or in the manual or something (so far I've had no luck).
Thanks,
Jaems
#3
05/30/2005 (5:23 am)
No tutorial but if you look at common/server/missionLoad.cs (specifically loadMission()) you will see all of the steps necessary to actually load a mission.

If you are using the common scripts the easiest thing to do is to use the function createServer() which is found in common/server/server.cs. This is the actual function used to load missions by most Torque games. It takes two parameters: server type (MultiPlayer or SinglePlayer) and the mission file to load. For example:

createServer("Multiplayer", "starter.fps/data/missions/stronghold.cs");

However, this is only going to load the mission. It will not actually connect the client you are on to the mission. For that you need to create a GameConnection and then connect that to a server with a loaded mission. If you look in demo/client/scripts/startMissionGui.cs you will find this excellent example:

function StartMissionGui::startServer(%this)
{
   createServer("MultiPlayer", "demo/data/missions/"@$Client::GameType@".mis");
   %conn = new GameConnection(ServerConnection);
   RootGroup.add(ServerConnection);
   %conn.setConnectArgs($pref::Player::Name);
   %conn.setJoinPassword($Client::Password);
   %conn.connectLocal();
}
#4
05/30/2005 (3:46 pm)
Thanks, that's quite helpful :)
Thanks again,
James