Keep going here.
I think what I wanna say is matching Title. I don't want to keep some of my thoughts only for me. For some default matches which are not using heavy modifiers I think I'm gonna change default PlayerReplicationInfo just for testing and... new options that can be used (later about these).
I was looking over PlayerReplicationInfo and was interested to change timer code with state code for figuring effects. Let's say that timer is not interesting for me - also Bot it is included in stage with some useless checks removed.
Default PlayerReplicationInfo is root for Player's one and Bot's one. Yes root code has a timer updating location and checking Net info using a double PlayerPawn check (a single one has problems ?). Else I removed that random < 0.65 because I don't like this way.
Old code
PlayerReplicationInfo wrote:
Code: Select all
...
function PostBeginPlay()
{
StartTime = Level.TimeSeconds;
Timer();
SetTimer(2.0, true);
bIsFemale = Pawn(Owner).bIsFemale;
}
function Timer()
{
local float MinDist, Dist;
local LocationID L;
MinDist = 1000000;
PlayerLocation = None;
if ( PlayerZone != None )
for ( L=PlayerZone.LocationID; L!=None; L=L.NextLocation )
{
Dist = VSize(Owner.Location - L.Location);
if ( (Dist < L.Radius) && (Dist < MinDist) )
{
PlayerLocation = L;
MinDist = Dist;
}
}
if ( FRand() < 0.65 )
return;
if (PlayerPawn(Owner) != None)
Ping = int(PlayerPawn(Owner).ConsoleCommand("GETPING"));
if (PlayerPawn(Owner) != None)
PacketLoss = int(PlayerPawn(Owner).ConsoleCommand("GETLOSS"));
}
I'm currently testing with no issues timer-free code of a sort of replication for "players".
E_PlayerReplicationInfo wrote:
Code: Select all
class E_PlayerReplicationInfo expands PlayerReplicationInfo;
var int TimeNet; //This is for interval net check related
function PostBeginPlay()
{
StartTime = Level.TimeSeconds;
/*
Removed these friends of mine
Timer();
SetTimer(2.0, true);
*/
if ( Pawn(Owner) != None ) //added a check because it doesn't hurt
bIsFemale = Pawn(Owner).bIsFemale;
}
function Timeing() //A sort of timer
{
local float MinDist, Dist;
local LocationID L;
// log (Self.Name@"working..."); //Tested
MinDist = 1000000;
PlayerLocation = None;
if ( PlayerZone != None )
for ( L=PlayerZone.LocationID; L!=None; L=L.NextLocation )
{
Dist = VSize(Owner.Location - L.Location);
if ( (Dist < L.Radius) && (Dist < MinDist) )
{
PlayerLocation = L;
MinDist = Dist;
}
}
TimeNet++;
if ( TimeNet < 2 ) //It's not time to get ping ?
GoTo NoThingToDo;
else
{
if (PlayerPawn(Owner) != None) //A Single check for 2 things
{
Ping = int(PlayerPawn(Owner).ConsoleCommand("GETPING"));
PacketLoss = int(PlayerPawn(Owner).ConsoleCommand("GETLOSS"));
}
TimeNet = 0; //And reset
}
NothingToDo: //Nothing bellow this label
}
Auto State TickingTime
{
Begin:
Sleep(0.00);
Looping:
if ( Pawn(Owner) == None ) //Self guard
GoTo ('End');
Timeing();
Sleep(1.99); //little fun
GoTo ('Looping'); //repeat - like timer
End:
Destroy(); //Destroy internally if it needs to
}
The Bot Has a similar one but without checking any PlayerPawn(Owner) because doesn't make sense. I'm gonna quit timers as long as in a doc I was reading that Unreal Engine can guide even 100 Actors each of them being in a state, else I did not see anywhere a doc recommending 100 Mutators with Timer, after figuring some random rare issues at this problem I will keep removing timers letting "State Machine" to take place.
What else it's doable ? Let's say if that if we have laggers we can get rid of them right here - no other mutators loaded. If we have nasty people also we can do checks here and removing them.
Implementation ? I think this is an answer due to chronology of executions:
NsUTw - Mutator wrote:
Code: Select all
...
function bool AlwaysKeep(Actor Other)
{
if ( PlayerPawn(Other) != None )
{
PlayerPawn(Other).PlayerReplicationInfoClass = class'E_PlayerReplicationInfo';
return True;
}
if ( Bot(Other) != None )
{
Bot(Other).PlayerReplicationInfoClass = class'E_BotReplicationInfo';
return True;
}
if ( NextMutator != None )
return ( NextMutator.AlwaysKeep(Other) );
return false;
}
...
Technically we need Pawn spawned and quickly hook before to execute any code. By doing other way you might not see logs as expected because it doesn't work else "LOGS ARE ALWAYS SHOWN" if code has a logic of timing.
Also we might insert Country, Host, bIsJerk, etc. Even we might have some INI with a small database... eh.