Creating a resolution aspect ratio for widescreen/normal scr

For questions about using Classic.

Post » Fri Dec 04, 2009 10:00 pm

I've been trying to work out how to keep my Construct game from stretching horizontally on widescreen monitors in fullscreen mode. My game uses a 640x480 window with 200% zoom, meaning that it's displaying a 320x240 game view.

deadeye tried to help me out with the following PM:

[quote:1g6lf91x]You can use the SysInfo object to detect whether the player has a 4:3 or widescreen monitor before the game starts (by finding out what the desktop resolution is set to). Knowing that will allow you to zoom the screen to the proper proportions. I assume you want a 4:3 window in the middle of a black area no matter what the width of the monitor is, yes? Well, you can create that black area yourself on a layer above all others to mask out any excess, and show that black mask as needed depending on what the aspect ratio of the monitor is. You can pretty much shape the screen to whatever you want it to be. With a couple hours work you could get such a system into place, rather than waiting "a few months" for a feature that may or may not come.[/quote:1g6lf91x]

I have no idea what to do here really. Should I use a different standard resolution than 640x480? Where do I start with this workaround? I've gotten a lot of suggestions, but I'd really appreciate some help on this.

Thanks.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Fri Dec 04, 2009 10:11 pm

The way I read it. Imagine you've got two layers, one which displays on 4.3 displays, and one on 16:9 displays. Using the sysinfo you check which the user is running in and set that particular layer as visible.

It'll be a bit more in depth than that, but that's the general idea, far as I can tell.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Fri Dec 04, 2009 10:19 pm

Well I need more in-depth help than that because I am not really a programmer.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Fri Dec 04, 2009 10:33 pm

Regardless of the ratio, the vertical resolution will be 480. Find out the ratio of the monitor to determine what to set the horizontal resolution to (I'm not sure of the math). After setting the resolution, put an extra layer above all the others. Put black bars on the left and right covering the area past 0 and 640.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Sat Dec 05, 2009 3:09 am

Also, I tried creating my game with a native resolution of 640x400 in order to cater to the widescreen audience, but when going fullscreen I am told that the fullscreen mode of 640x400 is not supported, and that it will switch to the "next best" thing; 640x480.

I don't see how I'm ever going to solve this.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Sat Dec 05, 2009 3:59 am

What about a custom pixel shader, placed on a layer of it's own, over the entire game. You've seen how the lens and magnify shaders work, right? Then it would be entirely plausable to have a shader sitting over everything, which either stretches or shrinks in various directions while maintaining a specific ratio. I would think a type of refracting lens effect could do that in some way. And yes I'm aware this method wouldn't work for people with low end cards, but then, they're not likely to have fancy monitors requiring stuff like this, either.

Or make a version for every fullscreen resolution commonly used at the moment (more work, but if it's so important to have this thing then you wont mind will you?). Then it's up to them what they download. Do a special edition version in widescreen and a common version in regular mode. Embrace it, turn the problem into an excuse to create two versions of one game.

Or just create your game at 16:9 ratio but focus only in a 4:3 area in the middle. No different to how movies used to be done, when filmed in widescreen and then converted for 4:3 TV's. Use pan and scan to follow events in your game when in 4:3 mode.

Or use deadeye's method rather than dismissing it because you don't really understand it.

Or stop worrying about aspect ratio and finish the game first, by the time you've finished, there might be a proper solution available.


Really there's loads of solutions, but there isn't a fix everything button you can click, and there likely isn't going to be for some time.

[quote:1g6wm3dg]My game uses a 640x480 window with 200% zoom, meaning that it's displaying a 320x240 game view.[/quote:1g6wm3dg]

So that makes me think you're going for the retro look. Deadeyes method sounds like the best one for you.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Sat Dec 05, 2009 4:30 am

Solved it! Well sorta, it's basically doing what I already suggested, and using a bit of creativity, and some of what deadeye was onto as well.


I should point out that this will only work "properly" if your game is flip screen like the two I saw on your website, with the black guys. Course if your game scrolls then this whole aspect ratio thing is a farse because you so wouldn't need to worry about it. But even then, it would still work!



Ok this is what you do:

Make your layout the size of the largest fullscreen display currently available, don't worry this wont effect filesize or anything like that.

Create your game >>>>>>> AT THE CENTER OF THE LAYOUT <<<<<<< This is very important, it'll not work right if you don't do that. continue to make your game in 320x240.

Now, around your actual game window within a window. Create a border, a nice pretty graphical border, how it looks depends on your game. Put this border on the OUTSIDE of the 320x240 window. Because you never want your 4:3 users to see this border, it's not for them, it's too good for them and they're not allowed to see it.

Now then, create a tiled background, on the lowest layer. Make sure the tiled artwork matches your border you just made, so it looks like it's part of it. Cover the entire background with that tiled background image.

Right, by now you're looking at it and probably thinking "Nobody is going to play a tiny window like that on a huge resolution you idiot!!!" But that's cool, that's exactly what I want you to think, and if you're thinking that, then you've done this right so far.

What you need to do then, is create a layer which will sit above EVERY OTHER LAYER, it wont scroll it wont move, and it has to sit exactly over your 320x240 playing area, taking into account the borders too (hey maybe the 4:3 crowd will get to see those amazingly rendered borders afterall!) Add a pixel shader to it, magnify, or lens, up to you whichever works best.

Now the magic

By using sysinfo, you can get the height information, which you will then use to change the size of this magnifying layer, depending on whatever resolution the user is running in. You'll have to use some math to get the width correct, but I'm sure someone else will be able to help on that score.

You may have to tweak the size of your magnifying lens somewhat, to get it working right, it may not be as straight forward as just giving it a height to use.

What you'll end up with, is a playing area which is always as high as the users resolution, and if you did it right, two nice borders down either side, and a tiled background to fill in the extra space, which using this method, wouldn't be much wasted space really, unless they've got some weird super wide monitor or something.

As for the 4:3 users. Well it all depends really how the magnifying layer behaves on those displays, so it may just be a case of putting things in groups and turning off the magnifying layer and turning on a regular window set size group, depending on whatever resolution they're running at. And I'm pretty sure that's entirely possible too.

I dunno, tested it and it seemed to work ok to me. So give it a go, see how it works for you.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Sat Dec 05, 2009 6:05 pm

[quote="Drule":2lgp2ags]Also, I tried creating my game with a native resolution of 640x400 in order to cater to the widescreen audience[/quote:2lgp2ags]

No modern monitor that I know of will be able to support that at fullscreen. In fact, the lowest resolution available for my monitor is 800x600, which is 4:3, so if your game is made at 640x480 then it will scale up just fine.

Anyway, I don't really have anything to do this morning so I guess I could try to make an example file. After I've had my coffee and read the forums, that is :P
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Dec 05, 2009 8:45 pm

Thanks for taking the time to help me. I appreciate it!

Lost my Keys I will play around with your example tonight. There are a few things I'm unsure about, but I won't knock it until I've tried it... or at least tried trying it!

I'm looking forward to an example from deadeye as well. :-)

So yeah, thanks.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Sat Dec 05, 2009 9:54 pm

I already caught Drule in chat but I will post my solution here in case anyone else wants to check it out.

It turns out that this was much more painless than I though... apparently you don't even need to bother with checking the aspect ratio at all!

If the resolution for your game is 320x240 then Construct will pick the lowest resolution available when you go to fullscreen. For most modern monitors that will be 800x600.

All I did was this:



And it just worked. Widescreen monitors will show your game 4:3 centered in the middle with black on either side. This uses Unbounded Scrolling on a 320x240 game. The clamp() expression is necessary to scroll to the proper location because when you zoom layers like that then the scrolling goes all funky (if it's not unbounded then your player goes off the screen, and if it is unbounded then your player is always centered and you can see outside the layout). Anyway, the clamp() thing fixes it.

If you want to fullscreen a letterboxed 16:9 game on a 4:3 monitor though, that's a totally different story :P
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests