Libgdx -2D Tile game - Scaling images with resolution?

If I am using all my graphics for 1024x768 resolution, how can I make it so that if I change the resolution, my images scale up/down in the correct ratio?
I know how to do it with images who fill out the whole screen with Gdx.getScreenWidth etc.
But how can I scale the smaller images like enemies etc?

Another thing, how do I keep the viewsize of my game the same? I draw my map from 2D int Array. Tiles are 64x64 big.
With 1024x768 resolution I can look like 15 tiles left and right. 8 tiles up and down.

But if I change resolution to 1920x1080 I can watch like 30 tiles around the player. I want thatthe vision radius stays the same as in standart resolution so its fair for everyone.

There’s a few different strategies you can use.

The ideal is to have 2-3 sizes of images, then based off the screen size and pixel density choose the best image and then its a minimal stretch to fill the screen.

What I’ve mostly done has been to pick a base resolution that is somewhere in the middle.
Then, do the calculation for widescreen or portrait
then, calculate the Xratio, and the Y ratio
then use one or the other ratio to scale the image sizes

Since your display is all on the assumption of the base resolution it scales.

I find its best not to work in pixel sizes… I make a camera which is 16 units tall, and X units wide - where X is enough to fit the screen width for the aspect ratio.


    final float VIEWPORT_HEIGHT = 16.0f;

    float aspectRatio = (float)Gdx.graphics.getWidth() / (float)Gdx.graphics.getHeight();
    cam = new OrthographicCamera(VIEWPORT_HEIGHT * aspectRatio, VIEWPORT_HEIGHT);

Now since the camera is always 16 units tall, if I draw a sprite with a size of {1, 1}, I can be certain that the sprite will fill 1/16th of the vertical size of the screen no matter what the actual display resolution is.

The only remaining problem is dealing with choosing appropriate sizes for the actual assets to minimize any visible scaling artifacts, since its not likely that anything will ever be rendered at a 1:1 pixel ratio.