Page 1 of 3

Need help with my HUD

Posted: Mon Jul 10, 2006 3:20 pm
by MakerOfGames
I am not comming back yet, I just need help implimenting my own hud. I have all the graphics ready, and the alphas to go with them, but I cant get them to display. I am using 072 to test the hud because of the ready to use guns and ammo(you'll see why I wanted this later) I swapped the zoom bitmap and alpha and the small hud peice takes up the whole screen. I need someone to explain how to get the hud to display my own bitmaps and custom elements. I searched the docs and found nothing except how to impliment the ones given in RF.

Also, just to make it known, I am not using my own 3D content in RF yet. I am only testing the HUD. The content will come later.

Posted: Mon Jul 10, 2006 5:10 pm
by MakerOfGames
Ok, I switched to 075 and using the picture display HUD option I can display the HUD elements, but they are in the upper left hand corner. How can I tell it where to place the picture on screen?

Posted: Mon Jul 10, 2006 5:29 pm
by AndyCR
i believe you use negative numbers to start them in the lower right corner. ie your window is 800 x 600, you put the hud element at -20 -20, it puts it at 780 580.

Posted: Mon Jul 10, 2006 6:24 pm
by MakerOfGames
Ok, that will help. However, I followed Muzzers old health bar tut and it wont display. Also, I gave the [picture0] and [picture1] the attributes bitmapx = 20 and bitmapy = 20 and nothing happed. The pictures stayed in the upper left hand corner. Im cunfused. Shouldnt that have worked? I guess I'll keep trial and error as my way to get this working, but its kinda frustrating...

EDIT: BTW, I am using the 075 basic level. The nice empty box.

Posted: Mon Jul 10, 2006 6:27 pm
by LtForce
This may sound stupid, but what HUD means?

Posted: Mon Jul 10, 2006 7:10 pm
by paradoxnj
Heads Up Display

Posted: Mon Jul 10, 2006 8:00 pm
by hike1
http://terrymorgan.net/asylum.rar

I don't think I locked up the HUD bitmaps

Also search http://terrymorgan.net/download.htm for 'hud'

;
; HUD.INI - Heads-Up Display Configuration File
;
; Lines that start with a SEMICOLON are comments, blank lines are ignored
; compassfrm2.bmp is 60 wide and 48 tall -needs trimming..make sure you put all hudstuff in \bitmaps
; either in the actual directory or in the pack.vfs!

;frame and frame alpha is the NAME of the attribute, like mana, health
;indicator is the bar, horizontal, vertical, or the NUMBER
[compass]
frame = compassfrm2.bmp
framealpha = compassfrm2alpha.bmp
indicator = compass2.bmp
indicatoralpha = a_compass.bmp
framex = 0
framey = -80
indicatoroffsetx = 13
indicatoroffsety = 7

;all bitmaps are the same size as stamina's
[mana]
type = verticle
frame = manahud.bmp
framealpha = manaalpha.bmp
indicator = boltsbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 320
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

;stamina.bmp is 32x32, bar.bmp is 16 across 64 high
[stamina]
type = verticle
frame = stamina.bmp
framealpha = staminaalpha.bmp
indicator = staminabar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 262
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

; health as a verticle bar
;[health]
;type = verticle
;frame = healthhud.bmp
;framealpha = healthalpha.bmp
;indicator = boltsbar.bmp
;indicatoralpha = staminabaralpha.bmp
;framex = 378
;framey = -40
;indicatoroffsetx = 34
;indicatoroffsety = -22
;indicatorheight = 64

;health as a number, same location as bar
[health]
type = numeric
frame = healthhud.bmp
framealpha = healthalpha.bmp
;indicator = goldbar.bmp
;indicatoralpha = staminabaralpha.bmp
framex = 378
framey = -40
indicatoroffsetx = 34
;indicatoroffsety = -22
;indicatorheight = 64
font=9
width=3



;note hud elements are separated by 58 on the x axis
[bolts]
type = verticle
frame = boltshud.bmp
framealpha = boltsalpha.bmp
indicator = boltsbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 436
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

;the numeric display is just above the bar graph by 20 pixels, probably should be below, bar could go up past number
;the tilde ~ means the bolts are going to be numeric
[~bolts]
type = numeric
;frame = bolts.bmp
;framealpha = boltsalpha.bmp
;indicator = boltsbar.bmp
;indicatoralpha = staminabaralpha.bmp
;framex = 431
;framey = -40
indicatoroffsetx = 34
indicatoroffsety = -62
indicatorheight = 64
font=10
width=3

[bullet]
type = verticle
frame = bulletshud.bmp
framealpha = bulletshudalpha.bmp
indicator = boltsbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 494
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

[oxygen]
type = verticle
frame = oxygenhud.bmp
framealpha = oxygenhudalpha.bmp
indicator = boltsbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 554
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

[arrows]
type = verticle
frame = arrowshud.bmp
framealpha = arrowsalpha.bmp
indicator = arrowsbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 204
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

[armor]
type = verticle
frame = armorhud.bmp
framealpha = armoralpha.bmp
indicator = armorbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 146
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

[gold]
type = numeric
frame = goldhud.bmp
framealpha = goldalpha.bmp
;indicator = goldbar.bmp
;indicatoralpha = staminabaralpha.bmp
framex = 96
framey = -40
indicatoroffsetx = 34
;indicatoroffsety = -22
;indicatorheight = 64
font=9
width=3


[countdown]
type = numeric
frame = timerhud.bmp
framealpha = timerhudalpha.bmp
indicator = boltsbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 610
framey = -40
indicatoroffsetx = 34
indicatoroffsety = 8
font=16
width=3
active=modify
modifydirection=both
displaytime=1

; entry in hud.ini
;note the 64x48 onscreen hud
; elements go in /bitmaps, the 128x96
; inventory bmaps go in /bitmaps/inventory
;yes they have the same name.

[Officekey]
type = verticle
frame = keyoffice.bmp
framealpha = a_keyoffice.bmp
framex = -64
framey = 170
active = false

[Liftbelt]
type = verticle
frame = liftbelts.bmp
framealpha = liftbeltalphas.bmp
framex = -128
framey = 220
active = false

[healthpotion]
type = verticle
frame = healthinvs.bmp
framealpha = healthinvsalpha.bmp
framex = -64
framey = 170
active = false

[manapotion]
type = verticle
frame = manainvs.bmp
framealpha = manainvsalpha.bmp
framex = -64
framey = 170
active = false

[lockpick]
type = verticle
frame = lockpick1648.bmp
framealpha = lockpick1648alpha.bmp
framex = -64
framey = 170
active = false

[grenade]
type = verticle
frame = grenadehud.bmp
framealpha = grenadehudalpha.bmp
indicator = boltsbar.bmp
indicatoralpha = staminabaralpha.bmp
framex = 614
framey = -40
indicatoroffsetx = 34
indicatoroffsety = -22
indicatorheight = 64

Posted: Mon Jul 10, 2006 8:30 pm
by MakerOfGames
Thanks Hike1 :D . That hopefully will make everything better.

Posted: Mon Jul 10, 2006 9:06 pm
by MakerOfGames
Odd...the frame will now move but I cant seem to see my indicator. do I need to define indicatorheight = 40 (the height that its supposed to be.)

EDIT:my Hud code

Code: Select all

[Health]
type = verticle
frame = hud\white_frame_center.bmp
framealpha = hud\a_white_frame_center.bmp
indicator = hud\center_black.bmp
indicatoralpha = hud\a_center_black2.bmp
framex = 169
framey = -55
indicatoroffsetx = 0
indicatoroffsety = 0
indicatorheight = 40

Posted: Tue Jul 11, 2006 8:14 am
by Juutis
Yes, you need to define indicatorheight.
I can only think of two reasons why the indicator won't show.

1) It's transparent. I think you're smart enough not to create a totally black alphamap, though...
2) Your attribute, in this case "Health", is at the lowest possible value (defined in player.ini).

Posted: Tue Jul 11, 2006 8:29 am
by steven8
One other possible reason, albeit an outside one, is the fact that you have an offset of zero for both the indicator x and y. This offset is taken from the edge of the frame, so unless the indicator is exactly the same size as the frame, then it may be hidden under the edge of the frame.

Posted: Tue Jul 11, 2006 1:59 pm
by MakerOfGames

Code: Select all

[health]
initial = 100
low = 0
high = 100
That is found in the player.ini

The Alpha is not fully black its acctually a nice light grey. (RGB value of: 192,192,192) and shows up if I do two picture bitmaps.

And here is the HUD file again because I think I changed some things.

Code: Select all

[health]
type = verticle
frame = hud\white_frame_center.bmp
framealpha = hud\a_white_frame_center.bmp
indicator = hud\center_black.bmp
indicatoralpha = hud\a_center_black2.bmp
framex = 169
framey = -55
indicatoroffsetx = 0
indicatoroffsety = 0
indicatorheight = 40
indicatorwidth = 300
active = true
Let me post the graphics I am using. If someone could put them in a folder labeled HUD in 075 bitmaps and copy the above HUD.ini info and try it, it would be very much appriciated.

EDIT: The width of the indicator is 300pixels, the frame is 311pixels(yeah I know its a weird number). However if you look at my aplha map of the frame, youll see that the frame is only a transparent white line to go around the health indicator. Also, I want to note that yes the health bar is wider than tall. This is for a reason, and that is to display important messages to the player. Get near a weapon tells you what keys to press to pick up the weapon etc...

EDIT EDIT: In case it matters, I am using the basic level in 075, the box. I know I said it earlier in the post but I said it again just so you dont have to search for it :wink:.

Posted: Tue Jul 11, 2006 2:21 pm
by Juutis
Ah, of course. The power of two... The size of every single bitmap in RF, be it texture, a hud element or whatever else, needs to be a power of two (16x16, 32x32, 64x64 etc). I'm not sure about this but I think they don't have to be squares, so ie 64x128 will work too.

Posted: Tue Jul 11, 2006 3:07 pm
by MakerOfGames
Hmm... That makes sense about the power of two, so does that mean divisable by two? or an exponant of two? Because the 311x50 pixel frame does display... Its the 300x40 center that wont. So it has to be an exponant of two? Like 256 would work? So it would be a glitch that has the frame displaying?

Posted: Tue Jul 11, 2006 3:08 pm
by steven8
They don't have to be a power of 2, as you actually tell the engine what size to draw the image on the screen. You, however, have to cut out the center of the alpha frame to allow the indicator to show. I got it to show by doing that.