[Discussion] best way to fake-downscale your game.

Started by Monsieur OUXX, Wed 12/02/2020 10:03:59

Previous topic - Next topic

Monsieur OUXX

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?

 

eri0o

Do everything at 320x200, and set the viewport as the screen size and camera at 320x200.

Monsieur OUXX

#2
Quote from: eri0o on Wed 12/02/2020 10:20:24
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)
 

eri0o

The room can be any size you want, place the following code in your global script:

Code: ags
function game_start()
{
  Game.Camera.Width = 320;
  Game.Camera.Height = 200;
  Screen.Viewport.X = 0;
  Screen.Viewport.Y = 0;
  Screen.Viewport.Width = 640;
  Screen.Viewport.Height = 400;
}


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.

Cassiebsg

Keep in mind that is only valid for 3.5.x, previous versions won't do that.
There are those who believe that life here began out there...

Monsieur OUXX

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?
 

eri0o

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.

Monsieur OUXX

Quote from: eri0o on Wed 12/02/2020 14:43:47
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.
 

eri0o

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...

Crimson Wizard

#9
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.


Quote from: Monsieur OUXX on Wed 12/02/2020 15:21:01With 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.

Khris

I'm curious about one thing: why create a bigger game in the first place? Why not create an actual 320 game?

morganw

I think to get smooth scrolling and movement, that is the equivalent of sub-pixel placement.

Monsieur OUXX

Quote from: Khris on Wed 12/02/2020 23:18:38
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.

 

Monsieur OUXX

Quote from: eri0o on Wed 12/02/2020 15:27:22
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?
 

morganw

Quote from: Monsieur OUXX on Thu 13/02/2020 14:12:27
Quote from: eri0o on Wed 12/02/2020 15:27:22
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

Monsieur OUXX

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.
 

Privateer Puddin'

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.

Danvzare

#17
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

Quote from: Monsieur OUXX on Thu 13/02/2020 14:12:27
Quote from: eri0o on Wed 12/02/2020 15:27:22
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.

Quote from: Monsieur OUXX on Thu 13/02/2020 14:09:48
- 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.

Crimson Wizard

#18
Quote from: Danvzare on Fri 14/02/2020 14:36:53
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.

Monsieur OUXX

#19
Quote from: Privateer Puddin' on Fri 14/02/2020 12:16:03
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
 

SMF spam blocked by CleanTalk