How hardware handles increased screen sizes (what I found)

Disclaimer: This post is for documentation and education purposes, to help someone who wonders about this same question in the future (if they know how to use the search bar)

I used an unmodified Adafruit PyGamer to conduct this experiment


I was recently wondering how hardware handles scaling the screen with this method:

namespace userconfig {
    export const ARCADE_SCREEN_WIDTH = <width>;
    export const ARCADE_SCREEN_HEIGHT = <height>;
}

This method works in the simulator (browser), but you obviously can’t display an image larger than 160x120 (MakeCode’s native resolution) on a 160x120 screen (the screen most arcade devices are equipped with).

So, I wanted to experiment and find out what happens if I try anyway. My hypotesis was that I was going to reach one of the following outcomes:

  1. The device panics and crashes
  2. The device crops the screen to display to show the top left 160x120 area
  3. The device crops the screen, but the middle instead of the top left
  4. Arcade compiles with 160x120 in mind and pretends that the resolution was never changed

If you don’t want to listen to my yapping, and just want an answer, it’s NUMBER 4
If you do, stick around for the rest of my “report”.

After testing this out, I came to a conclusion. First and foremost, the project in fact compiled to my PyGamer with no issues, so I can rule out number 1. After loading the following code to the device, it’s immediately apparent we’re looking at the top left corner, so number 3 is also out of the question.

image

The size in the simulator is set to 320x240
(Upon loading this example to the device, we can see the tan colored top left corner)

(It’s hard to tell due to the lighting, but the screen is entirely tan)

Finally, it’s up to decide between options 2 and 4. You might notice the added debug text that logs the screen size on both devices, and that’s the final piece of the puzzle: when the code is compiled for hardware, the custom resolution is completely ignored! Why? Because the userconfig settings are only meant for the simulator, and they’re usually unachievable on hardware anyway.


So, that concludes my experiment, and I hope it comes in handy at some point to somebody. If you want to add something, feel free to expand on this here in the replies if you have a device to do this on. It would be great if somebody would also test sprite and tilemap behaviour in these circumstances, becuase i’m just not bothered to do so.

Nerd yaps for way too long

Then, one final question remains: why? What is the point of this? Well, for one this post exists because it was on my todo list. However, the real point is practical application for bigger games/projects. Say, you want to enable simulator users to choose a bigger resolution for your game when playing in the browser, becuase you can. Now, you can’t change the resolution on runtime, but a possible solution is to use a method to check if you’re running in sim, and if you are just draw everything across the whole screen. Otherwise, draw everything to the top left 160x120 because that’s what you’re going to see on hardware or something along those lines. I would need to actually make that to verify it, but it sounds possible and that’s good enough for me.

That’s all I’ve got for today, toodles!

8 Likes

Interesting, considering I’m planning on making a HD (non-pixelated) game with this method.

2 Likes

This sounds really interesting! (pls try to verify this make this an extension it would be sooo helpful)

2 Likes

I did a similar test pretty much a year ago and got the same results .I guess you probably already know that you can still shrink the screen size(I have no idea why you would do that). One interesting piece of hardware is the elecfreaks retro arcade. When I changed the screen size it cropped it as does the pygamer. However, the screen resolution is actually 320x240 so changing the screen size should be able to work is we modify the bootloader or something. There is also the chance that the elecfreaks retro arcade resizes the screen in the hardware, not the software, so if that is the case than it would not be possible.

3 Likes

Awesome experiment! I love these long research posts : ) Good to know!

3 Likes

I don’t wanna kill your buzz, but if you’re considering 1080p or 720p resolutions, I doubt that’s possible. It would probably be incredibly laggy, and images in the editor can scale up to 512x512.

Also, editing them would be a misery because arcade starts suffering when you’re editing big pics, so yeah…

4 Likes

Yeah sprites from 200x200 get real laggy in the image editor

4 Likes

Oh ok lol. Better truth than consequences. Thanks Mr. @Sarge.

3 Likes

Also, here’s the experimental project I used for this, I forgot to share it

2 Likes