How large should I scale my art?

Hi! I’m making decent progress so far with a new project I’m working on using Nez. Last night I ran into an issue where when trying to move an entity very slowly, it wouldn’t move at all. I realized that this was because I was incrementing my entity’s position.X with a value less than 0.5, and because the renderer is trying to draw at whole pixels, it’s rounding down to zero. I was working with a render target size of 480 x 270 and a sprite with texture size of 114 x 37.

So, I tried again after scaling this art up 4X to a render target size of 1920 x 1080. This resulted in smoother movement at slower velocities, as expected.

My question is…is this good practice? To just scale all my art up 4X when I export it? Or is it really just personal preference with regard to how movement works? I realize that it’s possible to move slowly at the smaller render target, but it’ll just be far less smooth (for example, 1 pixel every 3 seconds).

Curious to hear how you all do things. Thanks for the read!

I struggled with this problem for a while. My solution was a viewport and a camera. This seemed to solve multiple problems at once.

I can draw sprites at their original resolution, and the viewport itself just gets scaled up to fit the window. I can also make sure that the viewport doesn’t compromise my game’s intended aspect ratio in order to fit in the window, so if the window size is ever off or if somebody’s playing in fullscreen on a monitor with a different aspect ratio, there’s black bars instead of a stretched image or revealing too much.

Also if you do this, and you use the texture drawing method with a Vector2 position instead of a Rectangle position, it will automatically smooth out your movement. If you play in a game window where the sprite appears 1:1 then it’ll be jumpy, but if you’re playing at say 3x or something, it’ll move as smoothly. In fact, it’ll move as smoothly as the resolution will allow it.

Here’s a code example for a camera and a viewport:

1 Like

If i go for smooth movement instead of per-pixel, won’t I lose the sharpness of the texture as it’s moving? Also…not totally sure how to do that with Nez.

Oh sorry, I missed the Nez part. I’m unfamiliar with Nez, so I’m not sure how to integrate it. Maybe Nez has its own method for this built in.

To answer your question: I don’t lose any sharpness. From what I can tell it moves per-pixel if you’re at the 1x resolution, but if you’re at a higher resolution it moves in-between “pixels”.