Skip to content

Add HD resolution & FOV settings#667

Merged
Lgt2x merged 9 commits intoDescentDevelopers:mainfrom
Lgt2x:resolutions
Mar 7, 2025
Merged

Add HD resolution & FOV settings#667
Lgt2x merged 9 commits intoDescentDevelopers:mainfrom
Lgt2x:resolutions

Conversation

@Lgt2x
Copy link
Member

@Lgt2x Lgt2x commented Feb 20, 2025

Pull Request Type

  • GitHub Workflow changes
  • Documentation or Wiki changes
  • Build and Dependency changes
  • Runtime changes
    • Render changes
    • Audio changes
    • Input changes
    • Network changes
    • Other changes

Description

This adds support for setting higher resolutions, as well as the FOV angle. The projection math has been corrected so the aspect ratio is automatically computed given window dimensions.

Possible improvements (probably not in this PR):

  • scale the HUD text to the resolution
  • scale the reticle
  • scale menu

This work is derived from the Piccu Engine that has done this before.

Related Issues

Closes #205

Screenshots (if applicable)

Descent 3 running in glorious 2540*1440
res1

New video configuration menu
res2

res3

@JeodC
Copy link
Collaborator

JeodC commented Feb 20, 2025

Tested with 2560x1440 native. Level 5 still renders the reactor percentages at Y-center, which is what I considered first on seeing this. The resolution picker has options not available on my device, however, can they be retrieved from the OS?

#define STAT_SCORE STAT_TIMER

int Game_video_resolution = 1;
std::vector<tVideoResolution> Video_res_list = {{512, 384},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally these options should be retrieved from the operating system and populated as such, using the custom list as a fallback. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good idea: default resolution is the "native" screen resolution, and the user can otherwise choose from the pre-defined list.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, no, I mean than at the moment I can choose resolutions beyond what my monitor will output, and I assume in some cases choosing one of those options might end up causing a user to get "stuck" with a black screen or a blown-up viewport that puts several items offscreen where they may not be able to correct their mistake.

I mean literally populate the list by querying the OS/GPU for the available resolutions and use the pre-defined list as a fallback if the query fails.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDL_GetFullscreenDisplayModes() seems to be the way in SDL3 to query all the supported display resolutions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my testing, going to a higher resolution than your screen does not do anything unexpected... What I'm unsure about is using this approach with multiple monitors that do not have the same resolutions. What happens if the game window is created on the "wrong" monitor and the game does not suggest the right resolutions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've iterated a little more on this, and ended with this solution (implemented in last commit): in a new function run at game launch, ConfigureDisplayResolutions, we iterate display modes with SDL_GetFullscreenDisplayModes() on all available displays, only keep unique (width;height) pairs, and use the current display mode of the default display as the default resolution. -width and -height arguments create a new resolution if it does not exist yet and select it. The current resolutions list is used as a fallback only.

Let me know what you think!

Copy link
Member Author

@Lgt2x Lgt2x Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeodC @pzychotic did you have the chance to test this new version? =)

Copy link
Collaborator

@JeodC JeodC Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Looks good to me! My monitor will not allow anything below 800x600 so I am not sure where it gets the 720x resolutions. If it comes from the GPU and it's just Windows being a butt, so be it.

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I'll update that. Thanks for testing!

@halprin
Copy link
Member

halprin commented Feb 21, 2025

Works overall on macOS. I set it to 2560x1440 and looks lovely.

I run into a non-ideal situation when I subsequently change the resolution while in game, though. This is from starting out in 2560x1440.

  1. Press F2 to bring up the video settings.
  2. Change the resolution to 1280x720.
  3. See image 1 below. Notice that the settings window moves to the corner. Not ideal.
  4. Thankfully, I can still click on "Change" for the resolution.
  5. See image 2 below. Thankfully, the window for the resolutions are centered.
  6. I change the resolution back to 2560x1440.
  7. See image 3 below. Yay, the video settings window is back being centered.

Image 1.
Screenshot 2025-02-20 at 5 42 02 PM

Image 2.
Screenshot 2025-02-20 at 5 42 16 PM

Image 3.
Screenshot 2025-02-20 at 5 42 30 PM

@Lgt2x
Copy link
Member Author

Lgt2x commented Feb 21, 2025

the menu placement is less than ideal indeed, I'll see what I can do.

Thank you guys for testing!

@Lgt2x
Copy link
Member Author

Lgt2x commented Feb 23, 2025

@halprin that should be fixed, we now only change resolution when exiting the config menu

Copy link
Member

@halprin halprin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@halprin that should be fixed, we now only change resolution when exiting the config menu

I tested on a standard 1440p monitor and Apple Retina monitor (HiDPI). Both work well on the Mac! The resolution switching works fine too.

@Lgt2x
Copy link
Member Author

Lgt2x commented Mar 7, 2025

We have 2 approvals, let's merge this

@Lgt2x Lgt2x merged commit 025f061 into DescentDevelopers:main Mar 7, 2025
10 checks passed
@Lgt2x Lgt2x mentioned this pull request Mar 10, 2025
9 tasks
@jengelh jengelh mentioned this pull request Jun 6, 2025
5 tasks
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

Successfully merging this pull request may close these issues.

[Feature Request] Support for 1080p and Higher Resolutions

4 participants