Missions cycling problem
by Richard Sopuch · in Torque Game Engine · 04/20/2005 (4:05 am) · 19 replies
Hi everyone!
I have a problem with missions cycling. I want simply end the first mission after 5 minutes and load the next one. Between missions I don't display any "load screen".
The program runs in this way: first mission ends, next mission loads but doesn't start. I debugged the scripts and noticed that server sent commandToClient "MissionStartPhase1" but program doesn't enter to function clientCmdMissionStartPhase1 on the client side. I have no idea where this message has gone. Please help.
Richard
I have a problem with missions cycling. I want simply end the first mission after 5 minutes and load the next one. Between missions I don't display any "load screen".
The program runs in this way: first mission ends, next mission loads but doesn't start. I debugged the scripts and noticed that server sent commandToClient "MissionStartPhase1" but program doesn't enter to function clientCmdMissionStartPhase1 on the client side. I have no idea where this message has gone. Please help.
Richard
#2
As I can see, this resource uses triggers. In my game I use the pathshape as a player and I had the problems with setting trigger for it. I wrote about it on the forum (http://www.garagegames.com/mg/forums/result.thread.php?qt=27757) but I didn't get any answer.
Have you any idea why my method of missions cycling doesn't work?
Why this method works in the koob sample game (from 3D Game Programming All in one)?
04/20/2005 (5:27 am)
Thanks Chris. As I can see, this resource uses triggers. In my game I use the pathshape as a player and I had the problems with setting trigger for it. I wrote about it on the forum (http://www.garagegames.com/mg/forums/result.thread.php?qt=27757) but I didn't get any answer.
Have you any idea why my method of missions cycling doesn't work?
Why this method works in the koob sample game (from 3D Game Programming All in one)?
#3
Your method probably doesn't work because loadmission does more then just calling the first phase.
04/20/2005 (5:54 am)
It doesn;t atter if it's using a trigger or not. ust take hte code form the trigger and place it anywhere you want in any script... What I was suggesting is taking the load new mission funciton and scheduling it to be called in 5 minutes... Your method probably doesn't work because loadmission does more then just calling the first phase.
#4
there is the piece of my code:
// set the timer in function startGame (called by onMissionLoaded)
$Game::Schedule = schedule($Game::Duration * 1000, 0, "CycleGame" );
function cycleGame()
{
if (!$Game::Cycling) {
$Game::Cycling = true;
$Game::Schedule = schedule(0, 0, "onCycleExec");
}
}
function onCycleExec()
{
endGame();
$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");
}
function onCyclePauseEnd()
{
$Game::Cycling = false;
echo("@@@@@@@@@@@ enter to onCyclePauseEnd ");
// Just cycle through the missions for now.
%search = $Server::MissionFileSpec;
for (%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search)) {
if (%file $= $Server::MissionFile) {
// Get the next one, back to the first if there is no next.
%file = findNextFile(%search);
if (%file $= "")
%file = findFirstFile(%search);
break;
}
}
loadMission(%file);
echo("@@@@@@@@@@@ leave the onCyclePauseEnd ");
}
and all works. Mission ends after proper time and new mission loads. Even next missions load too, but without any results on the screen.
Both games: koob sample and my run in the same way. The only difference is the koob enter to clientCmdMissionStartPhase1, my game doesn't.
04/20/2005 (6:39 am)
I think I made it like in your proposal.there is the piece of my code:
// set the timer in function startGame (called by onMissionLoaded)
$Game::Schedule = schedule($Game::Duration * 1000, 0, "CycleGame" );
function cycleGame()
{
if (!$Game::Cycling) {
$Game::Cycling = true;
$Game::Schedule = schedule(0, 0, "onCycleExec");
}
}
function onCycleExec()
{
endGame();
$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");
}
function onCyclePauseEnd()
{
$Game::Cycling = false;
echo("@@@@@@@@@@@ enter to onCyclePauseEnd ");
// Just cycle through the missions for now.
%search = $Server::MissionFileSpec;
for (%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search)) {
if (%file $= $Server::MissionFile) {
// Get the next one, back to the first if there is no next.
%file = findNextFile(%search);
if (%file $= "")
%file = findFirstFile(%search);
break;
}
}
loadMission(%file);
echo("@@@@@@@@@@@ leave the onCyclePauseEnd ");
}
and all works. Mission ends after proper time and new mission loads. Even next missions load too, but without any results on the screen.
Both games: koob sample and my run in the same way. The only difference is the koob enter to clientCmdMissionStartPhase1, my game doesn't.
#5
04/20/2005 (6:49 am)
What exaclty happens with that code? It stops running the mission then doesnt show you anyting? Are there console errors? I would guess that your schedules are set up wrong, if they are you will see console errors
#6
I put some echos for following the program and in log file I got:
@@@@@@@@@@@ enter to onCyclePauseEnd
*** ENDING MISSION
$$$$$$$$$$$$$$$$$$ onMissionEnded()
$$$$$$$$$$$$$$$$$$ endMission in common/server/clientconnection.cs *** LOADING MISSION: control/data/missions/afok2.mis
*** Stage 1 load
*** Stage 2 load
Executing control/data/missions/afok2.mis.
*** Mission loaded
############### loadMission in common/server/missionDownload.cs
*** Sending mission load to client: control/data/missions/afok2.mis
############### ClientGroup.getObject(%clientIndex).loadMission() in loadMissionStage2 in common/server/missionLoad.cs
############### onMissionLoaded
############### startGame
@@@@@@@@@@@ leave the onCyclePauseEnd
keyboard0 input device unacquired.
@@@@@@@@@@@ enter to onCyclePauseEnd
*** ENDING MISSION
$$$$$$$$$$$$$$$$$$ onMissionEnded()
$$$$$$$$$$$$$$$$$$ endMission w common/server/clientconnection.cs
*** LOADING MISSION: control/data/missions/afok1.mis
*** Stage 1 load
*** Stage 2 load
Executing control/data/missions/afok1.mis.
*** Mission loaded
############### loadMission in common/server/missionDownload.cs
*** Sending mission load to client: control/data/missions/afok1.mis
############### ClientGroup.getObject(%clientIndex).loadMission() in loadMissionStage2 in common/server/missionLoad.cs
############### onMissionLoaded
############### startGame
@@@@@@@@@@@ leave the onCyclePauseEnd
you can see that the missions are loaded, but only on the server side.
In the koob sample, after "leave the onCyclePauseEnd " the MissionStartPhase1, 2 and 3 run and then onClientEnterGame.
Have you any idea what happened?
04/20/2005 (1:05 pm)
There is no console error. My player (pathshape goes on the path) stops and screen just freeze. I put some echos for following the program and in log file I got:
@@@@@@@@@@@ enter to onCyclePauseEnd
*** ENDING MISSION
$$$$$$$$$$$$$$$$$$ onMissionEnded()
$$$$$$$$$$$$$$$$$$ endMission in common/server/clientconnection.cs *** LOADING MISSION: control/data/missions/afok2.mis
*** Stage 1 load
*** Stage 2 load
Executing control/data/missions/afok2.mis.
*** Mission loaded
############### loadMission in common/server/missionDownload.cs
*** Sending mission load to client: control/data/missions/afok2.mis
############### ClientGroup.getObject(%clientIndex).loadMission() in loadMissionStage2 in common/server/missionLoad.cs
############### onMissionLoaded
############### startGame
@@@@@@@@@@@ leave the onCyclePauseEnd
keyboard0 input device unacquired.
@@@@@@@@@@@ enter to onCyclePauseEnd
*** ENDING MISSION
$$$$$$$$$$$$$$$$$$ onMissionEnded()
$$$$$$$$$$$$$$$$$$ endMission w common/server/clientconnection.cs
*** LOADING MISSION: control/data/missions/afok1.mis
*** Stage 1 load
*** Stage 2 load
Executing control/data/missions/afok1.mis.
*** Mission loaded
############### loadMission in common/server/missionDownload.cs
*** Sending mission load to client: control/data/missions/afok1.mis
############### ClientGroup.getObject(%clientIndex).loadMission() in loadMissionStage2 in common/server/missionLoad.cs
############### onMissionLoaded
############### startGame
@@@@@@@@@@@ leave the onCyclePauseEnd
you can see that the missions are loaded, but only on the server side.
In the koob sample, after "leave the onCyclePauseEnd " the MissionStartPhase1, 2 and 3 run and then onClientEnterGame.
Have you any idea what happened?
#7
04/20/2005 (1:07 pm)
Sorry man... This is getting out of my range of knowledge... You'll have to ask someone with more knowledge of Torque
#9
Is it possible you've deleted the client object somewhere, or called one of the disconnects on them so that they aren't actually connected any longer?
04/20/2005 (1:22 pm)
It appears that your client never gets actually sent the kickoff of the new mission, which implies that your client isn't in ClientGroup.Is it possible you've deleted the client object somewhere, or called one of the disconnects on them so that they aren't actually connected any longer?
#10
04/20/2005 (1:34 pm)
A pity? I thought I helped quite a bit...
#11
Thanks for hint. It seems something like this.
Unfortunately I can't check it in this moment because I'm at home. It will be the first thing to do tommorrow morning.
04/20/2005 (1:39 pm)
@Stephen Thanks for hint. It seems something like this.
Unfortunately I can't check it in this moment because I'm at home. It will be the first thing to do tommorrow morning.
#13
I checked all functions endMission and loadMission, the client always exists.
@@@@@@@@@@@ enter to onCyclePauseEnd
*** ENDING MISSION
$$$$$$$$$$$$$$$$$$ onMissionEnded() in control/server.cs
$$$$ client in endMission in common/server/missionLoad 1286
$$$$$$$$$$$$$$$$$$ endMission in common/server/clientconnection.cs
*** LOADING MISSION: control/data/missions/afok2.mis
*** Stage 1 load
$$$$ client in loadMission in common/server/missionLoad 1286
*** Stage 2 load
Executing control/data/missions/afok2.mis.
*** Mission loaded
############### loadMission in common/server/missionDownload.cs
*** Sending mission load to client: control/data/missions/afok2.mis
############### onMissionLoaded in control/server.cs
############### startGame
@@@@@@@@@@@ leave the onCyclePauseEnd
what now?
04/21/2005 (1:50 am)
@StephenI checked all functions endMission and loadMission, the client always exists.
@@@@@@@@@@@ enter to onCyclePauseEnd
*** ENDING MISSION
$$$$$$$$$$$$$$$$$$ onMissionEnded() in control/server.cs
$$$$ client in endMission in common/server/missionLoad 1286
$$$$$$$$$$$$$$$$$$ endMission in common/server/clientconnection.cs
*** LOADING MISSION: control/data/missions/afok2.mis
*** Stage 1 load
$$$$ client in loadMission in common/server/missionLoad 1286
*** Stage 2 load
Executing control/data/missions/afok2.mis.
*** Mission loaded
############### loadMission in common/server/missionDownload.cs
*** Sending mission load to client: control/data/missions/afok2.mis
############### onMissionLoaded in control/server.cs
############### startGame
@@@@@@@@@@@ leave the onCyclePauseEnd
what now?
#14
04/21/2005 (4:44 am)
Are you in a single player, multiplayer--remote, multiplayer--local, or dedicated server/dedicated client configuration?
#15
04/21/2005 (4:57 am)
Single player
#16
My game, as result script function: MissionCleanUp.delete()
goes to OnRemove method of different objects like simGroup, simObject and finally of
GameConnection and NetConnection
in the engine. And the connection with server is broken.
Koob game enters to OnRemove method of simGroup and simObject, but doesn't enter to GameConnection and NetConnection.
04/21/2005 (6:48 am)
In the meantime, trying to find the reason of my problem, I have debugged the Torque C++ sources and I noticed the differences in the way of koob and my game. My game, as result script function: MissionCleanUp.delete()
goes to OnRemove method of different objects like simGroup, simObject and finally of
GameConnection and NetConnection
in the engine. And the connection with server is broken.
Koob game enters to OnRemove method of simGroup and simObject, but doesn't enter to GameConnection and NetConnection.
#17
04/21/2005 (7:00 am)
There you go--don't put your Game/NetConnections in MissionCleanup!
#18
I found it. I missed the RootGroup.add(ServerConnection)
Now all works. Thank you. Your suggestions were very helpfull!
04/21/2005 (11:56 am)
I didn't put the netConnection in MissionCleanUp.I found it. I missed the RootGroup.add(ServerConnection)
Now all works. Thank you. Your suggestions were very helpfull!
#19
04/21/2005 (12:40 pm)
NP, and glad you figured it out!
Torque Owner Chris Labombard
Premium Preferred
This tells you how to load a new mission properly... You can schedule the function to exectue after 300, 000 (5 minutes) after game start...