How do I allow the player to change resolutions?

Get help using Construct 2

Post » Wed Oct 22, 2014 1:07 am

My game is high resolution (1600x900), how can I easily make it so that people with less powerful devices can change the settings to something less demanding or is there a way to automatically set it so it does that? Would the answer be in setting downscaling in the layout properties (I currently have it set on medium quality)? Also, is there a way to allow the user to turn webGL off? I find that with Chrome 38, turning webGL off greatly increases performance. One other question - is this performance gain because of a problem with the way Chrome is handling webGL or is it because it disables all effects in the game? Thanks in advance for any and all answers, Morgan.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Wed Oct 22, 2014 1:24 am

How I handle the performances on different devices is a settings menu where the player can set the animations to On/Off, also the background scrolling sky can stopped. Also have the clear background turned off because I have a background covering. That was the biggest improvement that I have done. Amazing differences in the fps since turning that one setting to off.
Also, play around with the "Compare two values" and have it compare the "fps" to a number, and if the number drops below your threshold that you set, have it then set the animation speeds, and such.
Also, you can mimick a resolution change by setting the canvas size to another resolution by touching/clicking a sprite/button. See image that I am posting. by clicking/touching the sprite8 on my layout, it would set my resolution to 100x200
canvas.JPG
I hope this helps!
You do not have the required permissions to view the files attached to this post.
B
35
S
10
G
4
Posts: 94
Reputation: 4,083

Post » Wed Oct 22, 2014 1:47 am

When I change the canvas size like that, it cuts off most of my screen and many of my important assets. I want the same screen layout, just perhaps a different scale.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Sun Oct 26, 2014 2:32 pm

@Aphrodite shared this on another thread but you can make it so the user can change resolutions by using the "set canvas size" combined with the "set layout scale" action. I think I'll do a short tutorial on how I did it.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Sun Oct 26, 2014 3:22 pm

WebGL cannot be turned off at runtime, as there is not legit way that you would want that option (webGL gives a better control of scirra on the rendering C2 does, is faster at rendering at the cost of a little JS overhead, if chrome has a problem with that, they will correct it as they have no interest at being slow with WebGL), you can turn off the effects with events, which would be nice to have inside an option menu as well as the target resolution setting.

The set canvas size sets the Window size parameter, which alter the way the low quality setting reacts as well as the viewport, the set layout scale is here to zoom accordingly in the game to have the same viewport, however this is kind of hacky so I would recommand to be careful and replace it if there is an official way to change the target resolution of the low quality setting.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Oct 26, 2014 7:10 pm

@Aphrodite - thanks. I look forward to WebGL being fixed in chrome! Do you know if there are any major browsers (Safari, etc?) that don't use WebGL? I guess that chrome is just running canvas2d better at the moment.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Sun Oct 26, 2014 7:17 pm

PSI wrote:@Aphrodite - thanks. I look forward to WebGL being fixed in chrome! Do you know if there are any major browsers (Safari, etc?) that don't use WebGL? I guess that chrome is just running canvas2d better at the moment.


Well, safari adopted it recently, and if webGL is not supported at all, it should fall back to canvas2D by itself (that is the way C2 does it at least)

WebGL, in a non C2 context, permit low-level rendering, and also 3D (the Q3D plugin only works wit webGL because webGL is based on a 3D renderer AFAIK), so not supporting it would be a turn off for some users, thus browser makers should support it.

Also chrome was I think the first to support webGL (webGL support was actually an anti C2 argument for some as "only chrome supports it anyway" at the time, even though the game falled back to canvas2d in other browsers, they felt like it would be a "optimised for chrome" engine, which as yojc an see, is not the case), and chrome was always good at it, so I would say it is something they have done that reduce its effectiveness, and I do not think they would like to keep it that way if that is the case.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Oct 28, 2014 2:35 am

@Aphrodite - thanks for all of the info! An interesting thing that I've noticed - the two things that currently greatly boost my game's performance, #1 - turning off WebGL, #2 - cleaning the cached files from Chrome. The next time I play after I clean the cache, it won't have nearly as much lag. Do you know what this means? I sure don't... :D
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Tue Oct 28, 2014 6:16 am

For the cache, I sure don't know.

But for WebGL, did you try turning off the webGL effects only (aka not webGL itself) before doing this comparison (and also testing in other browsers just for comparison sake)?
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ChesVCF, OBLIVION, shinkan, Solomon, yiuyiu6666 and 23 guests