Detecting which mobile OS version is being used?

0 favourites
  • 13 posts
From the Asset Store
A simple Map Editor that where you can edit a map with restriction or totally. You can save and load the map created.
  • 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

  • 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.

  • 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.

  • 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.

  • 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.)

  • 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.

  • 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)

  • 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.

  • 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.

  • 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.

  • TheWyrm

    You can use Phonegap Device plugin

    //expressions

    Cordova: Get the version of Cordova. ex) 3.6.3

    Model: Get the name of the device's model or product. ex) Nexus S

    Platform: Get the device's operating system name. ex) Android

    UUID: Get the device's Universally Unique Identifier (UUID). ex) 92b9548b3817ce0e

    Version: Get the operating system version. ex) 4.1.1

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • cranberrygame Ah awesome thanks.

  • TheWyrm

    You are welcome

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)