Page 1 of 1

Fixing screen resolution ideas

Posted: Tue Oct 12, 2021 12:20 am
by Gunroar:Cannon()
So I got a complaint about the screen resolution from one guy who played my game in its bare stage (Dust: Battle Beneath)
I'm not sure what resolution it's meant to be in, but on my 1920x1080, the avatar was barely a centimeter tall and I saw the entire level - kinda felt like its zoomed out (but I dont know).
(I work on a 1280x800 resolution screen)

Now I'm wondering whether anyone has any ideas or advice on fixing screen resolution. Like, for example, should I go with using a camera...
In that everything is drawn to a canvas at a base resolution and then that canvas is scaled to the final screen using the nearest filter mode. This is how a chunky pixel look can be achieved and it's generally how pixel art is scaled in games.
...or using something like "push"?
Should I also scale ui or should I use the methof where I make all the ui relative to the real screen width (e.g.Button.w=screenWidth*.7)?
And what's pixel perfect?

Re: Fixing screen resolution ideas

Posted: Tue Oct 12, 2021 9:00 am
by togFox
I use this on EVERY project automatically.

https://love2d.org/wiki/TLfres

About four lines of code and you never ever need to think about it again.

Re: Fixing screen resolution ideas

Posted: Tue Oct 12, 2021 1:50 pm
by darkfrei
My multiresolution (even 4K) rendering:

Re: Fixing screen resolution ideas

Posted: Tue Oct 12, 2021 7:45 pm
by Gunroar:Cannon()
Hmmm, I'll check out TLfres. So I should also scale ui? How would I make a camera work+tlfres/a scaling lib?

@darkfrei, how does it work?

Re: Fixing screen resolution ideas

Posted: Tue Oct 12, 2021 9:12 pm
by darkfrei
Gunroar:Cannon() wrote: Tue Oct 12, 2021 7:45 pm Hmmm, I'll check out TLfres. So I should also scale ui? How would I make a camera work+tlfres/a scaling lib?

@darkfrei, how does it work?
It makes a virtual 1920x1080 screen and moves/scales this resolution to the current window. Also you can make any high-resolution canvases and render it too, so it will be shown as native resolution on 4K monitors. Press F11 to set the fullscreen mode.

Re: Fixing screen resolution ideas

Posted: Thu Oct 14, 2021 2:26 am
by knorke
Gunroar:Cannon() wrote: Tue Oct 12, 2021 12:20 amAnd what's pixel perfect?
I think in this context it usually means two things:
1) 1:1 aspect ratios: Pixels are squares.
For example a fullscreen-game with 4:3 resolution shown as fullscreen on a widescreen 16:9 monitor would stretch the picture. So it would not be pixel perfect because now the pixels are stretched rectangles instead of squares.
One way to fix it would be letterboxes / pillarboxes.

2) One rendered pixel maps excactly to one hardware-pixel of the display. For example the game is 800x600 and the display is 800x600 too. If the display is 1600x1200 then it would still be pixelperfect, just that each rendered pixel gets shown as 2x2 hardware pixels. But if the display is 1024x768 and the game is still 800x600 then it is not possible to have this 1-to-1 mapping of rendered pixels to hardware pixels: As result pixels/edges become blurry because the OS/graphic drivers try to find a compromise for showing one rendered pixel as 1.28 pixels wide.

I also use TLfres. There is forum thread too: https://love2d.org/forums/viewtopic.php ... lit=tlfres
So I should also scale ui?
Imo it depends on the game and UI. It can be annoying if the UI gets too small on high resolutions. In other cases it is welcome if the UI takes up less screen space. Also, when possible the UI should not only change size but imo also make use of the extra pixels.
Compare these two videos of C&C Tiberian:
https://www.youtube.com/watch?v=6wJUqhzhzTg
https://www.youtube.com/watch?v=zD9nPC7FdOs
Low resolution: The build-menu shows 7 lines.
High res: Now the menu has 10 lines.

Re: Fixing screen resolution ideas

Posted: Thu Oct 14, 2021 12:01 pm
by Gunroar:Cannon()
knorke wrote: Thu Oct 14, 2021 2:26 am ...
Wow, thnx for all the info, knorke!

The screen with the ui elements that I want to scale is like:

Image
For drawing the menu I use a relative screen size. Loke a button is love.graphics.getWidth()*.07, is that fine?