UE3 - UDK Online HUD in May UDK

  • 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.

Qrion

New Member
May 31, 2010
6
0
0
[SOLVED] Online Classic HUD in May UDK

Hey,

We managed to get our old HUD working using the bUseClassicHUD.
However when we setup a server and start testing the multiplayer the HUD is completly gone, no old HUD and not the new one either.

If we test a clean default install of the May Beta, and only enable the UDK old HUD there, it gives the same problem playing online. It does show Unreals own classic HUD offline but when testing multiplayer its completly gone aswell.

This makes us believe that it is a bug in May UDK own code, anyone have the same problem and/or know a solution?

Classified.
http://www.youtube.com/group/classifiedgame
 
Last edited:

Qrion

New Member
May 31, 2010
6
0
0
Its far from clean code atm, just made it work and left it at that.
Ill just post the stuff you need to change without any chronological explanation.

Here is the howto:

1) In your Gametype class (MyModGame.uc) add the "bUseClassicHUD" to defaultproperties next to defining your HUD class:
Code:
bUseClassicHUD=true
HUDType=class'MyModGame.MyModHud'


2) Make a new class: "GFxMyModHud.uc"
Code:
class GFxMyModHud extends GFxMinimapHud ;

defaultproperties
{
	bDisplayWithHudOff=true 
	MovieInfo=none   //disables Epics new Scaleform HUD
}


3) Go to your HUD class (MyModHud.uc) and add the following to defaultproperties:
Code:
bEnableActorOverlays=true            
MinimapHUDClass=class'GFxMyModHud'


4) In your HUD class (MyModHud.uc) add the following variables:
Code:
var class<GFxMinimapHUD> MinimapHUDClass;
var bool	bEnableActorOverlays;
var GFxMinimapHud   HudMovie;


5) In your HUD class (MyModHud.uc) add the following functions:
Code:
simulated function PostBeginPlay()
{
	super.PostBeginPlay();

	HudMovie = new MinimapHUDClass;
	HudMovie.PlayerOwner = UTPlayerOwner;
	HudMovie.SetTimingMode(TM_Real);
	HudMovie.Init(HudMovie.PlayerOwner);
	HudMovie.ToggleCrosshair(true);
}


function SetVisible(bool bNewVisible)
{
	HudMovie.ToggleCrosshair(bNewVisible);
	HudMovie.Minimap.SetVisible(bNewVisible);
	bEnableActorOverlays = bNewVisible;
}


event PostRender()
{
    RenderDelta = WorldInfo.TimeSeconds - LastHUDRenderTime;

	ResolutionScaleX = Canvas.ClipX/1024;
	ResolutionScale = Canvas.ClipY/768;
	if ( bIsSplitScreen )
		ResolutionScale *= 2.0;

	UTGRI = UTGameReplicationInfo(WorldInfo.GRI);

	if (HudMovie != none)
		HudMovie.TickHud(0);

	if ( bShowHud && bEnableActorOverlays )
	{
	        DrawHud();
		DrawGameHud();  //ADD YOUR OWN HUD DRAW FUNCTION NAME HERE!!!
	}
        super.PostRender();
	LastHUDRenderTime = WorldInfo.TimeSeconds;
}


event DrawHUD()
{
	local vector ViewPoint;
	local rotator ViewRotation;

	if (UTGRI != None && !UTGRI.bMatchIsOver  )
	{
		Canvas.Font = GetFontSizeIndex(0);
		PlayerOwner.GetPlayerViewPoint(ViewPoint, ViewRotation);
		DrawActorOverlays(Viewpoint, ViewRotation);
	}

	if ( HudMovie.bDrawWeaponCrosshairs )
	{
		PlayerOwner.DrawHud(self);
	}
}


6) Note that in step 5 in the PostRender event a function called "DrawGameHud()" is called, this in the function that draws our HUD in our game. Change this to the function that draws your HUD in your game.


Thats it, its far from clean and sometimes a bit laggy still but for now it works for us.
 
Last edited:

Qrion

New Member
May 31, 2010
6
0
0
Note that we only use Health and Crosshair at the moment with this code. I am not sure if armor, ammo and inventory etc. works with this. It might if it was already called in your old HUD.

If not then take a look at the "UTGFxHudWrapper" and "GFxMinimapHud" classes. I took most of the code from those 2 but deleted the armor, ammo and inventory stuff that we don't use.
 

Alex_KF

New Member
May 30, 2005
34
0
0
Dundee, Scotland
Thanks for the explanation, but I'm having trouble following.

It looks like you're just splicing a dummy Gfx class / vars into a non Gfx HUD.

I don't doubt that it works, but I have to question why it should. What's going on behind the scenes here that only loads a HUD class online if it contains a GfxHUD variable?
 

Qrion

New Member
May 31, 2010
6
0
0
Have to admit im not really sure myself, all I know that either replication or assigning of a Owner to the classic HUD funtions and variables goes wrong on clients while it runs fine on the server.

Maybe they broke/forgot to link some (reliable) client funtions when they put the new "bUseClassicHud" boolean in between.

But seeing we already have a Scaleform HUD on the way I didn't bother researching deep and in stead just forced it in over the functions and vars of the Gfx classes that do get full functionality even on clients.