Most logs are shown

Discussions about Coding and Scripting
Post Reply
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Most logs are shown

Post by sektor2111 »

Introduction for chapter "pawns designing"

Code: Select all

ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function MUPawns.SkaarjDemon.ClawDamageTarget:0025) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function UnrealShare.ScriptedPawn.MeleeDamageTarget:000D) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function UnrealShare.ScriptedPawn.MeleeDamageTarget:0030) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function MUPawns.SkaarjDemon.ClawDamageTarget:0025) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function UnrealShare.ScriptedPawn.MeleeDamageTarget:000D) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function UnrealShare.ScriptedPawn.MeleeDamageTarget:0030) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function MUPawns.SkaarjDemon.ClawDamageTarget:0025) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function UnrealShare.ScriptedPawn.MeleeDamageTarget:000D) Accessed None
ScriptWarning: SkaarjDemon MH-FightOn.SkaarjDemon0 (Function UnrealShare.ScriptedPawn.MeleeDamageTarget:0030) Accessed None
.............
Critical: appError called:
Critical: GhostSkaarj MH-FightOn.GhostSkaarj7 (Function MUPawns.SkaarjZombie.WhatToDoNext:0015) Runaway loop detected (over 10000000 iterations)
Exit: Executing UObject::StaticShutdownAfterError
Critical: FFrame::Serialize
Critical: AActor::ProcessState
Critical: Object GhostSkaarj MH-FightOn.GhostSkaarj7, Old State State UnrealShare.ScriptedPawn.Attacking, New State State UnrealShare.ScriptedPawn.Attacking
Critical: AActor::Tick
Critical: TickAllActors
Critical: ULevel::Tick
Critical: (NetMode=1)
Critical: TickLevel
Critical: UGameEngine::Tick
Critical: UpdateWorld
Critical: UServerCommandlet::Main
Exit: Exiting.
Uninitialized: Name subsystem shut down
Due to forum rule no. 1 which I previously read I can say only: THANK YOU, PEOPLE for your contribution in doing stuff for community. The rest of debates are private... like the place of my body which I'm wiping with this stuff.
What is the problem in that function ? Take a breath and see

Code: Select all

function bool MeleeDamageTarget(int hitdamage, vector pushdir)
{
	local vector HitLocation, HitNormal, TargetPoint;
	local actor HitActor;
	
	// check if still in melee range
	If ( (VSize(Target.Location - Location) <= MeleeRange * 1.4 + Target.CollisionRadius + CollisionRadius)
		&& ((Physics == PHYS_Flying) || (Physics == PHYS_Swimming) || (Abs(Location.Z - Enemy.Location.Z) 
			<= FMax(CollisionHeight, Enemy.CollisionHeight) + 0.5 * FMin(CollisionHeight, Enemy.CollisionHeight))) )
	{	
		HitActor = Trace(HitLocation, HitNormal, Enemy.Location, Location, false);
		if ( HitActor != None )
			return false;
		Target.TakeDamage(hitdamage, Self,HitLocation, pushdir, 'hacked');
		return true;
	}
	return false;
}
Explanations:
- first of all function gets called unwrapped;
- second is Null checking for stuff making a soup with Enemy and Target - sometimes are not the same thing - see TTShoot type things.
Doing new sorta stupid creatures I was interested to see if anyone have a tiny interest in a quality work but looks like NONE really cares... so NONE goes in logs too.

Tryouts at solving issue:
#1

Code: Select all

function bool MeleeDamageTarget(int hitdamage, vector pushdir)
{
	local vector HitLocation, HitNormal, TargetPoint;
	local actor HitActor;

//Setup things first
	if ( Enemy !=None && Enemy.Health > 0 && Target == None )
		Target = Enemy;
//
	// check if still in melee range - AND IF EXIST A SHIT In RANGE
	if (Target != None)
	If ( (VSize(Target.Location - Location) <= MeleeRange * 1.4 + Target.CollisionRadius + CollisionRadius)
		&& ((Physics == PHYS_Flying) || (Physics == PHYS_Swimming) || (Abs(Location.Z - Target.Location.Z) 
			<= FMax(CollisionHeight, Target.CollisionHeight) + 0.5 * FMin(CollisionHeight, Target.CollisionHeight))) )
	{	
		HitActor = Trace(HitLocation, HitNormal, Target.Location, Location, false);
		if ( HitActor != None )
			return false;
		Target.TakeDamage(hitdamage, Self,HitLocation, pushdir, 'hacked');
		return true;
	}
	return false;
}
#2

Code: Select all

function bool MeleeDamageTarget(int hitdamage, vector pushdir)
{
	local vector HitLocation, HitNormal, TargetPoint;
	local actor HitActor;

//Setup things first
	if ( (Enemy !=None
		 && Enemy.Health > 0
			&& !Enemy.bHidden
				&& Enemy.Mesh != None ) //AND SO ON
			&& Target == None )
		Target = Enemy;
	if (Target == None)
		return False;
	// check if still in melee range - - // -
	if (Target != None)
	If ( (VSize(Target.Location - Location) <= MeleeRange * 1.4 + Target.CollisionRadius + CollisionRadius)
		&& ((Physics == PHYS_Flying) || (Physics == PHYS_Swimming) || (Abs(Location.Z - Target.Location.Z) 
			<= FMax(CollisionHeight, Target.CollisionHeight) + 0.5 * FMin(CollisionHeight, Target.CollisionHeight))) )
	{	
		HitActor = Trace(HitLocation, HitNormal, Target.Location, Location, false);
		if ( HitActor != None )
			return false;
		Target.TakeDamage(hitdamage, Self,HitLocation, pushdir, 'hacked');
		return true;
	}
	return false;
}
Pretty hard after all to sanitize code, huh ?
#3 - Child of something ?

Code: Select all

function bool MeleeDamageTarget(int hitdamage, vector pushdir)
{
	local vector HitLocation, HitNormal, TargetPoint;
	local actor HitActor;

//Setup things first
	if ( (Enemy !=None
		 && Enemy.Health > 0
			&& !Enemy.bHidden
				&& Enemy.Mesh != None ) //AND SO ON
			&& Target == None )
		Target = Enemy;
	if (Target == None)
		return False;
	if (Target != None)
		return Super(ScriptedPawn).MeleeDamageTarget(hitdamage,pushdir); //Check the call and allow original code to run if you cry for it
	return False;
First thing is to assign a target only if doesn't exist something as target already. What target to set ? Enemy if present and valid. Then if target exist do checks and attack TARGET chapter, not mixing Enemy and Target because Target can be any sort of actor and Enemy can be only a Pawn. So do setup if needs, check if exist then return False or True.

That crash belongs to COPY-PASTE habits. First of all Berserker code do crash like that and looks like is a code moved with no fix. We can debate solutions if exist interest, else... No debates and MAP REMOVED - Good Night and Sweet Dreams, dear !
User avatar
papercoffee
Godlike
Posts: 10447
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Most logs are shown

Post by papercoffee »

I don't get it...
sektor2111 wrote:We can debate solutions if exist interest, else... No debates and MAP REMOVED - Good Night and Sweet Dreams, dear !
What was the problem? Did I miss something?
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Most logs are shown

Post by Barbie »

papercoffee wrote:I don't get it...
sektor2111 is referring to the package "MUPawns.u" which contains some custom Pawns. As often the coder seemed not thoughtful what leads to warnings or errors in the log file or even server crashes. As sektor2111 stated, there might some problems in the function MUPawns.SkaarjDemon.ClawDamageTarget(), but IMO much more dangerous is function MUPawns.SkaarjZombie.WhatToDoNext(), which caused a server crash:
sektor2111's log wrote:Critical: GhostSkaarj MH-FightOn.GhostSkaarj7 (Function MUPawns.SkaarjZombie.WhatToDoNext:0015) Runaway loop detected (over 10000000 iterations)
I cannot see at once what's wrong here but what happens if aPawn==self?
function MUPawns.SkaarjZombie.WhatToDoNext

Code: Select all

function WhatToDoNext(name LikelyState, name LikelyLabel)
{
	local Pawn aPawn;

	aPawn = Level.PawnList;
	while ( aPawn != None )
	{
		if ( (aPawn.IsA('PlayerPawn') || aPawn.IsA('ScriptedPawn'))
			&& (VSize(Location - aPawn.Location) < 500)
			&& CanSee(aPawn) )
		{
			if ( SetEnemy(aPawn) )
			{
				GotoState('Attacking');
				return;
			}
		}
		aPawn = aPawn.nextPawn;
	}
	
	Super.WhatToDoNext(LikelyState, LikelyLabel);
}
sektor2111 wrote:No debates and MAP REMOVED
It's a problem of the library, not of the map. Just do a

Code: Select all

if (String(Other.Class) == "MUPawns.SkaarjZombie")
	{
		ReplaceWith(Other, "UnrealShare.SkaarjWarrior");
		return false;
	}
in your CheckReplacement to get rid of it.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Most logs are shown

Post by sektor2111 »

Okay let's talk about WhatTodoNext('','').
This function exist in Bot and ScriptedPawn. It is called when pawn has operated some kill or whatever chapter in its existence being interested to return in a state which is the usual job - Bot attempt to roam - Monster attempt to: Wait, Patrol, Ambush, Guard. Oh, well... and what's the deal ?
Due to some insanity content swallowed before, someone from Epic decided to have a Berserk code - pretty raw and unwise either. The same cycle exist in function killed when pawn murdered something and look for next nearby threat. If threat doesn't exist will attempt a short roam and WHATTODONEXT which is the same iteration as in killed so code gets doubled. And now... if monster did not see anything in Killed and Neither in WhatTodoNext will have chances to ask WhatToDoNext (again) as long as WhatToDoNext is modified in the class.(OOOOPPSSSYYY....). Calling this permanent leads to an infinite recursion of WhatToDoNext and you might say goodbye to your game (any). Actually the fix code involved 0 lines - read again, this child ScriptedPawn has already berserk code used in parent ScriptedPawn and it doesn't need bullshitting in infinity.
Some games doesn't crash sending pawn in state Waiting while it was intended to attack another thing (self the mostly) but even here might occur because a faster machine iterates faster so it's crashing faster.
I was tracking these at a moment and these states are a hard deal. However things to repeat are never good. Pawn somehow randomly calls this again and again without taking in account the root where simply has to manage what was doing before - follow orders or Roam shortly/Wait properly.
Whoever did MUPawns was interested to release something rather than testing stuff. A bunch of error logs with Pawns attacking Null targets and WhatToDoNext ('crashthisserver','enjoy') shows that UT has more enemies inside under a modder suit. The problem is that we have already a lot of replacement code, and manure factory keeps producing "pawns" so we go nowhere.
Solution ? Oh well... is nasty somehow but it will shows that nobody needs stuff only not fixed.
Replacement might go translated as follows:
- start testing pawn;
- Is class known - allow it and stop;
- is a class properly replaceable - replace it;
- is something later than 2013 ? - a sort of retarded crap which will have 1 to X replacement - replacing with server universal monster or a random monster from 3-5 universal monsters. Testing if pawn is that or that or ... testing other 1000 conditions for monsters types are not a good thing - it's pretty expensive. So if is not stock or known class just ruin it. Also creating a lot of dependencies will force player to download 2 GB of stuff even for maps a la DarkPass. Until download is ready the team has ended game.
Aside if problems occurs at Insekt or whatever do replace them as well with normal pawns. Someday these modders will figure that NONE needs unfixed craps released only for a good looking.
Saying "(if (ScriptedPaw(Other) != None))" to test monsters only in CheckReplacement,
then a string involving class and/or some MyLevel else a boolean goes bBadClass
if (bBadClass) ReplaceMonster(....) and done. I can't wait to attack problem this week-end. All manure will have a replacement or a random one chosen (type Tentacle, type swimmer, type flyer, etc.) Will take time testing but I think it's time for new a tech.
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Most logs are shown

Post by Barbie »

sektor2111 wrote:WhatToDoNext ('crashthisserver','enjoy')
:lol2:
sektor2111 wrote:Also creating a lot of dependencies
If you do it as shown above, no external library is loaded and therefore no dependencies are created.

Code: Select all

String(Other.Class) == "MUPawns.SkaarjZombie"
is a string compare only. Because of name collisions there is a (small) risk that you treat a different package "MUPawns" with this method.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Most logs are shown

Post by sektor2111 »

Yes, with a problem. We are supplied with "pawns" endless - so we go nowhere this way update, update, update... I really don't need 300 <if string checks>. I'll go for uni-replacements. I could figure last time all sort of trash which were presumed "monsters" and they doesn't worth 2 seconds of attention.
Post Reply