Glitched pixels with viewport scale and low resolution

Godot Version

4.7.2 Stable

Question

I am making a game in a small resolution of 160x144 for a Game Jam which requires this. I have changed the viewport width and height to these values. I have the stretch mode set to viewport, and the scaling on integer. The rules of the Game Jam state I have to keep the resolution at this. However when I do this, it causes some artifacts.

Here is the character with the stretch mode set to viewport.

Here is what the character is meant to look like, with the canvas_items stretch mode.

I’m not sure if using the canvas_items violates the rules of the competition, and if I have to find a way to fix the artifacts.

This is the game jam for reference: GBJAM 14 - itch.io

You need to choose a resolution that is mutiples of say 1080p and then use integer scaling.

So for example you probably want, 192x108 for your main viewport with integer scaling set to 10 (no stretch mode).

Right but the rules state I have to use 160x144. Is there no way to have abnormal resolutions without experiencing these issues?

I found a solution for this. I added a rounding to the position of the player in my code

global_position = global_position.round()

And I also just made sure the sprites lined up on the pixel mark. Making the offset not centered in the sprite settings helped a lot, because the pixel snapping will keep the pixel art lined up.

Now I can have the stretch mode set to viewport with no problems