Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Small 320x240 Screen, But Scaled To 640x480 ? - For Pixel Art 2D Retro RPG...

Author
Message
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 20th Jan 2020 20:55
Hi,

We plan on making a pixel art 2D retro RPG game soon...

Is there an easy method in AppGameKit Studio to do below?:
We want a small 320x240 screen, but scaled to 640x480.
(so a 640x480 screen where each pixel is double in size)

Is the above easy to do in AppGameKit Studio?
Let us know, thanks!

Jesse
JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 20th Jan 2020 21:28 Edited at: 20th Jan 2020 21:28
SetWindowSize(640, 480)
SetVirtualResolution(320, 240)


Or for a device;

SetWindowSize(GetMaxDeviceWidth() , GetMaxDeviceHeight())
SetVirtualResolution(GetMaxDeviceWidth() * 0.5, GetMaxDeviceHeight() * 0.5)

Also
SetDefaultMinFilter( 0 )
SetDefaultMagFilter( 0 )

For a pixely look
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 21st Jan 2020 00:04 Edited at: 21st Jan 2020 00:21
The only way (that I've found anyway) to achieve an authentic old-school pixel look in AppGameKit is by using an upscaled render image. This can get tricky if you're dealing with different screen resolutions, as render images ALWAYS use the full range of the screen (which in full screen mode is the entire monitor). Using Virtual Resolution won't work for this effect because it doesn't actually change the resolution you're rendering at. It only scales your sprites up to be the same relative size they would be at the given resolution. Any motion (rotation especially) will be far too "clear" to look authentic, as you won't get the level of aliasing you would at a lower resolution.

This example assumes that you specifically want to upscale 320x240 to a 640x480 window on a desktop platform.

JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 21st Jan 2020 00:52
Ah, good stuff - thanks!

Should be starting the pixel art 2D RPG in a couple of months..

Jesse
JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Jan 2020 02:58
If your just after a pixilation effect you could use a shader
Example of how one could use the resolution 1024 by 768 to create size 10 pixel chunks

Pixel shader
MerryChristmas Everyone
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 21st Jan 2020 09:19
I've played with pixel art graphics before too.
My preference is to set mag and min filters to zero and then zoom in.
Very easy!

Attachments

Login to view attachments
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 21st Jan 2020 18:57
Quote: "I've played with pixel art graphics before too.
My preference is to set mag and min filters to zero and then zoom in.
Very easy!"


It totally depends on what type of look you're going for of course. If the goal is a more modern "clean" pixel look then that works. But, if the goal is a more "authentic" old school console look (which is what I'm assuming OP is going for since they want to upscale a 240 render so that the actual pixels are bigger), then that won't quite do it. SetViewZoom only appears to scale up the sprites and doesn't change the resolution that they're rendered at, so you still won't get the aliasing and pixel-quantized motion that you would get with, say, an upscaled SNES or Megadrive/Genesis output.

I put together this quick comparison snippet using the sprite you provided. Click to change between zoomed and upscaled.



PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 21st Jan 2020 22:03 Edited at: 21st Jan 2020 22:03
@fubarpk : I don't think we can use GetImage() when using Vulkan, so we would have to use SetRenderToImage() instead. In any case, I'm getting a black screen at the moment.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Jan 2020 22:25 Edited at: 21st Jan 2020 22:36
@phemox just try and load an image and use the pixel shader for now
the code I snipped out of my pixelated labrynth
but below should work well for a 1024 by 768 image and screen
MerryChristmas Everyone
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 22nd Jan 2020 00:01 Edited at: 22nd Jan 2020 00:04
Yeah, thank you! It works when the 2D image has some content in it. Thanks. Shouldn't be too hard to use SetRenderToImage() with it. It does show a black screen when trying it fullscreen, but maybe I have to get rid of sync() and put some code in between render() and swap() instead. edit: Hendron's code already does this.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Jan 2020 01:07
your welcome
I wonder if set renderer to basic would fix that
MerryChristmas Everyone
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Jan 2020 02:01
I did that with the SkyRoads game
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 22nd Jan 2020 11:33
Quote: "I wonder if set renderer to basic would fix that"


I've tried that, but unfortunately it doesn't fix it.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 7th Feb 2020 06:04
While "Technically" most Modern Displays do support 640x480., this will only be possible Natively on a 1440p Panel.
People tend not to realise that there are 2 Resolution Sets that a Display Panel will support.

480×270 > 960×540 > 1920×1080 > 3840×2160 (Set A)
342×192 > 684×384 > 1366×768 > 2732×1536 (Set B)
320×180 > 640×360 > 1280×720 > 2560×1440 (Set C)

I'm aware these are typically used as if they're a "Single Resolution" Set... but remember LCD are Individual LED Points., as opposed to a Masked Electron Beam; and LEDs have a Finite Colour Range... this means that "Odd Resolutions" will be a loss of detail or calculated (logical) colour blending as opposed to optical (perceptual) colour blending.
This is why Resolution Scaling outside of the Power-of-Two has a bigger impact and appears to be more "Out of Focus" and "Unnatural" than on an Analog Display.

I won't do a deep dive into Displays and Optics here., instead just know that for whatever the "Native" Resolution of the Display ... it will fit into one of the three above Resolution Sets that you want to ALWAYS stick to in order to retain control over the Visual Output.
Now strictly speaking Set B and C are "close enough" that you can get away with some minor Resolution Scaling., but Set A is roughly +30% Scaling.

What's important to keep in mind is that using Hardware Resolution Scaling is always going to be "Problematic"., so instead what you want to do is create Sprite Sheets with Pre-Calculated Scaling.
In this regard you can (if necessary) clean up any artefacts produced by the process to keep the Art Clean and Crisp for the Resolutions... as such you want to aim to create 2 Sprite Sheets., one for 1080p and the other for 720p.
I've listed the "Lowest" Resolutions above., so you can use those as a Base to work from., then simply 200 / 400% Scale with Nearest Neighbour; this will keep the Pixilation intended.

Of course it's also important to keep in mind that with the Higher Resolutions., you also have to account for the larger pixel movement... but that can actually easily be done via a simple logic of (Result = Result * Scaling) and then just set Scaling based upon which Base Resolution (720/1080) is being used.
That way you can work with 720p as you're baseline and simply have an offset for 1080p.
And I'd argue this is the best approach to take., because you can't guarantee which Display Type the End User will have.
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 7th Feb 2020 19:33
@Raven: I take it you're talking about single pixel accuracy in those resolutions and the potential for 'blurring' images (or more specifically the edges of images really)? Because frankly, I've never noticed this difference. Especially not between 720p and 1080p. This makes sense though, as actually those are both 16:9 resolutions. You shouldn't need to use separate sprite sheets there, even when it does look crispier.
I've also noticed less and less monitors natively support 640x480 actually, which is a 4:3 ratio. They tend to already use scaling tricks if the monitor is a widescreen (classic WVGA up to 720p and full HD). Contrary to what you seem to suggest, the native aspect ratio isn't that fixed when only the highest resolution support would show 1:1 pixels. Some of the resolutions you mention, you will not find in monitors. It works because individual pixels are scaled, black borders are added when the aspect ratio is too far off from native aspect ratio and so on. A lot of times stretching in either one of the axis is hardly noticeable, unless we're talking about single pixel accuracy and how interpolation might fail. At super high resolutions, things can get weird as the monitor might attempt to use non-square scaled pixels in 17:9 ratio (2K/4K+). As you'd imagine, the end user would notice nothing from this.
Not that it matters much, but I think you're confusing 1440 x 1080 (4:3) with 2560 x 1440 (16:9). At least the sets seem to suggest as much. Only the second is 1440p. But only the monitor with the first resolution will do "true" native 640x480.

Login to post a reply

Server time is: 2024-03-28 13:24:26
Your offset time is: 2024-03-28 13:24:26