3.3.0 update: improved display resolution selection

Started by Crimson Wizard, Sun 30/03/2014 15:22:03

Previous topic - Next topic

Crimson Wizard

First of all, I apologize for closing previous thread with this name (I asked mods to delete it). I've had numerous issues with the first version of this build and got very upset, thinking that I won't be able to deal with all the hacks in AGS code related to letterboxing. :embarrassed:

After some time I saw that probably it is possible to fix them. So, I am reposting the improved version of the build.

//---------------------------------------------------------------------

This is a test build with improved display resolution setting, based on latest 3.3.0.
This version is some kind of "intermediate" between 3.2.1 and custom resolutions. It features a relatively free window resolution. Since everything related to graphics is pretty fragile in AGS, and this is supposed to be an update over current release, rather than completely new version, I tried to keep changes to minimum.
Yes, I moved from "hotfix" idea to "update", because this is really can't be viewed as a hotfix anymore.

http://www.mediafire.com/download/rdzu8zaacmt2065/ags_3.3.0_scaling_update.7z

Git branch: https://github.com/ivan-mogilko/ags-refactoring/tree/update_scaling

This includes only acwin.exe to replace the one in 3.3.0 installation.

Now in master branch:
http://www.mediafire.com/download/5a67mvl0d63i416/AGS-3.3.0.zip

Please, do not use this for your actual game release yet. It must be tested first.
I ask anyone who has little time to test if that works for any game resolution / display resolution combinations.

What it does (in theory):
1. It should support running game at almost any resolution, provided that a) the resolution is not smaller than scaled up game, and b) its sizes are multiplies of scaling multiplier.
For example, if game scaling is 4, then window sizes should be multiplies of 4. If scaling is 3, window sizes should be multiple of 3, etc.
This restriction is implied by how black borders (letterboxing/sideborders) work in original AGS.
If scaling is 1 (no filter), window can have any size (I think).
2. It should automatically find maximal supported nearest-neighbour scaling, if the requested scaling failed. In any case it searches for all combinations of sideborders/letterbox (depending on setup options). Therefore if you computer supports just any resolution equal or larger to game size, AGS must find and use one. Resolutions with desktop aspect ratio are given higher priority.
3. Writes bit more interesting stuff to the log.

What it does not:
1. It does not allow absolutely free window size selection.
2. It does not allow non-integer scaling.
3. It does not allow downscaling.
4. It does not allow to explicitly choose position of the game inside window (proportional, stretched, centered, etc) - this is defined only automatically.
5. This has nothing to do with custom game resolutions.

//---------------------------------------------------------------------

Known issues:
1. Resolution selection now works differently, and you may sometimes get surprised by results; for example, you may get a small "boxed" game inside a larger fullscreen without expectation. Well, this is not really a bug, yet needs to be checked, to know if people are generally ok with that.
This is "cured" by disabling sideborders and removing "force letterbox" check in winsetup.
2. This is rather related to old AGS logic, but if "Force letterbox" is not checked, engine always looks for non-letterboxed resolution first, and the game may end up stretched to fullscreen, breaking aspect ratio, even though there may be more correct resolution available.
3. Proper letterboxing is disabled in winsetup for 800x600 and 1024x768 now, I need to fix this; but it should generally work: you may put "forceletterbox=1" into setup file.
4. Sometimes the part of cursor may be drawn above borders.


What needs to be tested:
1. All game resolutions / scaling combos.
2. Room transitions, especially fade-in/fade-out.
3. Scrolling rooms.
4. Built-in dialogs (default quit/load/save dialogs).

Gurok

Hey, CW, is it possible for me to make an updated version of 3.3.1 with this resolution selection stuff in it? I might be able to help test it, but my game uses text window padding. Is there a branch or is it just a matter of grabbing the most recent commits from master?
[img]http://7d4iqnx.gif;rWRLUuw.gi

Crimson Wizard

#2
Quote from: Gurok on Mon 31/03/2014 07:17:10
Hey, CW, is it possible for me to make an updated version of 3.3.1 with this resolution selection stuff in it? I might be able to help test it, but my game uses text window padding. Is there a branch or is it just a matter of grabbing the most recent commits from master?
I would not want to post it in official repository right away, because the code is raw, and I still have slight doubts in approach.
I will make a feature branch in my personal repository, and possibly another test branch that merges 3.3.1 in. I'll do that later today.

Crimson Wizard

Created branch: https://github.com/ivan-mogilko/ags-refactoring/tree/update_scaling

It can be merged to 3.3.1, but you'll have to resolve couple of simple conflicts first (parameters to GraphicsDriver::Init call and to error message).

Crimson Wizard

Uploaded slightly updated version, now can run all games letterboxed.
http://www.mediafire.com/download/7wepvs1339utl8a/acwin_3.3.0_scaling_update.7z

I'd liked to hear any feedback about how this works.

Gurok

I tried merging this into 3.3.1, but I'm getting crashes and errors saying that a resolution of 0x0 can't be initialised when running it full screen. Running in a window is fine though.
It's probably my fault. I don't know if I did the correct thing when merging it or not.
This is my branch: https://github.com/gurok/ags/tree/331_alpha1proposal
It's 3.3.1 + the master + your branch.
I checked out your branch, edited the files that had conflicts, added them to the commit, then committed and pushed the whole thing to my branch.
I'm not asking for your help. I just wanted to cry a bit because I can't figure out what's wrong.
[img]http://7d4iqnx.gif;rWRLUuw.gi

Radiant


Crimson Wizard

#7
Quote from: Gurok on Sun 06/04/2014 12:25:50
I tried merging this into 3.3.1, but I'm getting crashes and errors saying that a resolution of 0x0 can't be initialised when running it full screen. Running in a window is fine though.
It's probably my fault. I don't know if I did the correct thing when merging it or not.
This is my branch: https://github.com/gurok/ags/tree/331_alpha1proposal
It's 3.3.1 + the master + your branch.
I checked out your branch, edited the files that had conflicts, added them to the commit, then committed and pushed the whole thing to my branch.
I'm not asking for your help. I just wanted to cry a bit because I can't figure out what's wrong.

Just built your branch, works well for me. Can you show the config file you are using? Maybe some combination of options leads to this.
You can also run with "--log" parameter to get a log file.

Quote from: Radiant on Sun 06/04/2014 13:42:20
Quote from: Crimson Wizard on Sat 05/04/2014 19:22:01
Uploaded slightly updated version, now can run all games letterboxed.
http://www.mediafire.com/download/7wepvs1339utl8a/acwin_3.3.0_scaling_update.7z
Is this the same as hotfix 2 from the main release thread?

No, it's slightly below. It is not meant to be used in real game yet, but that won't be a problem to upgrade it to hotfix-2 if this is really important.

Crimson Wizard

I tested this more, and it seems to work.
I'd really love to hear ANY feedback.

Radiant

#9
Testing now...

Scale x2, no side borders. Chosen gfx resolution: 640 x 480 (32 bit), game frame: 320 x 240. That works since my monitor doesn't run in 640x400.
Scale x2, side borders. Game ends up running on a 1280 x 720 screen with the game in 640 x 360. That's weird, I'd expect it to be 640x400 (perhaps the logging is wrong or the 'game frame' doesn't mean what I think?) I suppose the big black borders are because my monitor doesn't support intermediate resolutions.
Scale max, side borders. Chosen gfx resolution: 1920 x 1080 (32 bit), game frame: 384 x 216. Again I'm not sure where the game frame comes from, but it launches well and does get side borders as expected.

Scale max, no side borders. Game fails to launch,
Spoiler

msg:
There was a problem initializing graphics mode 0 x 0 (32-bit) with game size 320 x 200 and filter 'Undefined'.
(Problem: 'Failed to find acceptable graphics filter')

log:
Built library path: d3d9.dll
Created graphics driver: Direct3D 9
Initializing screen settings
Game native resolution: 320 x 200 (32 bit), letterbox optional, side borders disabled
Initializing gfx filters
Couldn't find any supported uniform scaling for game size 320 x 200 (32 bit)
Init gfx driver
Created graphics driver: Allegro/DX5
Initializing screen settings
Game native resolution: 320 x 200 (32 bit), letterbox optional, side borders disabled
Initializing gfx filters
Couldn't find any supported uniform scaling for game size 320 x 200 (32 bit)
[close]

So we're getting close, I think :) Thank you for your time!

Crimson Wizard

#10
Quote from: Radiant on Tue 08/04/2014 21:21:47
Scale x2, side borders. Game ends up running on a 1280 x 720 screen with the game in 640 x 360. That's weird, I'd expect it to be 640x400 (perhaps the logging is wrong or the 'game frame' doesn't mean what I think?)
In contrary to real "custom resolutions" build, game frame here is a (game size + size of borders) before scaling. That's because the borders are drawn not by graphics renderer, but by room drawing routine.
640x360 is a game + borders, and 1280x720 is this (game + borders) x 2 scale. It works like that.


Quote from: Radiant on Tue 08/04/2014 21:21:47Scale max, no side borders. Game fails to launch,
Spoiler

msg:
There was a problem initializing graphics mode 0 x 0 (32-bit) with game size 320 x 200 and filter 'Undefined'.
(Problem: 'Failed to find acceptable graphics filter')
[close]
Hm, I see two problems here:
1) it did not find supported resolutions, which should not normally happen, knowing that "Scale x2, no side borders" worked well. But this happens if sideborders are disabled, so it's theoretically possible that there's simply no matching resolution. I wonder what the game should do in such case: should it override user request and try sideborders, or just quit?
2) it displays incorrect error message (should tell about not being able to find resolution).

Radiant

#11
Quote1) it did not find supported resolutions, which should not normally happen. But this happens if sideborders are disabled, so it's theoretically possible that there's simply no matching resolution. I wonder what the game should do in such case: should it override user request and try sideborders, or just quit?
Well, the engine also overrides e.g. the graphics driver (using Dx5 if Dx9 doesn't work), so it should also override the sideborders in this case. After all, it's better for the user to get a slightly different resolution, than for the game to abort.

Also note that the earlier build (log H) did run with max scaling/no borders.

Crimson Wizard


Radiant

Ok, testing again.

Scale x2, no side borders same as yesterday.
Scale x2, with borders same as yesterday.
Max scaling, no side borders now works.
Max scaling with borders however no longer works: it plays the game fine, but doesn't show the side borders. This did work in yesterday's version.

Spoiler

Created graphics driver: Direct3D 9
Initializing screen settings
Game native resolution: 320 x 200 (32 bit), letterbox optional, side borders enabled
Initializing gfx filters
Requested gfx filter: max
Chosen gfx resolution: 1280 x 800 (32 bit), game frame: 320 x 200
Applying scaling filter: StdScale4
Switching to graphics mode
Attempt to switch gfx mode to 1280 x 800 (32-bit) fullscreen, game frame 320 x 200, gfx filter: StdScale4
Succeeded. Using gfx mode 1280 x 800 (32-bit) fullscreen, game frame 320 x 200, gfx filter: StdScale4
Preparing graphics mode screen
[close]


Crimson Wizard

Quote from: Radiant on Wed 09/04/2014 12:07:17
Max scaling with borders however no longer works: it plays the game fine, but doesn't show the side borders. This did work in yesterday's version.
You should run with "force letterbox", otherwise it first finds available non-letterboxed mode, which not necessarily matches desktop ratio.

Radiant

Ok, I'll try that. What exactly is a "letterboxed" mode, though?

Crimson Wizard

#16
Quote from: Radiant on Wed 09/04/2014 13:12:39
Ok, I'll try that. What exactly is a "letterboxed" mode, though?
Erm.
Letterboxed = top & bottom borders.
Siderborders = left & right borders.

(I thought you guys know those things better, you are making games since early 2000-ies :tongue:).

Radiant

Wait, so if I enable "letterbox" then I get borders to the side but not to the top/bottom, and if I disable it I get no borders anywhere even though I still asked for side borders. Huh?

Crimson Wizard

#18
Quote from: Radiant on Wed 09/04/2014 14:27:23
Wait, so if I enable "letterbox" then I get borders to the side but not to the top/bottom, and if I disable it I get no borders anywhere even though I still asked for side borders. Huh?

Force Letterbox    => enabled  => try all resolutions, regardless of whether they are with top & bottom borders or not.
                          => disabled => try resolutions without top&bottom borders first, then, if failed, - ALL the rest.

Enable Sideborders => enabled => try all resolutions, regardless of whether they are with side borders or not.
                          => disabled => try only resolutions without side borders

Don't force letterbox, disable sideborders: look only for resolutions that allow to scale game without side-borders, first check non-letterboxed ones, then, if failed, - letterboxed ones.
Force letterbox, disable sideborders: look only for resolutions that allow to scale game without side-border, regardless of whether they need top&bottom borders or not.
Don't force letterbox, enable sideborders: look for ALL resolutions, but first check non-letterboxed ones, then, if failed, - letterboxed ones.
Force letterbox, enable sideborders: look for ALL resolutions.


This was in AGS for all those years btw.

Okay, I must admit that letterbox switch now works partially differently. In fact it does not make real sense anymore :D. Maybe change it to "enable/disable letterbox" instead of "force/don't force"?

Radiant

Yes, it was in AGS for a long time, but it didn't actually work until you fixed it :)

SMF spam blocked by CleanTalk