Detecting which mobile OS version is being used?

Discussion and feedback on Construct 2

Post » Wed Nov 12, 2014 10:55 am

Hi guys,

Is there a way to detect which version of iOS or Android your game is running on? What I want to do is dynamically disable elements of my game to increase performance on older OS versions.

Cheers,
TheWyrm
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Wed Nov 12, 2014 1:33 pm

You shouldn't do that, because there's no reason to assume performance correlates with the OS version. You should adapt the display based on the actual performance, not the software installed.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,684

Post » Wed Nov 12, 2014 11:01 pm

Sometimes the best thing to do is run some tests when your game is first booting up to determine the power of the device. Try some demanding event based code (just some arbitrary calculations that ramp up until fps goes below a certain amount) to figure aprox cpu performance, and try spawning in a bunch of overlapping objects that rotate (be sure to have collisions off for them) to get an idea of gpu performance.

You can always do this underneath a prescroll or title screen so the end-user doesn't think something odd is happening.

You can also monitor fps during game time, and try to make some adjustments there...so, if under 60fps for x ticks: destroy some of these objects, do these calculations less often, stop spawning these particles, etc.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Nov 13, 2014 1:50 pm

Thanks for advise @Ashley and @Tim. I tried doing some dynamic performance stuff last project by the following

> Every tick.
>> If FPS is lower than X turn off feature.
>>If FPS is higher than Y turn on feature.

However, this can cause performance ping ponging. So I also tried

> Every tick.
>> If FPS is lower than X turn off feature.

However, any slow down of course turned the feature off. So then I pushed the FPS to an array every tick and took an average FPS over X records, BUT during that period any bad performance can be seen. So I guess I could still use this method but display an overlay to hide bad performance.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Thu Nov 13, 2014 2:01 pm

TheWyrm wrote:Thanks for advise @Ashley and @Tim. I tried doing some dynamic performance stuff last project by the following

> Every tick.
>> If FPS is lower than X turn off feature.
>>If FPS is higher than Y turn on feature.

However, this can cause performance ping ponging. So I also tried

> Every tick.
>> If FPS is lower than X turn off feature.

However, any slow down of course turned the feature off. So then I pushed the FPS to an array every tick and took an average FPS over X records, BUT during that period any bad performance can be seen. So I guess I could still use this method but display an overlay to hide bad performance.


There is something that has been imagined by a prophet a long time before, something marvellous, amazing, we, simple humans, call it the "Option menu", you should try it, there are graphical options to help people with devices that have a hard time with the graphic aspect of the game, and also sometimes options to lessen the amount of CPU needed for, lets say, the environnement or the sounds effects.

(Sorry for the overcreative way to say "you could let the user choose the quality and other things himself so he can have the best experience", but it seems people have a hard time thinking about including options in their game sometimes.)
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 » Thu Nov 13, 2014 2:11 pm

Yeah I don't think you're ever going to get a reliable way to auto-detect and change settings during gameplay - provide an option and maybe use the framerate of the first level to set a default and then leave it.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,684

Post » Thu Nov 13, 2014 2:47 pm

Ashley wrote:Yeah I don't think you're ever going to get a reliable way to auto-detect and change settings during gameplay - provide an option and maybe use the framerate of the first level to set a default and then leave it.



I may add that If the refresh rate is 30, or 50, or 120 (all units in Hz, of course), the result may be adjusted in consequences (not saying it is a bad idea, just reminding that 60 fps is applicable only to a 60 Hz refresh rate, and so caution is still required with auto detection).

Also auto detection is far from being future proof, standards refresh rates may vary in the future, and others things considered "true by default" may also change, and to comment the first suggestion of OS sniffing, it is the bad idea by excellence, could be compared to the browser sniffing used by a lot of webdeveloppers, which caused trouble, headaches, and forced browser vendors to add filthier workarounds. (Why is there even a Is on mobile condition in C2, why, why, why)
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 » Thu Nov 13, 2014 3:02 pm

Ok, sounds good. I'll do an initial performance test when the game first loads which will decide the graphics settings, as well as provide graphics options.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Thu Nov 13, 2014 9:30 pm

Ashley wrote:Yeah I don't think you're ever going to get a reliable way to auto-detect and change settings during gameplay - provide an option and maybe use the framerate of the first level to set a default and then leave it.


Yup, in my current project I default to 'auto' settings which basically do just that (except, I'm running my tests prior to the actual gameplay). However, I also have "High, Med, Low" GFX settings.

While I've never had a lot of luck doing 'realtime' tweaks, I certainly think it's possible...it just requires more forethought about how such changes will affect the game, and how to avoid 'ping-pong' effects.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Fri Nov 14, 2014 11:02 am

@TiAm Yes, I believe it is possible to avoid ping ponging. My games are generally optimized to not need any graphics settings, but the loss of performance is caused by WebGL effects i.e. ripple effect on bubble sprites. Which is fine on modern mobile devices, but struggles on older ones.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Refeuh and 10 guests