Mission Cycling Fix for AFX 2.0/TGE
by Gibby · 11/22/2010 (8:10 pm) · 0 comments
In AFX 2.0, TGE particles were updated to work like TGEA - as a result the ClientMissionGroup cleanup needs to be added to TGE 1.5.2. In order to get mission cycling to work with the AFX demo in a non-RPG setting, a couple of mods need to be made:
Code changes:
afxEA_ParticleEmitter.h
Add @ 39
afxEA_ParticleEmitter.cc
Replace @ 34:
Recompile...
Now we'll make some changes to the scripts, starting with the common folder:
common/client/mission.cs
Replace 10 - 43:
Now the server side:
arcane.fx/server/game.cs
Replace @ 7:
We found that in certain instances the server loaded the mission before all of the clients had purged particles. Modding the endGame prevents this. Replace both functions 125-168:
Now that the missions are cycling, we have need of the endGameGui...
endGameGui.gui
Replace @ 11:
That should do it! I've had a pair of PCs and a pair of OSX Macs cycling missions for hours with no errors. If you can improve on these scripts, please let me know...
PEACE
Gibby
Code changes:
afxEA_ParticleEmitter.h
Add @ 39
virtual void onDeleteNotify(SimObject*); //<< Cycle Missions - Gibby
afxEA_ParticleEmitter.cc
Replace @ 34:
if (emitter)
{
clearNotify(emitter); //>> Cycle Missions - Gibby
emitter->deleteWhenEmpty();
emitter = 0; //<< Cycle Missions - Gibby
} Recompile...
Now we'll make some changes to the scripts, starting with the common folder:
common/client/mission.cs
Replace 10 - 43:
function clientCmdMissionStart(%seq)
{
// The client recieves a mission start right before
// being dropped into the game.
//>> Cycle Missions - Gibby: added as a safety
if( isObject(ClientMissionCleanup) )
ClientMissionCleanup.delete();
new SimGroup( ClientMissionCleanup );
}
function clientCmdMissionEnd(%seq)
{
echo("************** mission.cs->clientCmdMissionEnd called");//>> Cycle Missions - Gibby
echo("mission.cs->clientCmdMissionEnd afxEndMissionNotify");
afxEndMissionNotify();//>> Cycle Missions - Gibby
// Recieved when the current mission is ended.
alxStopAll();
// Disable mission lighting if it's going, this is here
// in case the mission ends while we are in the process
// of loading it.
$lightingMission = false;
$sceneLighting::terminateLighting = true;
if( isObject(ClientMissionCleanup) )
{
ClientMissionCleanup.delete();
echo("*** clientCmdMissionEnd -> ClientMissionCleanup.delete");//>> Cycle Missions - Gibby
}
//clearClientPaths();
}
//<< Cycle Missions - GibbyNow the server side:
arcane.fx/server/game.cs
Replace @ 7:
$Game::Duration = 5 * 60; // >> Cycle Missions - Gibby
We found that in certain instances the server loaded the mission before all of the clients had purged particles. Modding the endGame prevents this. Replace both functions 125-168:
function endGame()
{
if (!$Game::Running) {
error("endGame: No game running!");
return;
}
stop_NonPlayerWrangler(); // AFX
// Stop any game timers
cancel($Game::Schedule);
// Inform the client the game is over
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
// >> Cycle Missions - Gibby: prevents cleint.server offset issue
echo("server/game.cs->endGame $cl is " @ %cl);
%cl.endMission();
%cl.resetGhosting();
//<< Cycle Missions - Gibby
commandToClient(%cl, 'GameEnd');
}
// Delete all the temporary mission objects
//>> Cycle Missions - Gibby: prevents the clients from crashing on mission load
//resetMission();
//<< Cycle Missions - Gibby
$Game::Running = false;
}
function onGameDurationEnd()
{
// This "redirect" is here so that we can abort the game cycle if
// the $Game::Duration variable has been cleared, without having
// to have a function to cancel the schedule.
//>> Cycle Missions - Gibby remove editorGui check
//if ($Game::Duration && !isObject(EditorGui))
//<< Cycle Missions - Gibby
if ($Game::Duration)
cycleGame();
}Now that the missions are cycling, we have need of the endGameGui...
endGameGui.gui
Replace @ 11:
bitmap = "arcane.fx/client/afx/ui/images/afx_background";
That should do it! I've had a pair of PCs and a pair of OSX Macs cycling missions for hours with no errors. If you can improve on these scripts, please let me know...
PEACE
Gibby
