Jibble

Author Topic: [Discussion] best way to fake-downscale your game.  (Read 412 times)

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
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?

 

Re: [Discussion] best way to fake-downscale your game.
« Reply #1 on: 12 Feb 2020, 10:20 »
Do everything at 320x200, and set the viewport as the screen size and camera at 320x200.

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #2 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)
« Last Edit: 12 Feb 2020, 12:55 by Monsieur OUXX »
 

Re: [Discussion] best way to fake-downscale your game.
« Reply #3 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.

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    •  
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #4 on: 12 Feb 2020, 13:44 »
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

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #5 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?
 

Re: [Discussion] best way to fake-downscale your game.
« Reply #6 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.

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #7 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.
 

Re: [Discussion] best way to fake-downscale your game.
« Reply #8 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...

Re: [Discussion] best way to fake-downscale your game.
« Reply #9 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.
« Last Edit: 12 Feb 2020, 23:01 by Crimson Wizard »

Khris

  • partook in silencing a crtitc despite facts
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #10 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?
Fail at Floaty Rog' now!  still having to deal with what games are going through

Re: [Discussion] best way to fake-downscale your game.
« Reply #11 on: 13 Feb 2020, 01:08 »
I think to get smooth scrolling and movement, that is the equivalent of sub-pixel placement.

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #12 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.

 

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #13 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?
 

Re: [Discussion] best way to fake-downscale your game.
« Reply #14 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

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #15 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.
 

Privateer Puddin'

  • Mittens Viscount
  • bob
    • Privateer Puddin' worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #16 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.

Danvzare

  • The Man with No Name
    • I can help with AGS tutoring
    • I can help with proof reading
    • I can help with scripting
    • I can help with voice acting
    • Danvzare worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #17 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.
« Last Edit: 14 Feb 2020, 14:42 by Danvzare »

Re: [Discussion] best way to fake-downscale your game.
« Reply #18 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.
« Last Edit: 14 Feb 2020, 17:18 by Crimson Wizard »

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: [Discussion] best way to fake-downscale your game.
« Reply #19 on: Yesterday at 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
« Last Edit: Yesterday at 22:24 by Monsieur OUXX »