Author Topic: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time  (Read 42416 times)

0 Members and 1 Guest are viewing this topic.

Offline LordMelvin

  • emacs ftw
  • 28
  • VI OR DEATH! DOWN WITH EMACS!
Re: Adaptable HUD, a.k.a. No more HUD stretching, for real this time (with patch!)
This is relevant to my interests, and I am posting here to remind myself to apply this patch when I get my screens up and running how I intend, assuming it's not already in trunk by then.
Error: ls.rnd.sig.txt not found

 

Offline Yarn

  • 210
Re: Adaptable HUD, a.k.a. No more HUD stretching, for real this time (with patch!)
Just wondering, have any SCP members considered this patch yet?
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Not sure but I modified the OP title to indicate this is submitted for Code Review and not just a discussion about implementation ideas.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline niffiwan

  • 211
  • Eluder Class
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Finally, a bit of code review for this (only 7+ months since the original post :nervous:)

Overall, it looks good.  My only comment is, the exact code below is duplicated for all except two of the gauges; load_gauge_custom & load_gauge_fixed_messages (and I'm not sure why this part of load_gauge_custom is different anyway).  It would probably be easier to maintain in future if this could be put into a function?  Maybe something like this:

void hud_gauge_parse_position( int * coords, float *origin, int *offset, int *base_res, const int base_w, const int base_h, bool handle_default_position = false);
(returns coords)

Code: [Select]
if(check_base_res(base_w, base_h)) {
base_res[0] = base_w;
base_res[1] = base_h;

if(optional_string("Position:")) {
stuff_int_list(coords, 2);
} else {
adjust_base_res(base_res);

if(optional_string("Origin:")) {
stuff_float_list(origin, 2);
}

if(optional_string("Offset:")) {
stuff_int_list(offset, 2);
}

coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
}
} else {
adjust_base_res(base_res);

coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
}

What are your thought on that idea?
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline m!m

  • 211
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
I did that some time ago for my TrueType patch but it can be easily changed so it works with the current trunk: https://github.com/asarium/fs2open.github.com/blob/trueType/code/hud/hudparse.cpp#L1058
The new function bundles most of the functionality of hud gauge parsing and not only coordinate handling.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
That looks good m!m, I'll have a more detailed look over the weekend :)
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline MachManX

  • 26
  • The Fight Never Ends...This Is A Fact Of Life!
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
So I made my first builds for BP based on Yarn's patch file and BP patch file.  The trunk version is 10143 (11-21-13 afternoon).  This download does not contain AVX versions as I don't have an AVX processor and didn't want to risk issues.  I haven't tested these so feedback would be appreciated.  Link: http://www14.zippyshare.com/v/37886302/file.html
AMD Ryzen 5 3600
B450I GAMING PLUS AC
Geforce GTX 1060 6GB
16GB DDR4-3600
WD SN750 1TB NVME
Samsung 850 EVO 250GB SSD
Corsair HX520W PSU
Cougar QBX Case
NEC V422 42" @ 1080p
Ubuntu 20.04 + Whatever I VM

 
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
BTW is there any negative consequences in using BP build for all the other mods? Any compatibility errors?

If there is, I would kindly ask for a new Yarn build (BP NOT included) :) I looked at the Master Sticky thread, and I wasn't really liking the idea of installing new stuff just to apply a patch for new nightly builds once or twice. Or is the Yarn's HUD patch gonna be included in the new official version of SCP?

 

Offline MachManX

  • 26
  • The Fight Never Ends...This Is A Fact Of Life!
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Ok, so this is Revision 10147 of the normal builds dated today or tomorrow early morning while it's still dark outside :)  It looks like my compiler lets me do AVX builds after all, but I can't test them.  In fact, I haven't tested any of these.  So leave some feedback so that I know I'm doing it correctly.  This has Yarn's patch in it.  Here's the link: http://www56.zippyshare.com/v/44169379/file.html
AMD Ryzen 5 3600
B450I GAMING PLUS AC
Geforce GTX 1060 6GB
16GB DDR4-3600
WD SN750 1TB NVME
Samsung 850 EVO 250GB SSD
Corsair HX520W PSU
Cougar QBX Case
NEC V422 42" @ 1080p
Ubuntu 20.04 + Whatever I VM

 

Offline geo111

  • 21
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Can the HUD elements be relocated by editing Yarns patch file?

I'm trying to play this on my three monitor array. The .exe files with Yarns patch work pretty well, but the elements on the far edges of the monitors are just too far away.


 

Offline Yarn

  • 210
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
I updated the builds again.

Can the HUD elements be relocated by editing Yarns patch file?

I'm trying to play this on my three monitor array. The .exe files with Yarns patch work pretty well, but the elements on the far edges of the monitors are just too far away.
I do want to allow easy adjustment for your kind of setup, but that's probably not going to happen until the command line is no longer used for options.

For now, try the attached file. Place it in mediavps_3612\data\tables (create it if it doesn't exist). Then, make sure that mediavps_3612 is selected as the active mod. Then, play the FS2 campaign and see how the HUD looks.

[attachment deleted by an evil time traveler]
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline MachManX

  • 26
  • The Fight Never Ends...This Is A Fact Of Life!
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Hey Yarn, do you have to manually reposition all elements in the tbm file to make it fit his resolution, or do you have a set formula for adjustment?  Cause if you do then perhaps by making some sort of simple GUI that can generate a .tbm file for each user's needs or have a configurator that allows direct editing of the tbm file would be awesome.  Perhaps have an autodetect resolution function in there as well.

Then again, I don't want to burden you with extra work...just thought I'd mention some sort of idea to help you out ;)
AMD Ryzen 5 3600
B450I GAMING PLUS AC
Geforce GTX 1060 6GB
16GB DDR4-3600
WD SN750 1TB NVME
Samsung 850 EVO 250GB SSD
Corsair HX520W PSU
Cougar QBX Case
NEC V422 42" @ 1080p
Ubuntu 20.04 + Whatever I VM

 
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Quote
I updated the builds again.

Thank you very much!

 

Offline niffiwan

  • 211
  • Eluder Class
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Well, the weekend is over and RL stuff meant that I didn't get as much done on this as I would have liked.  I'm still in the process of updating m!m's patch to get it into trunk.  Once that's done I'll get Yarn's patch updated and put them both up for some review.

@Lykurgos88
Yep, I'm aiming to get Yarn's patch into the next official SCP version.
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline MachManX

  • 26
  • The Fight Never Ends...This Is A Fact Of Life!
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Yep, I'm aiming to get Yarn's patch into the next official SCP version.

Ok, so all I have to do is create a few builds here and there until this happens...cool.

Edit 1:  And here we go with the latest Yarn Patch and build 10156 located here:- http://www17.zippyshare.com/v/88451529/file.html
« Last Edit: November 24, 2013, 10:29:56 pm by MachManX »
AMD Ryzen 5 3600
B450I GAMING PLUS AC
Geforce GTX 1060 6GB
16GB DDR4-3600
WD SN750 1TB NVME
Samsung 850 EVO 250GB SSD
Corsair HX520W PSU
Cougar QBX Case
NEC V422 42" @ 1080p
Ubuntu 20.04 + Whatever I VM

 
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Hi again,

I have two small (not game-breaking) HUD-related problems. The other is related to Yarn's patch, the other is not (but I thought it would probably better to bundle them together).

First off, the Adaptable HUD patch seems to screw up the Wings of Dawn video message screen. It is only partially filled, as demonstrated in this picture:



I think this happens only in WoD. For example Dimensional Eclipse doesn't have this problem. The way I see it, either the animation itself is too small (resolution wise), the screen scaling doesn't work properly, or both.

---

The other problem has been present ever since I made a fresh install of FSO and downloaded the official 3.7.0 build. It also happens in all the other builds I have tried; including Yarn, BP and newest Nightlies. It's related to the in-game message screen. The invisible box, that is supposed to contain 3 lines at a time, is a bit too small on the left and on the top. This effectively means that some pixels on the left and on the top disappear even though there seems to be a enough room to render. To demonstrate this issue, I played the "Surrender, Belisarius" mission with both FSO and FS2 retail in order to make screenshot comparison.

This is how it looks in FSO:


And this is how it looks in the retail FS2:


The easiest way to spot these disappeared pixels is to look the first character of Alpha: "A" and the number "2". "A" is almost missing its left leg and "2" is missing its "hat". Retail seems to render messages pixel perfect, but FSO doesn't.

I played FSO with a resolution of 1920x1080@32bit and Retail FS2 with 1024x768@32bit.

 

Offline Yarn

  • 210
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
@Lykurgos88:

1: What's happening here is that WoD: Stranded replaces the message window with a bigger one but does not include larger head ANIs. This causes exactly what you're seeing, whether or not you're using my patch (try it in 3.7.0 and you'll see the same thing). You should let the WoD team know about this so that they can fix it. (EDIT: Looks like they already know, so no need to tell them.) For now, you can work around this by removing Stranded_V0.99.vp from your WoD folder (but you do need that file to play Stranded, obviously).

2: This appears to have something to do with how the font is scaled (and it happens to me too, so you're not the only one). I suggest making a new thread about this. After all, as you effectively said, this has nothing to do with my patch.
« Last Edit: November 25, 2013, 01:23:43 pm by Yarn »
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline MachManX

  • 26
  • The Fight Never Ends...This Is A Fact Of Life!
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
It's Yarn's fault.  By messing with the scaling of the HUD he messed with the scaling of the universe <- and THAT causes the text to be cut off at the top.  Things have to be in "Sync" you know  ;)


I think I may have noticed this issue myself but rather than point out the obvious like Lykurgos88, I developed the habit of always pressing F4 to check previous messages.  Like he said it wasn't game-breaking so rather than report it I just developed that habit.  It would be soo weird if font scaling was the issue.
AMD Ryzen 5 3600
B450I GAMING PLUS AC
Geforce GTX 1060 6GB
16GB DDR4-3600
WD SN750 1TB NVME
Samsung 850 EVO 250GB SSD
Corsair HX520W PSU
Cougar QBX Case
NEC V422 42" @ 1080p
Ubuntu 20.04 + Whatever I VM

 
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
Quote
1. What's happening here is that WoD: Stranded replaces the message window with a bigger one but does not include larger head ANIs.

Okay, that's good to know. It seems this was a coincidence I didn't even think about. Because originally I started Wings of Dawn with 3.7.0 and without any addons (like Stranded, A nordera day etc.) and then I moved to try other mods. At some point I got frustrated with the stretched HUD and I switched to Yarn's patch. Then I installed WoD expansions and continued the main campaign. So this gave me an illusion that this problem was caused by Yarn's patch, when in reality it apparently had nothing to do with it. :P

Quote
2: This appears to have something to do with how the font is scaled (and it happens to me too, so you're not the only one). I suggest making a new thread about this.

Right. I'll make a new thread in a moment or two.

 

Offline geo111

  • 21
Re: [CODE REVIEW] Adaptable HUD, a.k.a. No more HUD stretching, for real this time
I updated the builds again.

Can the HUD elements be relocated by editing Yarns patch file?

I'm trying to play this on my three monitor array. The .exe files with Yarns patch work pretty well, but the elements on the far edges of the monitors are just too far away.
I do want to allow easy adjustment for your kind of setup, but that's probably not going to happen until the command line is no longer used for options.

For now, try the attached file. Place it in mediavps_3612\data\tables (create it if it doesn't exist). Then, make sure that mediavps_3612 is selected as the active mod. Then, play the FS2 campaign and see how the HUD looks.

This is great! Thanks Yarn!

I use three old 20" Dell FP2001 displays. Each is 1600x1200, but with bezel compensation the total resolution is 5076x1200. In an attempt to improve immersion, I built my desk to allow me to sit close to the displays. The downside is when HUD elements are at the far edges.