Author Topic: Aspect Ratio Correction option  (Read 16525 times)

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Aspect Ratio Correction option
« on: May 08, 2013, 03:45:35 am »
The game seems to be designed for 16:10 aspect ratio, due to the globe in Geoscape looking round in 320x200. Right now the game is stretched to fill the whole window, which means it looks stretched or flattened if you're playing fullscreen with a 4:3 or 16:9 monitor.

It is true that most games that ran at 320x200 accounted for the fact that the resolution is usually scaled to 4:3, but as the globe looks oval when this is done, it seems XCOM wasn't designed with that in mind.

It would be nice if there was an option to letterbox the game to 16:10, especially since most video card drivers don't have 16:10 resolutions past 1280x800 enabled by default. This is merely so the game doesn't look flattened if you're playing it at 1920x1080, for example.

UFO Extender for the regular Windows version of XCOM has an option for this. It's an extremely trivial change, so I could probably add it myself if the devs have higher priorities.
« Last Edit: May 09, 2013, 12:30:41 pm by Tarvis »

Offline Fenyő

  • Colonel
  • ****
  • Posts: 423
    • View Profile
Re: Aspect Ratio Correction option
« Reply #1 on: May 08, 2013, 05:51:49 am »
This is a good idea.

Feel free to make this option, and then make a Pull Request on Github.

I think the option itself should set the aspect ratio itself, which could be set to 4:3, 5:4, 16:9, 16:10, 235:100.

Volutar

  • Guest
Re: Aspect Ratio Correction option
« Reply #2 on: May 08, 2013, 06:40:59 am »
It is not possible until geoscape will be resolution-free.
There is static background under globe and shading pre-calculations which make that hard to accomplish properly. Improper accomplishing is not acceptable.

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: Aspect Ratio Correction option
« Reply #3 on: May 08, 2013, 09:45:36 am »
All I mean is letterboxing. Black borders. Not expanding the game geometry.

I haven't looked into the code yet so I can't say for sure, but if the 320x200 game is being stretched to fill the current resolution, then there should be a way to make it draw to a differently-sized poly. If rendering to the screen texture isn't one step then it could be done in post-processing just like the GL shaders are.

I'll look into it and see. The only complication I can think of at the moment is how shaders should handle this. Should they work off of the entire screen or only the letterboxed area? I'm leaning towards the latter.
« Last Edit: May 08, 2013, 10:00:56 am by Tarvis »

Volutar

  • Guest
Re: Aspect Ratio Correction option
« Reply #4 on: May 08, 2013, 10:37:14 am »
I think shaders really could handle these stretching and letterboxing techs.

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: Aspect Ratio Correction option
« Reply #5 on: May 08, 2013, 11:30:32 am »
OK! All it takes is altering the coordinates of the screen texture's triangle. As far as I can tell, geoscape and everything looks fine. It even adjusts the shaders accordingly (only curves the letterboxed area with CRT shaders, for example)!

Now I'll just write the option for it and it should be all set. How about mouse speed? Should that get adjusted too?
« Last Edit: May 08, 2013, 11:35:57 am by Tarvis »

Volutar

  • Guest
Re: Aspect Ratio Correction option
« Reply #6 on: May 08, 2013, 11:52:25 am »
It's interesting question. Black bars at sides or at top/bottom are unavailable for mouse cursor.. but game could be windowed... So it either scale this window into smaller projected area inside, or skips drawing at "black" areas.. Both of those options are not very elegant. It would be better to have black areas available for cursor.
But from those two I'd choose "quit drawing" method in windowed, and scaling for fullscreen.

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: Aspect Ratio Correction option
« Reply #7 on: May 08, 2013, 04:49:37 pm »
I think for windowed mode it would be best to ignore this option, because it doesn't make sense to have black bars in a window when the window itself can be resized instead; but at the same time it wouldn't match the selected resolution for windowed mode.

Should this option be added to the main screen or to Advanced Options? I could turn the fullscreen/windowed buttons into a toggle and use the space from that to make a button for it. I'll give it the following choices:

-Off
-Auto (Calculates using inwidth/inheight to be compatible with changed base resolution later if this feature is expanded upon, would be default)
-4:3
-5:4
-16:10
-16:9
-235:100

EDIT: Hmm, the SDL software-renderer scaling functions are too hardcore for me and I'm not sure how to adjust them for aspect ratio, so for now I've only got it implemented for OpenGL. Modifying the dst surface dimensions in _zoomSurfaceY perhaps? Also, Volutar is right, if I adjust the ScaleX/Y variables to scale mouse movement then the Geoscape screen and others get a little off, so for now the aspect ratio adjustment is purely visual.
« Last Edit: May 08, 2013, 08:59:45 pm by Tarvis »

Offline Fenyő

  • Colonel
  • ****
  • Posts: 423
    • View Profile
Re: Aspect Ratio Correction option
« Reply #8 on: May 08, 2013, 11:12:00 pm »
i vote it should only visual, leave the mouse.
And i vote it should be in the advanced options.

Offline Hythlodaeus

  • Colonel
  • ****
  • Posts: 276
    • View Profile
Re: Aspect Ratio Correction option
« Reply #9 on: May 09, 2013, 01:43:16 am »
I vote it should be added to the main screen, preferably near the resolution indicator. The advanced options menu is chiefly for gameplay enhancement features.

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: Aspect Ratio Correction option
« Reply #10 on: May 09, 2013, 03:02:27 am »
I was thinking main options screen as well. I was thinking the shader selection button could be replaced with a Software/OpenGL toggle button and then a Video Options button next to it which will take you to a list of shaders/aspect ratios. How does that sound?

If not, it could go as its own option under the volume options.


Here's my fork if you want to check out what I've done so far. It slows down the game quite a bit since it's called from Refresh at the moment, but I'll move it to init/resize later so it's only called once per resolution call.

All I have left is to implement it for the software modes and figure out the options menu so I can add it there. I'll have to look over it and learn it all so it might take a while.
Attached are examples taken at 640x480 resolution.
« Last Edit: May 09, 2013, 11:17:40 am by Tarvis »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Aspect Ratio Correction option
« Reply #11 on: May 09, 2013, 08:29:05 pm »
we have an "advanced graphics" menu planned for further down the road, so any effort you spend on learning the menus now may well be wasted. i'd say just add the functions and the option settings, and we'll take care of the menus. :)

Volutar

  • Guest
Re: Aspect Ratio Correction option
« Reply #12 on: May 09, 2013, 08:54:03 pm »
aspect 16:10 is NATIVE. 320/200 = 16/10
I have 1920x1200 and it covers whole screen perfectly with x4 zoom.

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: Aspect Ratio Correction option
« Reply #13 on: May 09, 2013, 09:09:26 pm »
Indeed. Using the 'auto' setting I have will make it letterbox to 16:10. You won't notice a difference if you're already on a 16:10 resolution, but if you're using 1920x1080 like me it will letterbox it to not be as wide.

Auto doesn't just make it 16:10. Just in case the base resolution feature gets expanded upon later, the auto setting will calculate the ratio based on that. So if you change baseResolutionX/Y to 640x480, then 'auto' will set it to 4:3 instead, for example.

Can someone else try building my fork for me and running it? I'm still getting a lot of slowdown in Battlescape even with my code commented out and I'm not sure why, it might just be an issue with my dependencies. I'm running VS2008...
« Last Edit: May 09, 2013, 10:50:46 pm by Tarvis »

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Aspect Ratio Correction option
« Reply #14 on: May 10, 2013, 03:16:13 am »
Indeed. Using the 'auto' setting I have will make it letterbox to 16:10. You won't notice a difference if you're already on a 16:10 resolution, but if you're using 1920x1080 like me it will letterbox it to not be as wide.

Auto doesn't just make it 16:10. Just in case the base resolution feature gets expanded upon later, the auto setting will calculate the ratio based on that. So if you change baseResolutionX/Y to 640x480, then 'auto' will set it to 4:3 instead, for example.

Can someone else try building my fork for me and running it? I'm still getting a lot of slowdown in Battlescape even with my code commented out and I'm not sure why, it might just be an issue with my dependencies. I'm running VS2008...
If you're running directly from VS, the game is gonna be a lot slower, because the "debugger" adds a lot of weight. Debug builds are also significantly slower than release builds.