Server/Scoring Testing..

General Comments, Questions about all things OmnipotentS that don't go in other topics/forums
User avatar
pooty
Posts: 4358
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Server/Scoring Testing..

Post by pooty »

Mutators in use (in command line order)

UAdminModV095b.UAdminMod
UTCompOmni.MutUTComp
EvenMatchOmni.MutTeamBalance
CSBadgerFix.MutBadgerFix
CSVehiclePack.MutSnarfVehiclePack
Zound55.Zound (unlikely)
SimpleServerSwitcher.MutSimpleServerSwitcher (unlikely)

And map dependent (these were part of the game so I guess they were coded properly)
QuadJump
MutWheeledVehicleStunts

Server Actors (besides the "stock" ones)
ServerActors=WebadminSpaceFix.WebadminSpaceFix (unlikely)
ServerActors=AntiTCC2009r6.MutAntiTCCFinal (Anti-cheat)
ServerActors=OLStats.OLSQMSUplink (For stats upload)
ServerActors=MasterServerMirror.MasterServerMirror (lets the server talk to more than one master server)
User avatar
pooty
Posts: 4358
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Server/Scoring Testing..

Post by pooty »

From UTComp_GameRules.uc

Code: Select all

function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
{
    local byte HitSoundType;
    local UTComp_PRI uPRI;
    local controller C;

    if(Damage>0 && InstigatedBy!=None && Injured!=None && InstigatedBy.Controller!=None && BS_xPlayer(InstigatedBy.Controller)!=None)
    {
        if(UTCompMutator.EnableHitSoundsMode>0)
        {
            BS_xPlayer(InstigatedBy.Controller).ReceiveHit(DamageType, Damage, Injured);

            if(InstigatedBy==Injured)
                HitSoundType=0;
            else if(InstigatedBy.GetTeamNum()==255 || InstigatedBy.GetTeamNum() != Injured.GetTeamNum())
                HitSoundType=1;
            else
                HitSoundType=2;
            for(C=Level.ControllerList; C!=None; C=C.NextController)
            {
                if(BS_xPlayer(C)!=None && C.PlayerReplicationInfo!=None && (C.PlayerReplicationInfo.bOnlySpectator || C.PlayerReplicationInfo.bOutOfLives) && PlayerController(C).ViewTarget == InstigatedBy)
                {
                    BS_xPlayer(C).ReceiveHitSound(Damage, HitSoundType);
                }
            }
        }
        else if(BS_xPlayer(InstigatedBy.Controller).bWantsStats && UTCompMutator.bEnableWeaponStats)
        {
            BS_xPlayer(InstigatedBy.Controller).ReceiveStats(DamageType, Damage, Injured);
        }

        BS_xPlayer(InstigatedBy.Controller).ServerReceiveHit(DamageType, Damage, Injured);
    }
    if(Injured!=None && Injured.Controller!=None && BS_xPlayer(Injured.Controller)!=None)
    {
            uPRI=Class'UTComp_Util'.Static.GetUTCompPRIForPawn(Injured);
            if(uPRI!=None)
                uPRI.DamR+=Damage;
    }
    if ( NextGameRules != None )
		return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
	return Damage;
}
   
Could it be the UTComp_GameRules is missing?

Damage = super.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );

But looking at other code, that's not there in some mods either....

And Forward_GameRules (in UTComp) is missing, but not sure if that's even used/called?
if ( NextGameRules != None )
return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );

And in the original ONSPLus GameRules:

Code: Select all

function int NetDamage(int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
{
	local float CurDamage;

	CurDamage = Super.NetDamage(OriginalDamage, Damage, injured, instigatedBy, HitLocation, Momentum, DamageType);

	if (DamageType != Class'DamTypeLinkShaft' && DamageType != Class'DamTypeLinkPlasma' && injured != None
		&& Vehicle(injured) != None && !Vehicle(injured).IsVehicleEmpty() && instigatedBy != None
		&& instigatedBy != injured && CurDamage > 0 && instigatedBy.Controller != none
		&& instigatedBy.Controller.PlayerReplicationInfo != none
		&& ONSPlusPlayerReplicationInfo(instigatedBy.Controller.PlayerReplicationInfo) != none)
	{
		if (OPGRI == none && PlayerController(instigatedBy.Controller) != none && PlayerController(instigatedBy.Controller).GameReplicationInfo != none
			&& ONSPlusGameReplicationInfo(PlayerController(instigatedBy.Controller).GameReplicationInfo) != none)
			OPGRI = ONSPlusGameReplicationInfo(PlayerController(instigatedBy.Controller).GameReplicationInfo);

		if (OPGRI != none)
		{
			if (Vehicle(injured).Team != instigatedBy.Controller.PlayerReplicationInfo.TeamID)
				ONSPlusPlayerReplicationInfo(instigatedBy.Controller.PlayerReplicationInfo).AddVehicleDamageBonus(CurDamage / OPGRI.DamageScoreQuota);
			else
				ONSPlusPlayerReplicationInfo(instigatedBy.Controller.PlayerReplicationInfo).AddVehicleDamageBonus(-1.0 * CurDamage / OPGRI.DamageScoreQuota);
		}
	}

	return CurDamage;
}
Its missing
if ( NextGameRules != None )
return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );

So its a bit confusing whether
if ( NextGameRules != None )
return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
is needed (I would think if we have multiple mutators with .NetDamage Functions want them to be called, but wouldn't
CurDamage = Super.NetDamage(OriginalDamage, Damage, injured, instigatedBy, HitLocation, Momentum, DamageType);

Kind of do the same thing, but only for SuperClasses of the mutator. But most game rules seems to follow this:
Class UTComp_ONSGameRules extends GameRules;

So calling Super is really just calling GameRules.NetDamage anyway, since I don't think I've ever seen a game rules extend anything but GameRules.
User avatar
captainsnarf
Posts: 2632
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: Server/Scoring Testing..

Post by captainsnarf »

NextGameRules is EvenMatch. UTComp and EvenMatch are the two mutators with rule modifiers.

Code: Select all

Class UTComp_ONSGameRules extends GameRules;
Is that correct or does it extend ONSGameRules?
User avatar
pooty
Posts: 4358
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Server/Scoring Testing..

Post by pooty »

Code: Select all

Class UTComp_ONSGameRules extends GameRules;
Is how its in the code. Should it extend ONSGameRules? Is there a class that's just ONSGameRules?

EvenMatchOmni

Code: Select all

class EvenMatchRules extends GameRules config(EvenMatchPPH) parseconfig;
But that has no NetDamage Function, so it would just get the GameRules NetDamage Function:

From base GameRules:

Code: Select all

function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
{
    if ( NextGameRules != None )
        return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
    return Damage;
}
So do we need the
CurDamage = Super.NetDamage(OriginalDamage, Damage, injured, instigatedBy, HitLocation, Momentum, DamageType);
?

I think we only really need that anyway if we Modify the damage, which UTComp isn't, its just using it for points. Meaning we could just say
CurDamage = Damage; // passed in from function param.


But all in all, it looks like things are as they should be, meaning NextGameRules should cascade, and without debugging can't tell why the points aren't being added??
Which I think we have
UTComp_GameRules
UTComp_ONSGameRules
EvenMatchRules

And some maps have OnslaughtSpecials package embedded with this:

class ONSSpecialPowerLinkUpdater extends GameRules dependson(ONSPowerlinkOfficialSetupSupplement);
But that has no NetDamage Override function so it should be fine.
User avatar
pooty
Posts: 4358
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Server/Scoring Testing..

Post by pooty »

So here's a difference: In UTComp_ONSGameRules the last return is:

return CurDamage;

But every other time I see:
if ( NextGameRules != None )
return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
return Damage;

Now maybe the Super call needs to go, and the return is just
return Damage;

Wait... Damage is not a float, Damage is an int.

So,

Code: Select all

//points for damaging vehicles 
function int NetDamage(int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
{
	//local float CurDamage;

	//CurDamage = Super.NetDamage(OriginalDamage, Damage, injured, instigatedBy, HitLocation, Momentum, DamageType);

	if (DamageType != Class'DamTypeLinkShaft' && DamageType != Class'DamTypeLinkPlasma' && injured != None
		&& Vehicle(injured) != None && !Vehicle(injured).IsVehicleEmpty() && instigatedBy != None
		&& instigatedBy != injured && Damage > 0 && instigatedBy.Controller != none // change CurDamage to Damage
		&& instigatedBy.Controller.PlayerReplicationInfo != none
		&& UTComp_ONSPlayerReplicationInfo(instigatedBy.Controller.PlayerReplicationInfo) != none)
	{
		if (OPGRI == none && PlayerController(instigatedBy.Controller) != none && PlayerController(instigatedBy.Controller).GameReplicationInfo != none)
			OPGRI = PlayerController(instigatedBy.Controller).GameReplicationInfo;

		if (OPGRI != none)
		{
			if (Vehicle(injured).Team != instigatedBy.Controller.PlayerReplicationInfo.TeamID)
            {
				UTComp_ONSPlayerReplicationInfo(instigatedBy.Controller.PlayerReplicationInfo).AddVehicleDamageBonus(CurDamage / MutatorOwner.RepInfo.VehicleDamagePoints);
            }
			else
            {
				UTComp_ONSPlayerReplicationInfo(instigatedBy.Controller.PlayerReplicationInfo).AddVehicleDamageBonus(-1.0 * CurDamage / MutatorOwner.RepInfo.VehicleDamagePoints);
            }
		}
	}
    
    if ( NextGameRules != None )
		return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );

	return Damage;  //CurDamage to Damage.
}
returning CurDamage is float type, and return here is int. Not sure how the type conversion works, but that seems sketchy.
According to this it should be fine https://wiki.beyondunreal.com/Typecasting#float_to... but passing wrong type in function return I wouldn't be surprised if something odd happens.
User avatar
captainsnarf
Posts: 2632
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: Server/Scoring Testing..

Post by captainsnarf »

The type conversion should work fine. It's either CurDamage is a float, or we make CurDamage an int and cast the value sent to AddVehicleDamageBonus() to a float instead. Either way there is a type conversion.

There is no ONSGameRules class btw. I wasn't sure.

UTComp_GameRules -> this mostly is doing hit sounds for us.
UTComp_ONSGameRules -> this is doing a bunch of stuff, like node isolation bonus, hit sounds on nodes, points for damaging vehicles, and other stuff.

Both of these GameRules classes are in use, so we do need them to call NextGameRules so they work together.
User avatar
pooty
Posts: 4358
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Server/Scoring Testing..

Post by pooty »

Both of these GameRules classes are in use, so we do need them to call NextGameRules so they work together.
Yep both are there, and it seems all the gamerules have that NextGameRules, so I think its getting called.

Its either the type conversion (which should be fine as we said), or something in the that if that's kicking it back.

I think we should clean it up, wasn't that base ONSPlus code?
Do you want to do it or I can do it?
User avatar
captainsnarf
Posts: 2632
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: Server/Scoring Testing..

Post by captainsnarf »

Go for it! :) I'm on-call at work this week so am a bit busy myself. The latest version is updated on our github.

It might be helpful to add a config value e.g. 'bDebugLogging' and then log everything if that is set. Another idea is to use PlayerController.ClientMessage() so you can see the messages in game without needing to check logs.
User avatar
pooty
Posts: 4358
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Server/Scoring Testing..

Post by pooty »

Ok will do.

I'll add the bDebugLogging flag... to that function as well
User avatar
pooty
Posts: 4358
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Server/Scoring Testing..

Post by pooty »

Getting an error compiling:
Compiling UTComp_Warmup
C:\games\UT2004\UTCompOmni\Classes\UTComp_Warmup.uc(562) : Error, Unrecognized member 'NotifyEndWarmup' in class 'BS_xPlayer'
Compile aborted due to errors.
Failure - 1 error(s), 0 warning(s)

There is no member/Method NotifyEndWarmup in BS_xPlayer but

from UTComp_warmup

Code: Select all

function NotifyPlayers()
{
    local Controller C;

    for(C=Level.ControllerList; C!=None; C=C.NextController)
        if(BS_xPlayer(C)!=None)
        {
            BS_xPlayer(C).NotifyEndWarmup();
        }
}
Its calling it.

Is it possible the previous build is calling BS_xPlayer class from somewhere else?

Looks like that function was in BS_xPlayer back in august according to git:

Code: Select all

simulated function NotifyEndWarmup()
{
    NotReady(true);
    if(GameReplicationInfo!=None)
        SetClockTime(GameReplicationInfo.TimeLimit*60+1);
    ResetEpicStats();
    ResetUTCompStats();
    StartDemo();
    bInTimedOvertime=false;
}
It got removed sometime between Aug (1.12) and Sept (1.22) according to git.
I could add it back, but looks like you removed it deliberately as it was also removed from replication block...
Post Reply