UE2 - UT2kX Drawing on client Hud

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

JohnK

New Member
Oct 29, 2004
28
0
0
I've been banging my head on the wall all day trying to access the client side hud of a spectator from the server. Obviously I am failing to understand replication somewhere, but can someone tell me a quick way to do this. I just want to display a texture on all hud's in a net game.

Thx!
 

meowcat

take a chance
Jun 7, 2001
803
3
18
I think your best bet would be to use a HUDOverlay. You can use either a mutator or some other "thing" to spawn and add it to the client's HUD once it is first replicated to the client. Then if you want to display shared information you could spawn and use a specialized subclass of ReplicationInfo and keep a reference to it in the HUDOverlay.

Some examples for adding this via mutator can be found here (just spawn your custom HUDoverlay rather than an interaction).
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
First question should be: Is this a new game type or just a smaller modification, e.g. a mutator?

For a new game type your obviously replace the HUD, for a mutator you need to do the replication stuff yourself. The most simple approach is to set your mutator class as bAlwaysRelevant=True and RemoteRole=ROLE_SimulatedProxy in its defaultproperties and simply register a HUDOverlay everywhere for Level.NetMode!=NM_DedicatedServer. (There's no local player there.)
 

JohnK

New Member
Oct 29, 2004
28
0
0
Thanks both (the great and the good of uscript, i'm honored).

It's a mod based on Cave ut, and I've already added a new hud class. For some reason though I can't get changes to replicate. I have one listen server and a single client, which runs in spectator mode and receives location and rotation from the server, replicated via a replicationinfo subclass.

I have an exec function in the controller which I use on the server to toggle the hud, actually all it's doing is blanking the screen by drawing a black texture. I've tried all sorts of tricks to try and replicate a flag to the client hud, testing it exactly as rotation and location, but no dice. I know it's down to me not getting replication properly, but i'm lost. The only other thought I have is that spectators do something odd with the hud.

One way I thought of trying today is to spawn a simple object for each pawn to hold a flag, make sure it's replicated, alwaysrelevant etc and get each pawn to iterate those objects each frame. I think this would work but it's obviously stupid!





...but it did work. I guess i'm probably just repeating what replicationinfo does but much more simply and not properly optimized.
 
Last edited: