UTComp

Discuss and provide feedback on Maps.
User avatar
captainsnarf
Posts: 2713
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: UTComp

Post by captainsnarf »

Thanks pooty! I appreciate it.

There are three versions of all the weapons - 'UTComp_Weapon', 'NewNet_Weapon', and 'Forward_Weapon'. The hierarchy is 'Weapon -> UTComp_Weapon -> NewNet_Weapon -> Forward_Weapon'. I deleted all of the forward weapons so we can forget about those.

The mutator replaces all of the regular weapons with the 'NewNet' version.

In each NewNet weapon's Fire() method, it checks if the player has disabled enhanced net code, if so it calls super.Fire() and returns. This calls the UTComp_Weapon version of fire. All that does is record stats and then calls super.Fire() so that it calls the base regular weapon's fire method.

For the link gun, I modified both NewNet_LinkGun and UTComp_LinkGun to do the scoring changes we wanted, but otherwise they all work the same. NewNet_Weapon is the weapon you get, but if you turned it off in your F5 menu then it calls super.Fire() and you get the UTComp_Weapon Fire() instead.

The main problem is if you turned off EnhancedNetCode on the server, it doesn't replace any weapons at all. Ideally it would replace the regular weapons with the UTComp_Weapon classes.

There is some code around the 'StatsEnabled' flag. If true, it does e.g

Code: Select all

    ...
    class'xWeapons.LinkGun'.default.FireModeClass[0] = Class'UTComp_LinkAltFire';
    class'xWeapons.LinkGun'.default.FireModeClass[1] = Class'UTComp_LinkFire';
    ...
That's the bug and why the LinkGun wouldn't fire with NewNet=false and Stats=true. The weapons aren't replaced, but their weapon fire classes are. The link gun can't work like that because the gun class is what keeps track of who is linking, not the gunfire class.

Today I'm going to add some code that will replace the weapons with the UTComp_Weapon classes when the server has the NewNet flag turned off, and remove that buggy StatsEnabled code.

I'll probably also make it so that if the flag is turned on in the server , the default for the players is still off in the F5 menu, this way if we do turn it on in the server, the players will have to check the box in their F5 menu also to get the newnet code. I really liked it myself but I know other players like leon and enyo did not. Probably better to make it opt-in than opt-out.

Optimizing it will be more difficult. There are a lot of ForEach loops I could probably remove. A lot of classes have code like

Code: Select all

if(M == none)
    forEach DynamicActors(class'MutUTComp', M)
       break;
This loads the M variable. It only happens once since once it's loaded it's no longer 'none', but forEach is expensive. If you die and then pickup a link gun, it's a new spawned link gun and will go through this loop again. So every time someone dies and respawns it puts some load on the server to look these things up. Probably not a lot but it's one optimization I can make.

For every pawn/player it makes a copy pawn and a copy collision actor to go along with it. It uses this to do the ping compensation and detect when hits happen. I'm not sure there is a way around that. It's the way it's designed from the core. The copies do minimal work but it's still like there is double the load on the server. If 24 players are playing, the server is doing the work of 48 players. I'm hoping I can tweak some values to reduce that.
User avatar
pooty
Posts: 4535
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: UTComp

Post by pooty »

Good summary.

So I think the for each everytime someone dies and picks up link gun, its expensive with that foreach. I guess we'd have to see if there's a way to cache that variable, or really how many times it iterates.
But reading this: https://wiki.beyondunreal.com/UE2:Actor_(UT2004)
"DynamicActors
native(313) final iterator function DynamicActors (class<Actor> BaseClass, out Actor Actor, optional name MatchTag)

Iterates over all actors with bStatic set to False. Returned actors can be restricted to subclasses of a certain class and to a specific value of the Tag property. Like AllActorsthis iterator goes over the list of actors in the level, but that list is sorted so static actors come first, allowing DynamicActors' to start directly at the first non-static actor. Note that this optimization is only available after map startup is complete, before that DynamicActors works just like AllActors, possibly returning static actors as well."

So for those of you keeping up at home, "Actor" is a class object. So think of it this way. Actor is a generic object. In UT lots of things are "Actors" players, vehicles, map artifacts (meshes) like crates, cranes, rocks, and even things like lights, emitters (eg. flames, and such), powernodes, and EVEN tank projectiles and such, for example Shock Combo is an actor (short lived). So bStatic set to False gets rid of things like map objects/meshes, but damn in a busy map you have players, weapons, projectiles, weaponlockers etc. How fast does UT parse the entire class list down to a base class? The must be doing similar in the engine or else why have that function
I realize it happens once, but if every death means looping through every MutUTComp actor, why? However, its only looking for actors with base class 'MutUTComp' so it might not be that inefficient...how many actors have MutUTComp as base class? We'd have to figure out someway to load test it.

But why not just replace all the weapons in weapon lockers at startup, similar to CSBadgerFix? Pay the price once and be done with it. No need to worry about respawn stuff, when they pickup, they'd get the right link gun and we don't have to change all the maps. There's already several weapon mutators so this should be easy.
For every pawn/player it makes a copy pawn and a copy collision actor to go along with it. It uses this to do the ping compensation and detect when hits happen. I'm not sure there is a way around that. It's the way it's designed from the core. The copies do minimal work but it's still like there is double the load on the server. If 24 players are playing, the server is doing the work of 48 players. I'm hoping I can tweak some values to reduce that.
This is probably the load, at 32 players, that's 64 worth of tracking and movement. But given at any time say 20 players all firing non-hitscan, you might have 5-10 projectiles each for the server to track, so say 200 items, adding another 20 ghost players, shouldn't crush it too much. However, I'd think the code needs to be really efficient. And need to be careful as it might create an O(n^2) problem (for you non-computer geeks that means adding more creates some power 2 multiplier (each object might need to talk to every other object)... instead of O(n) - it 1 players to 10, 9 times the work. ( https://en.wikipedia.org/wiki/Big_O_notation )

Check it in to Git when you get to a good point, I can take look tomorrow morning.
User avatar
captainsnarf
Posts: 2713
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: UTComp

Post by captainsnarf »

New version! Download here UTCompOmni_1.22.zip

- Fix issue where server setting bEnableEnhancedNet=false did not work
- Fix linkgun not linking vehicles with server setting bEnableEnhancedNet=true
- Change default client setting for bEnableEnhancedNet to be false. Players must opt-in instead of opt-out. (Server setting must be true for client setting to take affect.)
- Remove all code related to Forward mutator
- Remove all code related to warmups


I'm hoping this fixes most of the outstanding issues. There was a lot of missing classes needed to make bEnableEnhancedNet=false work on the server. That's all been fixed. I also made the default client setting for bEnableEnhancedNet=false. Players will need to open F5 menu and click the box if they want enhanced net code. I tested the linkgun changes with EnhancedNet=true and false and it seems to be fixed now. You can heal occupied vehicles which was broken before with EnhancedNet=true.

It's still not compatible with ONSPlus so hoping we can try this new version instead. If it lags the server with EnhancedNet=true then we should be able to turn it off and not break anything.
User avatar
captainsnarf
Posts: 2713
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: UTComp

Post by captainsnarf »

pooty wrote: Sun Sep 04, 2022 11:07 am Good summary.

So I think the for each everytime someone dies and picks up link gun, its expensive with that foreach. I guess we'd have to see if there's a way to cache that variable, or really how many times it iterates.
But reading this: https://wiki.beyondunreal.com/UE2:Actor_(UT2004)
"DynamicActors
native(313) final iterator function DynamicActors (class<Actor> BaseClass, out Actor Actor, optional name MatchTag)

Iterates over all actors with bStatic set to False. Returned actors can be restricted to subclasses of a certain class and to a specific value of the Tag property. Like AllActorsthis iterator goes over the list of actors in the level, but that list is sorted so static actors come first, allowing DynamicActors' to start directly at the first non-static actor. Note that this optimization is only available after map startup is complete, before that DynamicActors works just like AllActors, possibly returning static actors as well."

So for those of you keeping up at home, "Actor" is a class object. So think of it this way. Actor is a generic object. In UT lots of things are "Actors" players, vehicles, map artifacts (meshes) like crates, cranes, rocks, and even things like lights, emitters (eg. flames, and such), powernodes, and EVEN tank projectiles and such, for example Shock Combo is an actor (short lived). So bStatic set to False gets rid of things like map objects/meshes, but damn in a busy map you have players, weapons, projectiles, weaponlockers etc. How fast does UT parse the entire class list down to a base class? The must be doing similar in the engine or else why have that function
I realize it happens once, but if every death means looping through every MutUTComp actor, why? However, its only looking for actors with base class 'MutUTComp' so it might not be that inefficient...how many actors have MutUTComp as base class? We'd have to figure out someway to load test it.

But why not just replace all the weapons in weapon lockers at startup, similar to CSBadgerFix? Pay the price once and be done with it. No need to worry about respawn stuff, when they pickup, they'd get the right link gun and we don't have to change all the maps. There's already several weapon mutators so this should be easy.
The weapon lockers don't have class instances, they have class types. There is nothing to replace. One thing we could do is replace the weapon lockers themselves with utcomp versions. The utcomp weapon locker would hang on to a reference of the utcomp mutator, and when it spawns the weapon it could just assign the reference. That way it doesn't need the forEach DynamicActors() to look it up.
For every pawn/player it makes a copy pawn and a copy collision actor to go along with it. It uses this to do the ping compensation and detect when hits happen. I'm not sure there is a way around that. It's the way it's designed from the core. The copies do minimal work but it's still like there is double the load on the server. If 24 players are playing, the server is doing the work of 48 players. I'm hoping I can tweak some values to reduce that.
This is probably the load, at 32 players, that's 64 worth of tracking and movement. But given at any time say 20 players all firing non-hitscan, you might have 5-10 projectiles each for the server to track, so say 200 items, adding another 20 ghost players, shouldn't crush it too much. However, I'd think the code needs to be really efficient. And need to be careful as it might create an O(n^2) problem (for you non-computer geeks that means adding more creates some power 2 multiplier (each object might need to talk to every other object)... instead of O(n) - it 1 players to 10, 9 times the work. ( https://en.wikipedia.org/wiki/Big_O_notation )

Check it in to Git when you get to a good point, I can take look tomorrow morning.
Another thing it does is set NetPriority=5.0 for the player replication info ('NewNet_PRI'), and NetPriority=50 for the 'timestamp_pawn'.

The actual number doesn't matter, so that '50' isn't really anything to worry about. What happens is each tick, all actors are sorted by NetPriority. If the game runs out of time processing actors during the tick, the actors with lower net priority don't get processed.

The normal priorities in game are:

VoiceChat=3.1
Players/Pawns=3.0
OccupiedVehicles=3.0
VehicleTurrets=3.0 (technically they are vehicles also)
Projectiles=2.5
EmptyVehicles=1.0
Default=1.0
LessDemandingThings=0.1

If you are getting hit by invisible projectiles or rockets appearing out of thin air, this is why. Server is overloaded and can't process all of the voice chat, players/pawns, and vehicles before getting to the projectiles.

What does that mean for UTComp?

Timestamp_Pawn=50
NewNet_PRI=5.0
VoiceChat=3.1
Players/Pawns=3.0
OccupiedVehicles=3.0
Projectiles=2.5
EmptyVehicles=1.0
Everything else=1.0

So those timestamps and NewNet_PRI get priority over everything else. This could result in glitchy players and vehicles in exchange for less noregs since utcomp depends on the timestamp and NewNet_PRI to register hits. It would look like players are jumping around/lagging if they weren't getting net updates consistently.

We could try making timestamp_pawn and newnet_pri=3.0 like the players and see what happens. My guess is it would make the lag seem better, in exchange for players with EnhancedNet=true setting getting more unreg hits. It's a trade-off. Ultimately we just need a server that can handle it.
User avatar
pooty
Posts: 4535
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: UTComp

Post by pooty »

We could try making timestamp_pawn and newnet_pri=3.0 like the players and see what happens. My guess is it would make the lag seem better, in exchange for players with EnhancedNet=true setting getting more unreg hits. It's a trade-off. Ultimately we just need a server that can handle it.
I see what they did there, they just bumped the priority of all the hit calculations (basically) and changed how they are computed = NewNetCode.

I'm still not convinced its entirely a hardware problem. Even with double player actors, and they aren't full players correct?, it should not swamp the server.
Image

From a server CPU consumption, we moved to the faster server, 8/21/2022, eg, Week 34 was the newer server/UTComp On, Week 35 was UTComp off.
Now its possible that much of the CPU spikes and such were due to the bugs in UTComp, and perhaps that was causing some issues.

We can test it out, the updated version is on the server and enabled.

I did find I really liked the ONSPlus vehicle names on the dots, its pretty useful for finding out from the map if certain vehicles have spawned, so love to get that moved over.

Also, I noticed last night that I was still getting points for linking locked nodes, and wasn't sure I was getting damage points, though some seemed to think so, I wonder how it calculates the damage points -- based on below you'd only get them with really big weapons (nuke, mino blast, dragon bomb) unless it counts over time..

Code: Select all

[ONSPlusOmni ONSPlusConfig_Mut]
PowerCoreScore=10
PowerNodeScore=6
NodeHealBonusPct=85
bNodeHealBonusForLockedNodes=False
bNodeHealBonusForConstructor=False
bDropChecks=True
bSelectableExits=True
bNodeHealScoreFix=True
bVehicleHealScore=True
HealValueScore=250.000000
bVehicleHealScoreFix=True
bVehicleDamageScore=True
DamageValueScore=400.000000
bPallyShieldScore=True
PallyValueScore=600.000000
bNodeIsolateBonus=True
IsolateBonusPctPerNode=20

Here's what's set for UTComp

Code: Select all

[UTCompOmni.MutUTComp]
bEnableVoting=False
bEnableBrightskinsVoting=True
bEnableHitsoundsVoting=True
bEnableWarmupVoting=False
bEnableTeamOverlayVoting=False
bEnableTeamOverlay=False
bEnablePowerupsOverlayVoting=False
bEnableMapVoting=False
bEnableGametypeVoting=False
bEnableTimedOvertimeVoting=False
VotingPercentRequired=51.000000
VotingTimeLimit=30.000000
benableDoubleDamage=True
EnableBrightSkinsMode=3
bEnableClanSkins=False
bEnableTeamOverlay=False
bEnablePowerupsOverlay=False
EnableHitSoundsMode=2
bEnableScoreboard=False
bEnableWarmup=False
WarmupReadyPercentRequired=100.000000
bShowSpawnsDuringWarmup=False
bEnableWeaponStats=True
bEnablePowerupStats=True
bShowTeamScoresInServerBrowser=False
ServerMaxPlayers=32
bEnableAdvancedVotingOptions=False
bEnableAutoDemoRec=False
AutoDemoRecMask=%d-(%t)-%m-%p
EnableWarmupWeaponsMode=1
WarmUpTime=0
WarmupHealth=199
bForceMapVoteMatchPrefix=True
bEnableTimedOvertime=False
TimedOverTimeLength=300
NumGrenadesOnSpawn=4
bForward=False
bEnableForwardVoting=False
bShieldFix=True
bAllowRestartVoteEvenIfMapVotingIsTurnedOff=False
MaxMultiDodges=0
MinNetSpeed=9300
MaxNetSpeed=15000
CapBonus=5
FlagKillBonus=3
CoverBonus=4
SealBonus=4
GrabBonus=0
MinimalCapBonus=5
BaseReturnBonus=0.500000
MidReturnBonus=2.000000
EnemyBaseReturnBonus=5.000000
CloseSaveReturnBonus=10.000000
CoverMsgType=3
CoverSpreeMsgType=3
SealMsgType=3
SavedMsgType=3
bShowSealRewardConsoleMsg=True
bShowAssistConsoleMsg=True
SuicideInterval=3
bEnableEnhancedNetCode=True
bEnableEnhancedNetCodeVoting=False
MinNetUpdateRate=60.000000
MaxNetUpdateRate=200.000000
NodeIsolateBonusPct=20
VehicleHealScore=250
PowerCoreScore=10
PowerNodeScore=6
NodeHealBonusPct=85
bNodeHealBonusForLockedNodes=False
bNodeHealBonusForConstructor=False
NewNetUpdateFrequency=100
AlwaysUseThisMutator=UTCompOmni.MutUTComp
VotingGametype=(GametypeOptions="?game=XGame.xDeathMatch?timelimit=15?minplayers=0?goalscore=0?Mutator=XWeapons.MutNoSuperWeapon,XGame.MutNoAdrenaline?weaponstay=false?DoubleDamage=false?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="1v1")
VotingGametype=(GametypeOptions="?game=XGame.xDeathMatch?timelimit=15?minplayers=0?goalscore=50?weaponstay=True?DoubleDamage=True?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="FFA")
VotingGametype=(GametypeOptions="?game=XGame.xTeamGame?timelimit=20?goalscore=0?minplayers=0?Mutator=XWeapons.MutNoSuperWeapon?FriendlyfireScale=1.00?weaponstay=False?DoubleDamage=True?GrenadesOnSpawn=1?TimedOverTimeLength=5",GametypeName="Team Deathmatch")
VotingGametype=(GametypeOptions="?game=XGame.xCTFGame?timelimit=20?goalscore=0?minplayers=0?mutator=XGame.MutNoAdrenaline,XWeapons.MutNoSuperWeapon?friendlyfirescale=0?weaponstay=true?DoubleDamage=True?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="Capture the Flag")
VotingGametype=(GametypeOptions="?game=Onslaught.ONSOnslaughtGame?timelimit=20?goalscore=1?mutator=XWeapons.MutNoSuperWeapon?minplayers=0?friendlyfirescale=0?weaponstay=True?DoubleDamage=True?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="Onslaught")
VotingGametype=(GametypeOptions="?game=UTCompOmni.UTComp_ClanArena?goalscore=7?TimeLimit=2?FriendlyFireScale=0?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="Clan Arena")
VotingGametype=(GametypeOptions="?game=UT2k4Assault.ASGameInfo?timelimit=20?goalscore=1?FriendlyFireScale=0,WeaponStay=True?mutator=XWeapons.MutNoSuperWeapon?DoubleDamage=True?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="Assault")
VotingGametype=(GametypeOptions="?game=XGame.xDoubleDom?timelimit=20?goalscore=0?FriendlyFireScale=0,WeaponStay=true?mutator=XWeapons.MutNoSuperWeapon?DoubleDamage=true?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="Double Domination")
VotingGametype=(GametypeOptions="?game=XGame.xBombingRun?timelimit=20?goalscore=0?FriendlyFireScale=0,WeaponStay=True?mutator=XWeapons.MutNoSuperWeapon?DoubleDamage=True?GrenadesOnSpawn=4?TimedOverTimeLength=0",GametypeName="Bombing Run")
IgnoredHitSounds=FireKill
IgnoredHitSounds=Burned
Let me know what can be removed, and if anything needs changed/added.
Does the UTComp version support Damage/Shield points or are those to do?
User avatar
McLovin
Posts: 1194
Joined: Sat Apr 03, 2021 12:54 pm
Location: Salt Lake City, Utah
Server Sponsor: Yes
Server Admin: Yes

Re: UTComp

Post by McLovin »

pooty wrote: Mon Sep 05, 2022 10:04 am ...
Let me know what can be removed, and if anything needs changed/added.
...
Not a fan of the big-heads. They are grotesque looking and distracting in my opinion.
User avatar
captainsnarf
Posts: 2713
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: UTComp

Post by captainsnarf »

These can be removed. There is no variable behind them now.

Code: Select all

EnableWarmupWeaponsMode=1
WarmUpTime=0
WarmupHealth=199
bForward=False
bEnableForwardVoting=False

There is no damage points or shield points implemented. I can add the damage points to UTComp but the shield points will need to be added to each vehicle.

The vehicle names on dots... uhg, ok lol. To get the dots working I had to re-implement the OnslaughtHud class. To get the vehicle names will require re-implementing a lot of the menus and them patch them into the game like ONSPlus does.
McLovin wrote: Mon Sep 05, 2022 12:36 pm
pooty wrote: Mon Sep 05, 2022 10:04 am ...
Let me know what can be removed, and if anything needs changed/added.
...
Not a fan of the big-heads. They are grotesque looking and distracting in my opinion.
That's not utcomp. That's from the motorbikes.
User avatar
captainsnarf
Posts: 2713
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: UTComp

Post by captainsnarf »

I found this script profiler. It seems to work OK. Hopefully we can get to the bottom of any performance issues.
User avatar
pooty
Posts: 4535
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: UTComp

Post by pooty »

Not a fan of the big-heads. They are grotesque looking and distracting in my opinion.
That's not utcomp. That's from the motorbikes.
No that's the big head mutator, its not specfic to the bikes. I could put it on any map. Really, Really tempting to add it to Mega Badger Arena and MinusBadgerMeUp now..

I think we want to add damage points, but lets make sure we get UTComp working right before we spend any time porting anything else over.
User avatar
captainsnarf
Posts: 2713
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: UTComp

Post by captainsnarf »

Sweet, already found some problems using the profiler. It looks all of the enhanced net versions of projectiles have some big performance issues that should be fixable.

*edit* scratch that. seems that those performance issues I found are only client side.
Post Reply