Handling multiple resolutions?

Started by
6 comments, last by Sik_the_hedgehog 11 years, 10 months ago
This is more of a general question, but I thought I'd point out that I'm using Lua.

My question is what's the best way to handle multiple resolutions while keeping my aspect ratio?

I used to think that by keeping the window sizes at 16:9 (my game's aspect ratio) , and going into fullscreen that the game would just add black borders without stretching and everything would be fine. This doesn't seem to be the case however as I'm getting mostly erratic behavior with that.

I did manage to get it working perfectly when setting the window size to the screen size before going into full screen. And while that works and keeps the aspect ratio, I feel that defeats some of the purpose of setting resolutions.

Don't older games have it so that, you could set to a lower resolution in the same aspect ratio, and you'd still see the same amount of stuff in the same screen area but since you made the graphics at a lower resolution they would be blurred but it would in turn be better for performance?

Is this worth pursuing or do most modern games now just set the window to the monitor size before going into full screen? That mean we'd only support one resolution in full screen, and that'd be whatever resolution your monitor is at, and add black borders where there is no game.

Any info/tips would be greatly appreciated! Thanks!
Advertisement
Unless there is a specific reason, I wouldn't force an aspect ration - there are people using 16:10 native resolutions, and even older 4:3 CRTs, that would prefer to use all the pixels at their disposal.

However, the resolutions available are a function of what's supported by the monitor. Functions that are useful include EnumDisplayDevices, EnumDisplaySettings, and ChangeDisplaySettings/ChangeDisplaySettingsEx.

Unless there is a specific reason, I wouldn't force an aspect ration - there are people using 16:10 native resolutions, and even older 4:3 CRTs, that would prefer to use all the pixels at their disposal.



I can't support more than 1 aspect ratio because then the graphics would be stretched in some way or another and that would look horrible. I'm trying to make it exactly like how when you watch a movie in full screen, there's always black bars on the top and bottom.

I can't support more than 1 aspect ratio because then the graphics would be stretched in some way or another and that would look horrible

You should, it is quite easy. You just need to separate the gui (more fix) from the game. When it is a 3d game, you just need to the the ratio according to your game resolution, if you have a 2d game, just display more. Problems occurred only if you have fix background images (i.e. an adventure game), in this case I would choose a minimum aspect ration and fill the rest with either placeholder art or with a larger background image.
When it comes to gui, try to use dockable gui elements, that is, instead of setting the healthbar at an absolute position, use a system like this: 3 pixels from the bottom and 5 pixel from the left, this way it is screen independent.

Here are two comparision shots, one at 1280x720(16:9) and one at 1680x1050(16:10), the 3d world is adjusted, the gui elements are fix (no scaling):
screenshot_05_2012_01.jpg

screenshot_04_2012_09.jpg
I can see where he's coming from with the whole aspect ratio thing though, for some kind of games having a different aspect ratio can be considered an advantage/disadvantage because the player can see more/less. If this gets really serious then forcing the aspect ratio (and adding padding as needed) could be considered a good idea.

And regarding the first post: yes, supporting multiple resolutions is always good. First because on weaker systems the user may want to reduce the resolution, and then because some users hate having to use any resolution that isn't the native one of the monitor because the stretching can make everything look horrible. Some people can tolerate that, some can't.

Also, if you do support multiple aspect ratios, don't get limited to 4:3, 16:10 and 16:9, make the game support any ratio it stumbles with, because you never know what you may end up with. 1280×1024 comes to mind, which has a ratio of 5:4 (even more square than 4:3!).
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

I can see where he's coming from with the whole aspect ratio thing though, for some kind of games having a different aspect ratio can be considered an advantage/disadvantage because the player can see more/less. If this gets really serious then forcing the aspect ratio (and adding padding as needed) could be considered a good idea.


Yeah, that's what I was thinking of.

Interesting post Ashaman! It's a 2D game by the way.

I guess the only reason I was having doubts is that, no matter what language I used, the only resolution on which fullscreen worked perfectly was the monitor's native resolution, which makes sense.

I think it's cleared up now but if anyone wants to post any more info, feel free to do so!
I just set the viewport to keep the game aspect ratio (aka black borders)
I think it's cleared up now but if anyone wants to post any more info, feel free to do so!

Well, if it's feasible, instead of using black borders you could use extra artwork (probably designed to tile or to blend against a single color or something) so it looks nicer. But that's really just a matter of polishing, and if you already have code for adding black borders then it shouldn't be too hard to add that. The artwork would have to change depending on what's going on at the moment though (e.g. in-game, menu, etc.).

Not really something critical, I would consider it low priority.
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

This topic is closed to new replies.

Advertisement