Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nit] Health circle is too large in widescreen #13

Open
thekovic opened this issue Jan 18, 2025 · 11 comments
Open

[nit] Health circle is too large in widescreen #13

thekovic opened this issue Jan 18, 2025 · 11 comments

Comments

@thekovic
Copy link

thekovic commented Jan 18, 2025

This report is brought to you by OCD.

The health circle in OpenJones3D takes up too much screen space at 1920x1080 compared to the original PC version or the N64 version.

As a control group, here's the original PC version and N64 version (both at 640x480) overlaid with each other. You can see the health circle takes up the exact same amount of screen space.

Image

Here's OpenJones3D and original PC version rendered at 640x480 scaled to the exact same vertical resolution overlaid with each other:

Image

In exact numbers, the health circle at 1080p is about 177 pixels tall. It should be about 135 pixels to take the same amount of screen space as the original does.

@thekovic
Copy link
Author

Reading the code, I believe a good fix is to do in JonesHud_UpdateHUDLayout:

    JonesHud_healthIndRect.width  = JonesHud_heightAspectRatioScale * 60.0f;
    JonesHud_healthIndRect.height = JonesHud_heightAspectRatioScale * 60.0f;

Technically, this will make the health circle too big at resolution that are taller than wider (like a mobile phone) but those are much less common in desktop PC space than widescreen resolutions.

@smlu
Copy link
Owner

smlu commented Jan 20, 2025

Are the screenshots of the ref PC version from the GOG version?
The GOG version has smaller HUD icon sizes.

For ref vanilla v1.2 at 1920x1440:
Image

And OpenJones3D v0.2:

Image

@thekovic thekovic changed the title [nit] Health circle is too large [nit] Health circle is too large in widescreen Jan 20, 2025
@thekovic
Copy link
Author

@smlu No, reference screenshots are from CD version 1.2

@smlu
Copy link
Owner

smlu commented Jan 21, 2025

Ah I missed that ref PC screenshot was 640x480.

The scaling of HUD indicators is based on the game resolution width in order to get correct (original) scaling on 4:3 resolutions.
Using resolution height as ref for scaling would result in smaller icons on 4:3 resolutions.
For comparison 1080p vs 1920x1440 on vanilla 1.2:
Image

@smlu
Copy link
Owner

smlu commented Jan 21, 2025

That being said, to change the scaling and use the resolution height for scaling reference, other changes will need to be made. Specifically, the position offset of indicators will need to be updated, the inventory menu scaling will also have to be adjusted.
Since the inventory item icons will become smaller in this case I guess the number of visible inventory items in selected column could be also increased as there will be more space.

For reference here's what has to be changed for indicator scaling:

@thekovic
Copy link
Author

You're comparing 1920x1080 with 1920x1440 but you should be comparing it with 1440x1080. That's the 4:3 native resolution equivalent for the same resolution display.

@smlu
Copy link
Owner

smlu commented Jan 21, 2025

Ah yes, you're right about that.

@smlu
Copy link
Owner

smlu commented Jan 21, 2025

Just for reference here’s a screenshot from modified OpenJones3D version illustrating why using resolution height for scaling HUD indicators results in incorrect scaling (too small) and positioning compared to the inventory menu:
Image

The reason for this is that the HUD and other graphical elements were designed to scale based on the game resolution width.
As such, the current implementation correctly scales HUD indicators as originally intended, in my opinion.

@thekovic
Copy link
Author

What was originally intended is hard to decide in my opinion since the original implementation of HUD in widescreen was broken. The choice of using width/height ratio for scaling was completely arbitrary as long as the target resolution was 4:3 because then they are the same number (1 at 640x480, 2.25 at 1440x1080, etc.). Since the size of the circle in pixels is scaled linearly with resolution, the circle occupies the same amount of screen space regardless the resolution (at 4:3).

In widescreen, width and height ratio are no longer equal and this resulted in the circle being squished (wider than tall) in the original implementation. To "unsquish" it, the current implementation chooses to pick the width ratio and apply that to the height as well which makes the circle larger than it would be at a 4:3 resolution of the same number of lines. I happen to think that making the circle the same size regardless of aspect ratio is the more "correct" (and prettier) solution.

And I think the images support than opinion because if I overlay the original PC version with your modified OpenJones3D, it fits completely perfectly. If then the inventory looks "wrong", I would rather adjust the inventory (and I'm happy to write a PR for that).

Image

Finally, here's N64 version as well for shits and giggles.

Image

@smlu
Copy link
Owner

smlu commented Jan 25, 2025

To "unsquish" it, the current implementation chooses to pick the width ratio and apply that to the height as well which makes the circle larger than it would be at a 4:3 resolution of the same number of lines

Scaling to 4:3 was intentionally chosen for the initial implementation to match the original design 1:1 and to fix HUD rendering problems on widescreen resolutions. I'm not arguing tho, that this is the correct scaling solution for widescreen resolutions. I'm simply pointing out the OpenJones3D implementation decision, which I'll try to explain below.

What was originally intended is hard to decide in my opinion since the original implementation of HUD in widescreen was broken. The choice of using width/height ratio for scaling was completely arbitrary as long as the target resolution was 4:3 because then they are the same number (1 at 640x480, 2.25 at 1440x1080, etc.). Since the size of the circle in pixels is scaled linearly with resolution, the circle occupies the same amount of screen space regardless the resolution (at 4:3)

The HUD was designed to lock on 4:3 aspect ratio, uses 640x480 as base resolution and scaled by using the longer side - width.
For example, take a look at how the HUD width/height ratio vars are calculated and the scale factor of health circle. Whenever an element is being drawn onto the screen it's being scaled to base resolution. You can find numerous reference throughout the code (e.g.: text drawing). Btw we also have scaling problem of a text on widescreen, not yet fixed.

Example of HUD scaling on different 4:3 resolutions (vanilla):
Note the size of the health indicator relative to the inventory menu size.
Image

Vanilla 1920x1080 vs 1920x1440:
Image

Vanilla vs OpenJone3D at 1920x1080:
Image

Just for reference, to match the original scaling, a new variable JonesHud_aspectRatioScale was created. This variable holds the current aspect ratio of current resolution vs base resolution. This var is used for scaling the size and position of the inventory menu and the 'item changed' element


If then the inventory looks "wrong", I would rather adjust the inventory (and I'm happy to write a PR for that

As far as I'm concerned, I'm all for changing the scaling of health/endurance indicator as long as other elements of the HUD are also correctly scaled (inventory menu, "item changed" element, text?).
If you can provide this PR I'll gladly accept it. Btw we might also want to stretch the inventory menu on widescreen, so it fills more space horizontally?

@thekovic
Copy link
Author

Btw we might also want to stretch the inventory menu on widescreen, so it fills more space horizontally?

I'll see how it looks but I expect large gaps between inventory columns to look weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants