Resolution Scaling

For questions about using Classic.

Post » Mon Aug 10, 2009 6:56 pm

Okay, I've been trying this out for a while, and am still not sure how to go about it, or if it is impossible to do in Construct.

I'm designing a game at 16:10 widescreen resolution, 1440 x 900. The game runs in full-screen. Obviously, on a 16:10 monitor, it displays on the full screen, and what I'd like to happen is, on dfferent resolutions (16:9, 4:3), for the game to run in 16:10 resolution with black bars at the top and bottom, so none of the objects are stretched. This currently doesn't seem possible to do.

At the moment, if I try and run an app with a native 16:10 resolution in fullscreen on a non-16:10 monitor, it doesn't even open, citing a DirectX issue. I can make the app in 4:3 resolution, and it will open on widescreen monitors, but the display is stretched. I hate it when games do that :evil:

Does anyone have any idea how I can make this work? Is it achievable with layer zooming, and if so, how, as I've had no luck using this method so far.

Many thanks,
- Tom
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Mon Aug 10, 2009 7:56 pm

you might be able to use the window object to scale the display.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Tue Aug 11, 2009 5:33 pm

I think I've cracked it! I've made an app that displays correctly on all the monitors in my house anyway. Test it out, let me know if it looks right on your monitors:

http://www.mediafire.com/file/tnmykyzml1y/Scaler.cap

Basically, it should display in widescreen, 16:9 format, with black bars at the top and bottom if your display is not 16:9. The circle should be round, the square square, and Samus should be pretty much in the middle. There should be corner markers right at each corner of the display.

It works using the Window Object to resize the display to match the size of your monitor, then zooming the layer using the coefficient [monitor width]/[native app resolution], to scale everything to the new window size. Then it kicks the app into fullscreen mode.

My thanks go to Davioware for introducing me to the Window object, as well as AshyRaccoon for pointing out the SysInfo object and Mipey for coming up with the required scaling coefficient (it's been a long, long time since I had to do any real maths, it would've taken me a while to work out by myself).

Let me know if this works for everybody. If it does, I'll make a better example .cap and write up a proper tutorial on how to do it, as this is a useful technique for those looking to make HD games in Construct.
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Tue Aug 11, 2009 5:45 pm

... I did what? :shock:
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Aug 11, 2009 6:20 pm

You're welcome. :)

I think it looks okay.. but sometimes I don't notice display stretching much when it's present.
1680x1050 widescreen here. 16:10. I got black bars at the top and bottom, and the corner markers at the corners of the visible area.

Not related to the uploaded cap:
I messed around with altering layer zooming and placing black bars, but it's odd. Setting the layer zoom isn't working right unless I press Z twice.
That is, my event is:
MouseKeyboard: On key Z pressed
> System Change display size to 640 x 480
> Set Layer "Layer 1" zoom ratio to (640/1440 * 100, 480/900 * 100)

or even if I replace that set layer zoom ratio with
> Set Layer "Layer 1" zoom ratio to (44, 53)

I have to press Z twice.
The first time, it becomes 70.3125, 70.3215.

I have an event afterward telling me what the zoom is:
System: Always (every tick)
> Text Set text to "" & DisplayWidth & "x" & DisplayHeight & ", Zoom: " & LayerZoomX("Layer 1") & "x" & LayerZoomY("Layer 1")

I used 1440x900 so I could test the zoom in windowed mode.

*shrugs*
B
3
S
1
G
3
Posts: 82
Reputation: 1,189

Post » Tue Aug 11, 2009 6:44 pm

[quote="Mipey":1c5qpkgw]... I did what? :shock:[/quote:1c5qpkgw]

You, my friend, wrote this thread: viewtopic.php?f=8&t=3504

I nicked your example of using OriginalHeight'*(DisplayHeight/'DefaultHeight') to zoom the layers to the right amount. Would've taken me a while to work out for myself.

I'm currently trying to make it work with scrolling. It's...interesting. I might've done it now, needs testing on other monitors first though.
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Tue Aug 11, 2009 8:16 pm

Oh, totally forgot about that thread! Well, in that case you are welcome! :)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Aug 11, 2009 9:16 pm

I'm having trouble with positioning the black bars when trying to enable scrolling. My initial solution was to simply put the black bars on a different layer and set the scroll ratio to zero, so the bars don't scroll when the other layers do. Trouble with this is, that screws up the positioning of the bars relative to other layers, and I can't seem to reposition them.

Is there a way to reposition a layer, without changing the scroll ratio? I've also tried repositioning the bars at runtime using equations, but my math is completely wrong. I made it work fine on my monitor, but trying it on one with an even slightly different ratio and it screws up completely.

UPDATE: I've kind of got it working by repositioning the bars according to the dimensions of the screen. The trouble is, you can't see objects at the very edges of the screen when you are not playing on a 16:9 monitor using this solution. Have a look anyway:

http://www.mediafire.com/file/wtlxlznqu ... Scroll.cap

Also, I'm not sure if there's a way to stop the bars 'jittering' when the character moves, it's as if the 'Always' event isn't repositioning them fast enough.
B
2
S
1
G
5
Posts: 50
Reputation: 1,500


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests