Game resizing weirdly!

Godot Version

4.2.2 Stable

Question

So I’m trying to create a game that takes place on a computer desktop, kind of similar to games like Home Safety Hotline & Hypnospace Outlaw. I am brand new to all this so forgive my ignorance. I figured I’d go for a resolution of 1024x768 because this was quite common in the 90s. So, I made my viewport in Godot this size and have been working with this ever since.

The problem that I am finding is that the game resizes very weird. I’ve heard this is because of fractional scaling, which makes sense… but if I manually scale the different sprites in the editor, they look just fine. For example, an icon on the desktop is 90x90 pixels, when I resize the game it seems to add pixels, take pixels away randomly, etc. Since the scene is so simple, I don’t have a camera or viewport or anything… I assume this is okay? The thing I keep going back to is looking at “Home Safety Hotline”, it seems to be in the 4:3 aspect ratio, and a similar resolution to what I’m doing, but it still looks great no matter how I resize the window. This is what I really want to achieve.

Sorry I can’t upload any attachments because I’m a new user, but any help is greatly appreciated. I’m hesitant to proceed with working on this until I’m positive that I can actually deliver a product to multiple devices.

Before anything, try updating your editor to Godot 4.3 - it reworks how low-res pixel rendering works in order to fix a few weird things, and this might be one of them.

Have you ever set the display/window/stretch/mode option in the project settings?

I can definitely give this a shot when I get home, I’ll post if that changes anything!

Hi, yeah I feel like I’ve tried just about every combination of options in the “Window” settings. I did also make sure to read the documentation on this, and still nothing in there seemed to help. I’m not home right now so I can’t say for sure but I think the settings that I had it on last were:
Mode: Viewport
Aspect: Expand
Scale Mode: Fractional

If I put the scale mode on Integer, the game inside the window doesn’t scale until I expand the window itself to double the size, (x2 scale). I’m not really sure what I’m missing here. Like for example if I open an icon in an image viewer, I can rescale freely without that weird pixel distortion. But I can’t seem to achieve this in the engine :frowning:

Hey just an update, I went ahead and updated my engine to 4.3 and I am still seeing the same issue!

I’d recommend using stretch mode “canvas_items” and scale mode “fractional”.

Make sure your textures are using “Linear” filtering, “Linear Mipmap” will work better if you do intend to scale textures down, this default can be found in the project settings as “Default Texture Filter” but may need be applied per-texture via import settings.

1 Like

This was pretty much the exact solution I was looking for, thank you. The “Linear Mipmap” really made the difference, I’ll definitely look into that some more. The images/viewport actually resizes how I would like it to now!

I noticed however, there is a small drop in quality pretty much as soon as it is sized up past the 1024x768 resolution. Is this just inherently how resizing images works, is there anything I can do to improve the quality, or would I simply need to make my art in a larger size for them to scale up? Like say someone with a 4k screen comes along and wants to put it in full screen, it would look pretty bad, no?

The trick with mipmaps is that your GPU doesn’t do a good job sampling shrunken textures, a mipmap is a pre-computed half resolution image, blending neighboring pixels into one color instead of “picking the nearest pixel” of the neighbors (linear sampling). It halfs the resolution again and again until reaching a 2x2 pixel image. This can be a lot of GPU memory if you have a 4K texture with mipmaps it’s now also a 2K, 1K, 512, 256, 128, 64, 32, 16, 8, 4, and 2 texture in your game. But there are plenty of games today with hundreds of 4K textures just for dirt and rocks, so I think it’s in your budget if you want to make a fistful of 4K icons.

Thanks a ton. Really super helpful and I have a great jumping off point to do some more research. Much appreciated!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.