Page 1 of 1

Loading delayed mutators :: ??

Posted: Tue Jul 10, 2018 7:57 pm
by Nelsona
I'm wondering if I will not need some tool configurable for loading mutators LATER - let's say a configurable time 1-3 seconds from initializing all the rest of default stuff.
Such thing probably will be needed when used NavAdder in some borked maps which need other paths in run-time. Mutators dependent on Navigation might go screwed up so they have to take place AFTER deploying the new network. We can chat about SwarmSpawners, Relics and other stuff which will go in crap if Old Navigation is removed - I mean a new NavigationPointList is created.
If they are known (not future ones), they can be hunted and saved in patch files and removing them. After creating new paths we can bring other copies of them for the fresh created navigation network.
Probably solution is firing them with a delay - any future such mutator can spawn POST Re-Pathing map in order to not cause borks when old Nodes are moved into void or destroyed.
Explanation is:
There are maps which are a pain to solve Navigation using current nodes which are more or less borked and Iterating through them for tweaks might head into a crashed game. By using a slow method mutators navigation based might fail to work later when desired node is gone, because for such screwed up maps we really do need a clean and fresh paths-net.

For the moment I mitigated ugly things in a patch file as follows:

Code: Select all

final function ChangeNastyActors()
{
	local Actor A;
	local SpawnPoint Sp;
	local Rotator NewRot;
	local string APack;

	foreach AllActors(class'Actor',A)
	{
		if ( string(A.Name) ~= "SS0" )
		{
			APack = GetPackageOrigin(A);
			APack = Apack$".SS";
			DelMut = class<Actor>(DynamicLoadObject(APack,class'Class',True));
			A.Destroy();
			if ( DelMut == None )
			{
				Log ("Could not save any valid Mutator"@APack,Ltag);
			}
			else
				log ("Deleted and Saved Mutator"@DelMut,LTag);
		}
	}
	A = None;
}
Then reloading it during pathing state after deploying the new Network.

Code: Select all

	if ( DelMut != None )
	{
		Level.Spawn(DelMut);
		log ( "Reloading deleted mutator for new Navigation Network ::"@DelMut,LTag);
	}
And then we do have a funky log - see old thing compared with newer coming later (happening in a second)

Code: Select all

ScriptLog: SS0 >> Initializing. Version used for Multi-Spawn.
ScriptLog: SwarmSpawn: Precache failed for: NsMonster.NsWarLord
ScriptLog: Precached NsSkaarjTrooper0
ScriptLog: Precached NsSkaarjGunner0
ScriptLog: Precached NsSkaarjOfficer0
ScriptLog: Precached NsMercenary0
ScriptLog: Precached NsSkaarjBerserker0
ScriptLog: Precached NsSkaarjLord0
ScriptLog: Precached NsLesserBrute0
ScriptLog: Found Instigator Pawn DM-Anatis.UTSkaarjRocket0 for DM-Anatis.EUT_Eightball0 as replacement for DM-Anatis.UT_Eightball1.
ScriptLog: Precached UTSkaarjRocket0
ScriptLog: Precached NsGasbag0
ScriptLog: Precached NsSlith0
ScriptLog: Precached UTSkaarjShock0
ScriptLog: Precached UTSkaarjRipper0
ScriptLog: SwarmSpawn Init - Spawnpoint count: 115  Number Swarms: 12
....
ANATIS: Navigation processing done, spawning new paths...
ANATIS: Moving Navigation obstructions
ANATIS: Deploy Navigation...
ANATIS: Paths Deployed...
DevNet: NotifyAcceptingChannel Control 0 server Level DM-Anatis.MyLevel: Accepted
DevNet: Level server received: HELLO REVISION=0 MINVER=400 VER=436
ScriptLog: SS0 >> Initializing. Version used for Multi-Spawn.
ScriptLog: Precached NsWarLord0
ScriptLog: Precached NsSkaarjTrooper0
ScriptLog: Precached NsSkaarjGunner0
ScriptLog: Precached NsSkaarjOfficer0
ScriptLog: Precached NsMercenary0
ScriptLog: Precached NsSkaarjBerserker0
ScriptLog: Precached NsSkaarjLord0
ScriptLog: Precached NsLesserBrute0
ScriptLog: Found Instigator Pawn DM-Anatis.UTSkaarjRocket0 for DM-Anatis.EUT_Eightball0 as replacement for DM-Anatis.UT_Eightball1.
ScriptLog: Precached UTSkaarjRocket0
ScriptLog: Precached NsGasbag0
ScriptLog: Precached NsSlith0
ScriptLog: Precached UTSkaarjShock0
ScriptLog: Precached UTSkaarjRipper0
ScriptLog: SwarmSpawn Init - Spawnpoint count: 45  Number Swarms: 25
Actually we do have less spawn locations in a new network but, we have solved Warlord which could not be in pre-cache because of a stupid node supposed to be for caching task placed like having brain on drugs...
After deploying a new network in game we can have Warlords in game even if spawn locations are fewer. Game is going improved, fresh paths are tested and operational. XCGE is able to regain SS actor in original name, is not SS1 because SS0 is gone, we do have another SS0 because the older one is no longer in action - Higor did actors recycling well. Greetings, Higor!

Major Tech Hint:
In order to work fore-mentioned task, any ScoreSaver tool has to be placed AFTER SwarmSpawner in mutators chain or else funky things will occur. This configuration is currently loaded as evidence at NfoServer - which still do need the right Server-Name - because both mutators use class-name SS, and SS0 needs to be the Spawner one not the ScoreSaver.

In a closer future I will write a mutator for launching mutators that might have to be delayed, not everything needs to be loaded in first tick. Patience has advantages in this Engine with Hard-Coded limitations.

Re: Loading delayed mutators :: ??

Posted: Wed Jul 11, 2018 4:02 am
by Nelsona
Hmmm, I have now something running at NfoServer which will be initialized for certain game-types. It looks like here:

Code: Select all

class DelayerM expands Mutator config (DelayedMuts);

var() config string LaterMuts[64];
var() config float DelayLoadTime;
var bool bInit;

event PostBeginPlay()
{
	if (!bInit)
	{
		InitialState = 'WaitAndGo';
		bInit=True;
		if ( DelayLoadTime == 0 )
		{
			Default.DelayLoadTime = 3;
			DelayLoadTime = 3;
			SaveConfig();
		}
	}
}

final function LoadSetup()
{
	local int i;
	local class<Actor> Act;
	local Actor M;
	local Mutator Mu;
	local Actor Ac;

	for (i = 0; I < 64; i++)
	{
		if ( LaterMuts[i] != "" )
		{
			log ("Seeking configured"@LaterMuts[i]$".",'DelayerM');
			Act = class<Actor>(DynamicLoadObject(LaterMuts[i],class'Class'));
			if ( Act != None )
			{
				log ("Found and spawn"@LaterMuts[i]$".",'DelayerM');
				Act.Default.bGameRelevant = True;
				if ( Act.Isa('Mutator') && Level.Game.BaseMutator != None )
				{
					M = Spawn(Act);
					Mu = Mutator(M);
					Level.Game.BaseMutator.AddMutator(Mu);
				}
				else
				{
					Level.Spawn(Act);
				}
			}
			else
			{
				log ("Could not find and load some bullshit called"@LaterMuts[i]$". Have a Nice Day, because... I hate you at random.",'DelayerM');
				break;
			}
			Act = None;
		}
		else
			break;
	}
	log ("Loading Delayed Mutators/Actors has been finished.",'DelayerM');
}

State() WaitAndGo
{
Begin:
	Sleep(DelayLoadTime);
Continuing:
	LoadSetup();
End:
	GoToState('');
}