UTPure breaks up the HUD and HUDMutator-list

Discussions about Coding and Scripting
Post Reply
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

UTPure breaks up the HUD and HUDMutator-list

Post by Bloeb »

I've created a modification for BT-mappers. It includes an enhanced HUD and enhanced messages (implemented using a HUDMutator). Eventhough most BT-servers don't use UTPure anymore I still think it's important to support UTPure. There's a big problem with UTPure though. It changes the Players HUD and fucks up the HUDMutator-list. The PostRender-function still works for my HUDMutator, but I can't access the HUDMutator from another script.

Code: Select all

for (HM = P.myHUD.HUDMutator; HM != None; HM = HM.NextHUDMutator)
{
   ... do stuff with HUDMutators
}
I was thinking UTPure just fucks up the HUDMutator-list, but apparantly it does more. The following loop doesn't work either.

Code: Select all

foreach P.ChildActors(class'MyHUDMutator',HM)
{
  ... do stuff with my HUDMutator
}
This works fine if I don't use UTPure. I hope someone can enlighten me about this issue and perhaps knows a good workaround.
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

Re: UTPure breaks up the HUD and HUDMutator-list

Post by Bloeb »

kick

This issue is still bugging me. I found out one of my favourite servers is still using UTPure. So I really like to get this to work. Anyone got an idea?
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: UTPure breaks up the HUD and HUDMutator-list

Post by JackGriffin »

I used to have the source for Pure here somewhere, let me see if I can find it. I have never had to make a mod work with it, but I know it can be incredibly frustrating especially if you have custom HUD.

I'm one of those guys who loved Pure too. Shame it wasn't kept up, once Ace hit it sucked the life from all anticheat development.
So long, and thanks for all the fish
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

Re: UTPure breaks up the HUD and HUDMutator-list

Post by Bloeb »

Hehe, I don't like UTPure at all, but compatibility is pretty important in my opinion. My mod is loaded from the map and it's painful for mappers when their maps can't be played on certain servers due to this issue. Getting the source would help me a lot. :agree1:
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: UTPure breaks up the HUD and HUDMutator-list

Post by anth »

What kind of "stuff" are you trying to do with your HUDMutator? Can't you just store a reference to the HUDMutator somewhere rather than trying to find it in your other Actor (I assume that you are trying to find it while executing your other Actor's Tick function, that would indeed hide the HUDMutator from the other Actor). It can indeed be frustrating to make Rendering related mods work with Pure, especially if you don't do it right from the first time. If you're used to working with Pure however, keeping your code compatible with it is trivial. The idea is that you cannot execute rendering or input related code on the client side _unless_ it is authorized by the server. For example: you cannot spawn a hudmutator using a modmenu mod but you _can_ spawn a hudmutator on the server and register it using a replicated function.
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

Re: UTPure breaks up the HUD and HUDMutator-list

Post by Bloeb »

anth wrote:What kind of "stuff" are you trying to do with your HUDMutator? Can't you just store a reference to the HUDMutator somewhere rather than trying to find it in your other Actor (I assume that you are trying to find it while executing your other Actor's Tick function, that would indeed hide the HUDMutator from the other Actor).
I've implemented a system to configure enhanced messages. To do this I've subclassed CriticalEventPlus. LocalMessages normally send information to the HUD, but I want to send the information to the HUDMutator instead. It's a bit hacky, but I can't think of any better ways.

Code: Select all

class BTME_LocalMessage extends CriticalEventPlus;

static function ClientReceive(PlayerPawn P, 
	optional int Switch,
	optional PlayerReplicationInfo RelatedPRI_1,
	optional PlayerReplicationInfo RelatedPRI_2,
	optional Object OptionalObject)
{
    local Mutator HM;

    /* Send BTME_LocalMessages to the BTME_HUDMutator instead of the HUD */
    if ( P.myHUD != None )
    {
        for (HM = P.myHUD.HUDMutator; HM != None; HM = HM.NextHUDMutator)
        {
            if(HM.IsA('BTME_HUDMutator'))
            {
                BTME_HUDMutator(HM).LocalizedMessage( Default.Class, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
                break;
            }
        }
    }

    // other stuff
}
And I'm also forcing the HUDMutator order, because another mod is bugged (doesn't call the next PostRender-function).

Code: Select all

class BTME_HUDMutator extends Mutator;

simulated function PostBeginPlay()
{
    Super.PostBeginPlay();

    SetTimer(1.0,true);
}
simulated function Timer()
{
    // other stuff

    ForceMutatorOrder();

    Super.Timer();
}

simulated function ForceMutatorOrder()
{
    local Mutator HM, PrevHM;

    if (MyHUD==None || MyHUD.HUDMutator==self) return;

    for(HM=MyHUD.HUDMutator; HM!=None && HM!=self; HM=HM.NextHUDMutator) PrevHM=HM;

    if(HM==self) PrevHM.NextHUDMutator = NextHUDMutator;

    self.NextHUDMutator = MyHUD.HUDMutator;
    MyHUD.HUDMutator = self;

    SetTimer(0.0,false);
}
anth wrote:It can indeed be frustrating to make Rendering related mods work with Pure, especially if you don't do it right from the first time. If you're used to working with Pure however, keeping your code compatible with it is trivial. The idea is that you cannot execute rendering or input related code on the client side _unless_ it is authorized by the server. For example: you cannot spawn a hudmutator using a modmenu mod but you _can_ spawn a hudmutator on the server and register it using a replicated function.
It's just silly that UTPure changes the HUD and even cripples the HUDMutator-list. So keeping things compatible is never actually trivial in my opinion. I'm registering the HUDMutator using a SpawnNotifyer. This works and the PostRender-function is also executed on the client as expected.

My modification, instructions and a demo-map can be found here: BunnyTrack Mapping Enhancements
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

Re: UTPure breaks up the HUD and HUDMutator-list

Post by Bloeb »

bump, any clues?

I can code a workaround for UTPure by sending a different localmessage-class, but I still like to get this fixed properly.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: UTPure breaks up the HUD and HUDMutator-list

Post by JackGriffin »

I'm curious why people still code to Pure. It's bypassed publicly and there are multiple BT macros available that Pure can't see anyway. What is the advantage to making it work (this is an honest question B)? Seems like a waste of time and effort for no real gain.
So long, and thanks for all the fish
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

Re: UTPure breaks up the HUD and HUDMutator-list

Post by Bloeb »

In my opinion the BT-scene has a history of using poor server-configurations. Many admins use mods that where never meant to be used for BT (e.g. ZeroPing, UTPure, some useless instagib-mods and useless BT-mods). Unfortunately some server-admins still use UTPure. Trying to persuade BT-server-admins to not use those mods is pretty hard as many of them are very stubborn.

BT-mappers can use my BTME-mod to enhance their maps. Mappers (including myself) are less likely to use it if the scripts don't work on certain servers. Therefore I like to add support for UTPure.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: UTPure breaks up the HUD and HUDMutator-list

Post by JackGriffin »

As far as I've ever known Anth's explanation is the only way to get around the HUD issue. I looked at this briefly a couple of years ago to make a Pure-compatible monsterhunt controller. I was working at House of Fools and we had a player cheating in the MH servers. Somehow she was able to triple/quadruple her scoring map after map and I wanted to know how.
I understand the concept of how it needs to work but like you the results just seemed all hacky so I never used it. We just ended up banning that girl. I'd still love to know how she was doing it though. How can a player dictate scoring to a server? At least it never made it out publicly.
So long, and thanks for all the fish
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

Re: UTPure breaks up the HUD and HUDMutator-list

Post by Bloeb »

I've made some progress on this front. I always assumed this problem was caused by UTPure, but that's not entirely true. It's due to the combination of NexGen and UTPure. When the server tries loading both mods I get a console-message from NexGen: "The server has crashed and has been reloaded". My HUDMutator is still present for a while, but after a while (when a significant amount of actors have been spawned) the HUDMutator dissappears and is not accesible anymore. Somehow it's removed from the Players HUDMutator-list.

I found a solution, but it's not working completely yet. I used to spawn the HUDMutator using a SpawnNotifyer. This will load the HUDMutator before NexGen crashes. The solution is to spawn the HUDMutator later. Unfortunately I haven't been able to do this correctly. Somehow I end up with multiple instances of HUDMutator for every player.

I would like to know how NexGen interacts with UTPure.
Post Reply