Other Resolutions.

Started by Calin Leafshade, Sat 29/12/2012 18:09:41

Previous topic - Next topic

Crimson Wizard

Since I was asked by Ascovel about this, also FYI.
I checked the repository I previously mentioned: http://www.adventuregamestudio.co.uk/forums/index.php?topic=48278.msg636455388#msg636455388

The custom resolution code there is essentially the SkyGoblin's one, just little changed to match code style of our repository it was applied on.

The real problem, however, is that it was merged with "develop" branch, which is in potentially unstable and untested state. For that reason I'd rather recommended to not use it.

Crimson Wizard

#41
I think Ali had troubles with widescreen mode, that's why he decided to program his own engine for Nelly 2?
I guess I am close to rewrite the way AGS renders game content to screen. First thing I did is dropped half of the graphics mode initialization code, including "letterbox" options.

My idea is to invert the logic of using scaling filters. At the moment the selected scaling filter define final resolution. While it is final resolution that should define which scaling filter to select. Setup should have following options:
- Display resolution
- Fullscreen (yes/no)
- Placement mode:

  • Place (just render starting from 0,0)
  • Center (center inside window)
  • Stretch (stretch to window)
  • Best fit (stretch proportionally as much as fits in the window) - this is the default option
- Scaling filter to use if necessary: nearest-neighbour (plain/AA), hq2x, hq3x.


Inside the game, there are 3 sizes defined:
1. Base game size - a resolution the game made with.
2. Game frame size - a target frame for scaling.
3. Display size - the real resolution.

The Game Frame rectangle is calculated based on combination of selected display resolution, base size and scaling filter.
For example, if scaling filter is hq2x or hq3x, the game obviously cannot be stretched to any size. It will be stretched to x2 or x3, as provided by filter, and then centered inside the window.
The normal scaling filter can stretch it to any size and proportions, therefore it is safest way to get proper letterbox and widescreen mode in fullscreen.

Luca

Quote from: Crimson Wizard on Wed 10/07/2013 18:23:19
I think Ali had troubles with widescreen mode, that's why he decided to program his own engine for Nelly 2?
What resolution does he use?
Indiana Jones : Archeology = Big Lebowski : Communication Sciences

Crimson Wizard

Quote from: ultralooca on Wed 10/07/2013 18:53:45
Quote from: Crimson Wizard on Wed 10/07/2013 18:23:19
I think Ali had troubles with widescreen mode, that's why he decided to program his own engine for Nelly 2?
What resolution does he use?
800x600.
The thread he started: http://www.adventuregamestudio.co.uk/forums/index.php?topic=48372.0

Ali

Quote from: Crimson Wizard on Wed 10/07/2013 18:23:19
I think Ali had troubles with widescreen mode, that's why he decided to program his own engine for Nelly 2?

I haven't started programming my own engine, I don't have the skills! What I was trying to do is something approaching what you describe in the post above, but the kickstarter campaign put my experiments on hold for a while. I got as far as placing an 800x600 window (unscaled) within a resolution of 1280x720, which would make the game playable at least.

I am increasingly interested interested in the idea of HD/widescreen resolutions. When you advise against the use of the Skygoblin branch, what are the dangers?

Snarky

Quote from: Crimson Wizard on Wed 10/07/2013 18:23:19
My idea is to invert the logic of using scaling filters. At the moment the selected scaling filter define final resolution. While it is final resolution that should define which scaling filter to select. Setup should have following options:
- Display resolution
- Fullscreen (yes/no)
- Placement mode:

  • Place (just render starting from 0,0)
  • Center (center inside window)
  • Stretch (stretch to window)
  • Best fit (stretch proportionally as much as fits in the window) - this is the default option
- Scaling filter to use if necessary: nearest-neighbour (plain/AA), hq2x, hq3x.


Inside the game, there are 3 sizes defined:
1. Base game size - a resolution the game made with.
2. Game frame size - a target frame for scaling.
3. Display size - the real resolution.

The Game Frame rectangle is calculated based on combination of selected display resolution, base size and scaling filter.
For example, if scaling filter is hq2x or hq3x, the game obviously cannot be stretched to any size. It will be stretched to x2 or x3, as provided by filter, and then centered inside the window.
The normal scaling filter can stretch it to any size and proportions, therefore it is safest way to get proper letterbox and widescreen mode in fullscreen.

It's great that you're trying to address some of the limitations with AGS graphic modes and scaling.

My concern with this approach is that it sounds like the user has to figure out what resolution to pick so that the game will fit the window/screen perfectly. For example, if I want to run a 320x240 game in hq4x, would I have to manually work out that that's 1280x960, and set that as my target resolution? (I personally would want to do this even in full-screen mode, since my video card is perfectly able to set those screen modes. And I always play in full-screen mode.)

I should also point out that it's perfectly possible to take an upscaled version of the game and stretch it (bilinearly or bicubically) to fit another, non-exact-multiple resolution, though you'll get some mild blurring.

Crimson Wizard

#46
Quote from: Snarky on Wed 10/07/2013 20:27:18
My concern with this approach is that it sounds like the user has to figure out what resolution to pick so that the game will fit the window/screen perfectly. For example, if I want to run a 320x240 game in hq4x, would I have to manually work out that that's 1280x960, and set that as my target resolution? (I personally would want to do this even in full-screen mode, since my video card is perfectly able to set those screen modes. And I always play in full-screen mode.)
Point is that user shouldn't calculate anything.
Imagine you have a setup dialog which tells you that game is 320x240. It also shows the list of resolutions your monitor/card supports, possibly setting your current display resolution as a default selection. It also shows a list of scaling filters you may use. If you want a "best fit" option, the setup will remove those filters that can't provide correct scaling.
For example if your game is 320x240 and your resolution choice is 1920x1080, the "best fit" game frame would be 1440x1080, which is 4.5 multiple. This means neither of the "Hq" filters will work, and only "free-scaling" filters will stay in the list. In 1920x1080 fullscreen this will look like "letterbox", game image having black side borders.
If you choose "Centered" placement, you will be able to select Hq4x then, which will make game view 1280x960, while keeping the very same display resolution. This way the game image will have both horizontal and vertical black borders.

E: Probably I wasn't clear enough: there won't be any "nearest-neighbour" x2, x3, x4 etc selection, there will be just "nearest-neighbour" with multiplier calculated automatically.

Alan v.Drake

#47
Allow me to interject,
Quote from: Crimson Wizard on Wed 10/07/2013 18:23:19
The Game Frame rectangle is calculated based on combination of selected display resolution, base size and scaling filter.
For example, if scaling filter is hq2x or hq3x, the game obviously cannot be stretched to any size. It will be stretched to x2 or x3, as provided by filter, and then centered inside the window.
The normal scaling filter can stretch it to any size and proportions, therefore it is safest way to get proper letterbox and widescreen mode in fullscreen.

The game obviously can and must be stretched to any size. The only case to argue about is when the display resolution is inferior than the game resolution (how to handle mouse position, since you wouldn't be able to tell exactly over what game pixel the mouse cursor is over).

"Best fit", like "Stretch", shouldn't hide filters, they should simply stretch the output after the filter is applied. At least, that's how it's usually done. ( Source -> Filter [-> Stretch to viewport] )

"Place" and "Center" are the only modes that would need a check so not to overstep the display boundaries.

- Alan

Crimson Wizard

Quote from: Alan v.Drake on Wed 10/07/2013 23:00:45
"Best fit", like "Stretch", shouldn't hide filters, they should simply stretch the output after the filter is applied. At least, that's how it's usually done. ( Source -> Filter [-> Stretch to viewport] )
I don't understand, how it is stretched "after filter is applied"? With some other filter? What is the purpose of the first filter then?

Snarky

Quote from: Crimson Wizard on Wed 10/07/2013 20:57:31
Point is that user shouldn't calculate anything.
Imagine you have a setup dialog which tells you that game is 320x240. It also shows the list of resolutions your monitor/card supports, possibly setting your current display resolution as a default selection. It also shows a list of scaling filters you may use. If you want a "best fit" option, the setup will remove those filters that can't provide correct scaling.
For example if your game is 320x240 and your resolution choice is 1920x1080, the "best fit" game frame would be 1440x1080, which is 4.5 multiple. This means neither of the "Hq" filters will work, and only "free-scaling" filters will stay in the list. In 1920x1080 fullscreen this will look like "letterbox", game image having black side borders.
If you choose "Centered" placement, you will be able to select Hq4x then, which will make game view 1280x960, while keeping the very same display resolution. This way the game image will have both horizontal and vertical black borders.

The thing is that that's not how I choose the graphics mode. I don't have my heart set on a specific resolution which then determines how to display the game. I want to display the game in a certain way (e.g. fullscreen, filling the entire proportional area of the screen, with hq3x), and then that determines what resolution is best. It would be very annoying to have to try different resolutions, only to find that some of them don't support the options I want, or only display the actual graphics in some portion of the screen, etc.

Quote from: Alan v.Drake on Wed 10/07/2013 23:00:45
The game obviously can and must be stretched to any size. The only case to argue about is when the display resolution is inferior than the game resolution (how to handle mouse position, since you wouldn't be able to tell exactly over what game pixel the mouse cursor is over).

"Best fit", like "Stretch", shouldn't hide filters, they should simply stretch the output after the filter is applied. At least, that's how it's usually done. ( Source -> Filter [-> Stretch to viewport] )

Yes, with the caveat that this should be optional, so if turned off the window would snap to the "integer multiple" sizes when you try to resize. That's how either DOSBox or ScummVM works on Windows.

Crimson Wizard

Alright, I am in confusion again. What is the right way then? Leave x2, x3, x4 etc selections?

Snarky

Quote from: Crimson Wizard on Wed 10/07/2013 23:11:54
Quote from: Alan v.Drake on Wed 10/07/2013 23:00:45
"Best fit", like "Stretch", shouldn't hide filters, they should simply stretch the output after the filter is applied. At least, that's how it's usually done. ( Source -> Filter [-> Stretch to viewport] )
I don't understand, how it is stretched "after filter is applied"? With some other filter? What is the purpose of the first filter then?

Once you've scaled up the graphics to 3x or higher, bilinear/bicubic scaling just introduces some slight softness to the pixel edges (essentially antialiasing). So if a hq5x canvas doesn't quite fit on the screen, for example, you can stretch down, or up to make it fullscreen if it was slightly too small, without major loss of quality.

You mentioned nearest-neighbor with antialiasing, which is essentially the same thing for that case. (A naive nearest-neighbor filter without antialiasing would look horrible on non-integer scaling ratios.)

Ali

Can I add another thought? Bearing in mind that AGS really should offer high/widescreen resolutions in the future, shouldn't the scaling process allow for that?

Hopefully one day, someone will try to run a 1920x1080 game on a 1280x720 monitor. Then the engine will need to scale down to accommodate that. I think it would be a real shame if these scaling and display improvements helped keep AGS locked in to dated resolutions.

Crimson Wizard

Quote from: Snarky on Wed 10/07/2013 23:26:44
The thing is that that's not how I choose the graphics mode. I don't have my heart set on a specific resolution which then determines how to display the game. I want to display the game in a certain way (e.g. fullscreen, filling the entire proportional area of the screen, with hq3x), and then that determines what resolution is best. It would be very annoying to have to try different resolutions, only to find that some of them don't support the options I want, or only display the actual graphics in some portion of the screen, etc.
So, does this mean there should be both way to choose display resolution to make filter match that resolution, and choose used filter & multiplier and make resolution match them? Some people may not care about which multiplier to use, they may want to just stretch the game over their current display?

Eric

Is it out of reach to have an option that stretches proportionately until the picture hits the limits on either the top and bottom, or left and right of the screen? Is that what others are asking for?

Crimson Wizard

Quote from: Eric on Thu 11/07/2013 01:21:47
Is it out of reach to have an option that stretches proportionately until the picture hits the limits on either the top and bottom, or left and right of the screen? Is that what others are asking for?
That's what I called "best fit":
Quote
Best fit (stretch proportionally as much as fits in the window) - this is the default option

I was thinking, maybe what Snarky asks for is "stretch window to the chosen game scale"?

Alan v.Drake

Quote from: Crimson Wizard on Wed 10/07/2013 23:11:54
Quote from: Alan v.Drake on Wed 10/07/2013 23:00:45
"Best fit", like "Stretch", shouldn't hide filters, they should simply stretch the output after the filter is applied. At least, that's how it's usually done. ( Source -> Filter [-> Stretch to viewport] )
I don't understand, how it is stretched "after filter is applied"? With some other filter? What is the purpose of the first filter then?

Using stretch_blit() for software rendering and StretchRect for direct3d IIRC.
The purpose of filters is to add fancyness, of course!

You don't even have to calculate multipliers since you can just stretch to whatever size you want. Unless you want to separate "Best fit" from "Stretch with aspect ratio" or make a "keep aspect ratio" checkbox only for the "Stretch" option. And who knows, would we need also a way to change aspect ratio so old 320x200 games show like 4:3 ? unnecessary burden

That reminds me, I could use a separate checkbox for "bilinear filtering", which is only tied to the stretching.
That way, for example, we could use a simple2x filter and then stretch with bilinear which makes low-res games look better, not too blurry, not too sharp.

I admit, I'm rooting for the way my favourite emulators handle the task, like Snes9x

- Alan

Crimson Wizard

Quote from: Alan v.Drake on Thu 11/07/2013 07:05:00
You don't even have to calculate multipliers since you can just stretch to whatever size you want.

We must calculate multipliers to know which virtual pixel mouse is over.

Alan v.Drake

Quote from: Crimson Wizard on Thu 11/07/2013 07:26:00
Quote from: Alan v.Drake on Thu 11/07/2013 07:05:00
You don't even have to calculate multipliers since you can just stretch to whatever size you want.

We must calculate multipliers to know which virtual pixel mouse is over.

Of course we need to do that.
I was referring to the calculation I thought you meant when you were talking about finding the best match for filters and multipliers, to make the image fit the screen but not completely.


Snarky

#59
Yeah, I also say we should look to how other programs do it. Here are my thoughts on how I would want it to work, though:

The most important thing is that this should all be dynamic, something you can change on the fly without restarting the game.

Settings:
-Filter (2x, 3x, hq2x, ... which gives an effective game resolution, and tells you what it is)
-Window/fullscreen (switch between window/fullscreen with Alt-Enter by default)
-Fullscreen resolution (defaults to your current resolution, maybe detects supported modes and lists those)
-Stretch mode (none/center, stretch, proportional/best fit, only pixel multiples)

If you set the stretch mode to "only pixel multiples", if you try to stretch the window it will snap to integer multiples of the native game resolution, and the only supported fullscreen resolutions will be those same dimensions. I'm agnostic about how it should display e.g. a 320x200 game that you've set to hq4x (so the effective resolution is 1280x800), and "only pixel multiples," in a 960x600 client area. Should it scale down the hq4x graphics, or should it switch intelligently to hq3x? (The point is moot for the basic 2x, 3x, 4x, 5x filters, since the results should be identical.)

SMF spam blocked by CleanTalk