How to always load mission recursively?
by Bullitt Sesariza · in Torque Game Engine · 06/18/2008 (9:43 pm) · 4 replies
Hi, I need to find a way to make my game loads its mission all the time. The game should be on for a very long time (a minimum of a week) and it would have to load its mission again every time the last mission ended (whether because of a time out or the player dies). I've tried 2 different ways for this but none of them worked.
1. I use called disconnect and then load the mission (recreated the client / server again before loading it). This is the code:
The connectGame() function:
With this one, it would go fine up till 2-3 days where it crashed.
2. The second one is simpler. I just called endMission and loadMission (without recreating the client / server) directly like so:
With this one, it would lag horribly (below 1 FPS) even if it was run for 1 day.
I don't know what the console log shows because I disabled it. Tried to enable the log and it created a massive one (a few megabytes) because it logged for a few days. Not to mention the logging of that extent makes the game lag.
So the question is:
1. What did I do wrong here?
2. What does the engine do when it connect / disconnect the game?
3. What does the engine do when it end / load the mission?
4. When I look at the endMission function, I see this lines:
Because this is a crucial issue for me, can anybody help me? Please? Thanks in advance.
1. I use called disconnect and then load the mission (recreated the client / server again before loading it). This is the code:
....
disconnect();
schedule(1500,0,connectGame);
....The connectGame() function:
function connectGame()
{
createServer("SinglePlayer", $Game::CurrentMissionFile);
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs($pref::Player::Name);
%conn.setJoinPassword($Client::Password);
%conn.connectLocal();
}With this one, it would go fine up till 2-3 days where it crashed.
2. The second one is simpler. I just called endMission and loadMission (without recreating the client / server) directly like so:
endMission(); loadMission( $Game::CurrentMissionFile, false );
With this one, it would lag horribly (below 1 FPS) even if it was run for 1 day.
I don't know what the console log shows because I disabled it. Tried to enable the log and it created a massive one (a few megabytes) because it logged for a few days. Not to mention the logging of that extent makes the game lag.
So the question is:
1. What did I do wrong here?
2. What does the engine do when it connect / disconnect the game?
3. What does the engine do when it end / load the mission?
4. When I look at the endMission function, I see this lines:
// Delete everything MissionGroup.delete(); MissionCleanup.delete(); $ServerGroup.delete();do they delete all of the current mission's objects? I mean for sure?
Because this is a crucial issue for me, can anybody help me? Please? Thanks in advance.
#2
06/23/2008 (5:18 am)
Try looking at the cycleGame functions in the starter.fps. With some changes, you could use that to load a new mission.
#3
06/23/2008 (10:18 am)
Have checked the cycleGame function and IMHO it's similar to the second method. The difference was the cycleGame cycles through the mission files until it find's the correct one whereas I just inputed the file directly. Thanks anyway.
#4
06/23/2008 (11:42 am)
Okay, my bad. Don't know why it won't work for you, but changing the CycleGame Functions to load a specific level has never failed me.
Torque Owner Bullitt Sesariza