Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Monsieur OUXX on Sun 01/10/2017 22:20:23

Title: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Monsieur OUXX on Sun 01/10/2017 22:20:23
if you're familiar with AGS, you know that under specific conditions (running a 320x200 game with Direct3D) you can have high-resolution characters in a low-resolution game. Some consider it a glitch, some like it, and at the end of the day the causes of that peculiarity is very well known (it has to do with allegro and all that).

But now, WHAT IF I did this :
- creating a 640x480 DynamicSprite (and of course drawing anything i want into its drawing surface)
- putting a dummy character in the bottom-middle of the screen, with the appropriate walkable area (which could be : no WA at all, or with a 50% scaling -- in this thought experiment i'm not sure what would work, i'd need to try)
- setting the view/loop/frame of that character to point to the dynamic sprite i mentionned earlier

...wouldn't i get high-resolution graphics in my low-res game? Now imagine that this would be a window of text or something that's better in high resolution (like a console or anything required in some special debug mode). Wouldn't that work?
Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Crimson Wizard on Sun 01/10/2017 22:47:42
Quote from: Monsieur OUXX on Sun 01/10/2017 22:20:23
if you're familiar with AGS, you know that under specific conditions (running a 320x200 game with Direct3D) you can have high-resolution characters in a low-resolution game. Some consider it a glothc, some like it, and at the end of the day the causes of that peculiarity is very well known (it has to do with allegro and all that).

Ok, just to elaborate.
The effect you are talking about is caused by following:
1) running a game in higher-resolution display mode. E.g. you have 320x200 game and you run it in 1280x720 window, or you have 800x600 game and you run it in 1920x1080 window, and so on.
2) when engine scales particular sprites it does so in the window pixels rather than native game pixels.
3) it has nothing to do with Allegro, BTW. This was simply caused by a mistake in drawing algorithm in Direct3D renderer.

The p2 is a core reason for this effect, because it makes it possible for pixels of a sprite to end up being of smaller size than the pixels of rest of the game, so the final sprite is rendered in higher res.

Not completely sure how result will look like, but I believe what you describe may worth a try: if you scale 640x400 sprite down 50% to 320x200 using this effect, it actually may keep higher-resolution (or even gain more resolution). One thing to remember though, this effect depends on display mode. That is, the lower display mode is, the less effect you gain.
Also, in 3.4.1 there is a switch in setup to turn it on and off.
Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Monsieur OUXX on Sun 01/10/2017 23:52:57
Thanks a lot for clarifying in such a condensed way.


Are characters the only in-game "entities" affected by this?
Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Monsieur OUXX on Mon 02/10/2017 01:07:06
OK so here is a quick, functional proof of concept

DOWNLOAD (https://drive.google.com/file/d/0B3l_KCc0vICzaW1TSl93QVJCYkE/view?usp=sharing)
Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: eri0o on Mon 02/10/2017 01:22:18
Hey! This is awesome! I love this possibility. I think higher resolution text is good for eading. :shocked:
Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Crimson Wizard on Mon 02/10/2017 02:01:11
Quote from: Monsieur OUXX on Sun 01/10/2017 23:52:57
Are characters the only in-game "entities" affected by this?

Characters and room objects.
Well, this is rather a misuse than a feature.
Normally there should be a way to define render resolution for different layers, e.g. one for room and another for UI, but AGS just does not have this.

Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Monsieur OUXX on Mon 02/10/2017 09:33:26
Quote from: Crimson Wizard on Mon 02/10/2017 02:01:11
Well, this is rather a misuse than a feature.
Yes totally. If I use it I'll use it for very specific purposes. Not to mention this can only be behind GUIs and can be animated only in repeatedly_execute_always, not repeatedly_execute


At the moment the only thing that annoys me is that the nearest-neighbour downscale is not uniformly 50% even though the dummy character's scaling is 50. It creates artifacts.
Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Snarky on Mon 02/10/2017 11:11:55
What scaling are you running your game at? If you're running at 3x, for example, you won't be able to do perfectly regular 50% scaling.
Title: Re: crazy proof of concept : inject 640x480 graphics into a 320x200 game, natively
Post by: Monsieur OUXX on Mon 02/10/2017 21:40:35
Quote from: Snarky on Mon 02/10/2017 11:11:55
If you're running at 3x, for example, you won't be able to do perfectly regular 50% scaling.
That's exactmy what I was doing (3x) and you're absolutely right.