Adventure Game Studio | Forums

Creative Production => Critics' Lounge => Topic started by: Monsieur OUXX on 12 Feb 2020, 10:03

Title: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 12 Feb 2020, 10:03
I'm wondering what would be the best way to achieve this :
- The AGS game is 640x400 (or more, whatever). To keep it simple, we stick to a resolution that is a multiple of 320x200.
- You want it to look like a 320x200 game.

How would you do that?

The easy answer :
- import every background scaled 2x
- import every sprite scaled 2x
- etc. Everything 2x!
- Align sprites on a 320x200 grid instead of the game's real resolution. (in other words: if your game is 640x400 then don't use odd numbers coordinates)


The challenges :

- Character scaling : instead of having a walkable area that lets the character go "from 80% to 100%", you'll set it to "160% to 200%". Simple. But then the scaling won't be "nearest neighbour in 320x200"; When the sprite walks around at 160%, you will see that the sprite is actually at a higher resolution than 320x200 (if you're familiar with scaling issues you'll know what I mean).
- character positioning : the character can stop at "half" pixels.

Allowed cheats :
- it doesn't matter of the room's scrolling stops at "half pixels"
- it doesn't matter if tweens make use of half pixels

So in the end it's actually two questions :
1) Am I missing a challenge? Something that will be extremely time consuming?
2) Do you have ideas on how to make it look "more authentic" in general?

Title: Re: [Discussion] best way to fake-downscale your game.
Post by: eri0o on 12 Feb 2020, 10:20
Do everything at 320x200, and set the viewport as the screen size and camera at 320x200.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 12 Feb 2020, 12:52
Do everything at 320x200, and set the viewport as the screen size and camera at 320x200.

I didn't understand.

Let me know if I understood properly :
- the game is 640x400
- the room is ... 320x200? 640x400?
- the viewport is 320x200

Are you saying that the viewport is rendered automatically scaled up when it's smaller than the game's window?
Would your solution still allow me to position some elements, let's say, at 401 pixels ? (making them appear inbetween 200 and 201 pixels in the fake 320x200 resolution)
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: eri0o on 12 Feb 2020, 13:16
The room can be any size you want, place the following code in your global script:

Code: Adventure Game Studio
  1. function game_start()
  2. {
  3.   Game.Camera.Width = 320;
  4.   Game.Camera.Height = 200;
  5.   Screen.Viewport.X = 0;
  6.   Screen.Viewport.Y = 0;
  7.   Screen.Viewport.Width = 640;
  8.   Screen.Viewport.Height = 400;
  9. }
  10.  

For more info see:
https://adventuregamestudio.github.io/ags-manual/Camera.html
https://adventuregamestudio.github.io/ags-manual/Viewport.html
https://adventuregamestudio.github.io/ags-manual/Game.html#gamecamera
https://adventuregamestudio.github.io/ags-manual/Screen.html#screenviewport

Sorry, I don't have much time to explain.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Cassiebsg on 12 Feb 2020, 13:44
Keep in mind that is only valid for 3.5.x, previous versions won't do that.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 12 Feb 2020, 14:25
eri0o your solution is quite elegant (love it! I didn't realize the the camera's size is now a thing)

It allows this :
- place a GUI on a half pixel

However it forbids this :
- place an object in the room on a half pixel

The latter would be nice to make smooth scrolling even smoother.

More ideas on how to fake-downscale a game with minimal effort and minimal supersampling ugliness?
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: eri0o on 12 Feb 2020, 14:43
Some future version of AGS will have object Scaling (code is already in) and character already has scaling. You can make the background an object too so you can scale it. You will still need to supply a blank background of the size you want the room to be.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 12 Feb 2020, 15:21
Some future version of AGS will have object Scaling (code is already in) and character already has scaling. You can make the background an object too so you can scale it. You will still need to supply a blank background of the size you want the room to be.

OK so it's basically back to the original solution : Upscale everything on screen to x2, either beforehand (scaled up sprite) or dynamically (scaled up character). With the issue that a character might be scaled up to only 150% instead of 200% (if he's walking on a walkable area where the character is not meant to be at full size) and then the mixed resolution is slightly visible to the player.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: eri0o on 12 Feb 2020, 15:27
If you don't want half scaling, you just don't set it. If you set it to 50% (cEgo.Scaling = 50 with manual scaling set) on any AGS game you get mixed pixels if you are not using the software renderer. I think I am missing something here...
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Crimson Wizard on 12 Feb 2020, 20:50
This could be solved easily if AGS had a scene node feature with parent-to-child connection of elements.

In that case camera and viewport stays the same (640x400), but the room "base node" is set to x2 scaling, which scales everything in this room without any additional manipulations.

...but, alas, this all is only in consideration atm.


With the issue that a character might be scaled up to only 150% instead of 200% (if he's walking on a walkable area where the character is not meant to be at full size) and then the mixed resolution is slightly visible to the player.

The only stupid problem that prevents from supporting over 200 scale for a character at the moment is that the character's walking speed in AGS is calculated from scaling using non-trivial conversion (without proper formula). If that is solved, the rest is just a matter of fixing the restricting condition.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Khris on 12 Feb 2020, 23:18
I'm curious about one thing: why create a bigger game in the first place? Why not create an actual 320 game?
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: morganw on 13 Feb 2020, 01:08
I think to get smooth scrolling and movement, that is the equivalent of sub-pixel placement.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 13 Feb 2020, 14:09
I'm curious about one thing: why create a bigger game in the first place? Why not create an actual 320 game?

There is a handful of elements for which I'd like sub-pixel positioning.
Mostly :
- Fonts for complex translations (Chinese characters)
- smooth scrolling of both the scene and the potential parallax (the background moves slowly and 320x200 makes it look jaggy)
- GUI movements (fancy buttons or areas moving smoothly)
- hi resolution debug interface with a lot of data to pack in a small screen

Just the same way 32-bit colors can be used to achieve "luxury" VGA (transparency, etc.), sub-pixel positioning could be used to achieve "luxury" low-resolution games.

Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 13 Feb 2020, 14:12
If you set character scaling to 50% with Direct3D9, then you get mixed resolution

I that still true? I thought this had been "fixed" a million years ago?
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: morganw on 13 Feb 2020, 17:54
If you set character scaling to 50% with Direct3D9, then you get mixed resolution

I that still true? I thought this had been "fixed" a million years ago?

It is configurable using the option 'render_at_screenres', and you can also lock the option in winsetup if you want to enforce the setting for artistic purposes.
https://github.com/adventuregamestudio/ags/blob/master/OPTIONS.md (https://github.com/adventuregamestudio/ags/blob/master/OPTIONS.md)
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 14 Feb 2020, 11:57
The game "Feria d'Arles" does exactly what I want to achieve. And they didn't bother with the mixed resolutions when the character is downscaled.
I'll contact its makers and see if there's any hidden difficulty.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Privateer Puddin' on 14 Feb 2020, 12:16
Feria is a 320x200 game.

For the title screen / options, I have a 1920x1080 sprite (character) which I manually scale at 17% (roughly 320x200, think in reality it's like 16.x%) and then just enable the option to render sprites at screen resolution. If the player is playing at something above 320x200, they'll benefit from higher res on those screens.

So I'm not sure it's doing what you want.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Danvzare on 14 Feb 2020, 14:36
I love how there's a whole topic about how to make a game with sub-pixels on a forum where I'm fairly sure most people hate the concept of mismatched pixel resolutions.
It gives me this warm feeling.  :-D

If you set character scaling to 50% with Direct3D9, then you get mixed resolution

I that still true? I thought this had been "fixed" a million years ago?
Yeah, it's true. Firstly, it wasn't that long ago that it was "fixed" and secondly, I distinctly remember arguing that it should always be available to everyone from the external setup menu, rather than being left up to the game developer. Mostly because like you said, it's feels like a luxury option. Some people might hate it, but others rather like it.
Besides, I've never been a fan of artistic vision. But that's getting off topic.
I think it's only available from the general settings when you're making the game. So I lost that battle. But at least it's an option.

- Fonts for complex translations (Chinese characters)
Hey, like the FM-Towns version of Zak McKracken!

Also, word of advice. If it's smooth scrolling you want, make sure to turn off the moonwalking fix for the characters. You know, the thing where they only move every time the frame updates. I've done it with all of my games, and even made fun of people who don't in my latest game (which I don't think anyone noticed). If you get the animation speed and the movement speed just right, it looks smooth, and doesn't look like they're moonwalking.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Crimson Wizard on 14 Feb 2020, 17:15
I think it's only available from the general settings when you're making the game. So I lost that battle. But at least it's an option.

It's configurable by player in winsetup, unless explicitly locked in general settings.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Monsieur OUXX on 25 Feb 2020, 22:22
Feria is a 320x200 game.

For the title screen / options, I have a 1920x1080 sprite (character) which I manually scale at 17% (roughly 320x200, think in reality it's like 16.x%) and then just enable the option to render sprites at screen resolution. If the player is playing at something above 320x200, they'll benefit from higher res on those screens.

So I'm not sure it's doing what you want.

You scoundrel! That was a plan B that I briefly considered but then I got scared that the hack would break with some unforeseen AGS update!
I never thought that Feria d'Arles worked like that. You have a gazillion hi-res GUIs with animated buttons!

@Danvzare : thanks for the tips
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: InCreator on 25 Mar 2020, 03:28
320x200 is pretty arbitrary thing to follow. I mean, why care, unless you go super duper retro?

I'm making Born Punk in 384x216 -- strictly because it scales well with 1:1 pixel aspect ratio and integer scale.

5X for 1920x1080, 6x for 4K. Resolutions heavy majority of players will have. And original size is still pretty close to 320x200.



 
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Snarky on 25 Mar 2020, 11:05
5X for 1920x1080, 6x for 4K. Resolutions heavy majority of players will have.

If by "heavy majority" you mean just above 20% (https://gs.statcounter.com/screen-resolution-stats/desktop/worldwide).
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Danvzare on 25 Mar 2020, 17:30
5X for 1920x1080, 6x for 4K. Resolutions heavy majority of players will have.

If by "heavy majority" you mean just above 20% (https://gs.statcounter.com/screen-resolution-stats/desktop/worldwide).
Will someone please tell me how on earth 1536x864 is fourth place?
I've never even heard of that resolution until today!

Ok... moving along from that surprise.
Hmm... if I had to take an educated guess, I'd say that 1366x768 is number 1, simply because people prefer laptop computers over desktop computers.
1920x1080 is a close enough second though, so it would makes sense to have that be your target resolution. But I guess it depends on who you expect to be your audience. If you consider that the number 1 most common resolution for mobiles is 360x640, and that is perfectly scalable to 1920x1080 (when in landscape mode). I think it's safe to say that the best resolution for a modern pixel art game would be half the phone one at 320x180. A resolution I've actually heard a few people use.

Personally, I'm more of a fan of 320x200, simply out of a sense of tradition more than practicality.

384x216... uh... yeah, sure. If you love it, keep it.  (nod)
Don't ever let anyone tell you otherwise.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: morganw on 25 Mar 2020, 19:34
Will someone please tell me how on earth 1536x864 is fourth place?
It is 1920x1080 with scaling set to 125% for a high DPI screen. Game engines generally don't use the OS level display scaling, it is more a compatibility shim for applications that aren't DPI aware. So given that wherever this data is coming from is likely giving inconsistent results (at very the least not giving the actual screen resolution in some cases, and "other" is apparently a very significant resolution too) you are probably better to look at sales figures for screen sizes, rather than what is detected by passive means.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Snarky on 26 Mar 2020, 07:13
It is 1920x1080 with scaling set to 125% for a high DPI screen. Game engines generally don't use the OS level display scaling, it is more a compatibility shim for applications that aren't DPI aware. So given that wherever this data is coming from is likely giving inconsistent results (at very the least not giving the actual screen resolution in some cases, and "other" is apparently a very significant resolution too) you are probably better to look at sales figures for screen sizes, rather than what is detected by passive means.

The problem with looking at sales numbers is that a large (but hard to estimate) proportion of users are using older screens/devices. For example, I'm typing this on a laptop from 2013 (resolution: 2560x1600), which I see absolutely no reason to upgrade for probably at least another couple of years, as long as it doesn't break.

Good catch on the scaling, but it should be pretty easy to tell in most cases which of the entries are actual monitor resolutions and which are scaled versions. And yeah, there's a large "other" category (which includes every monitor I have had since at least 2004), but if those aren't each individually much more than the 3–4% of the lower-ranked resolutions here they're probably not worth targeting.
Title: Re: [Discussion] best way to fake-downscale your game.
Post by: Danvzare on 26 Mar 2020, 16:26
The problem with looking at sales numbers is that a large (but hard to estimate) proportion of users are using older screens/devices. For example, I'm typing this on a laptop from 2013 (resolution: 2560x1600), which I see absolutely no reason to upgrade for probably at least another couple of years, as long as it doesn't break.
My monitor is from 2009 I think. It runs at a maximum of 1440x900 resolution, but it sometimes bugs out on some games when I run it at that resolution, with the monitor saying "frequency out of range". It seems to be random on whether or not it'll bug out, and it's only a very small subset of games that does it. Prison Architect and ZDoom are the only ones that currently come to mind.

But yeah, I've been using this monitor for years, and I've got no intention of changing it. The picture is clear and it works. It'll likely continue working for several more decades as well.
And don't get me started on the monitor from the 90s I have in the attic. Because I'll gladly switch to that thing if this monitor breaks. I think that monitor has a maximum resolution of 1280x1024.