Need help to optimize Framerate

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hello guys,

    I'm trying to optimize my android game and i would like to know if there is some settings to use to save memory on Android.
    For example, active objects have parameters like "save background" but i don't know if i should set it to On or OFF to optimize my game.

    Also, i would like to know what can help to improve a game framerate in term of graphical resources.

    The thing that seems to use the most of resources for events are the samples (but we have no solution for this issue) and the enemies collisions (i use Move Safely 2 object for pixel perfect collisions).

    I've read things about overlapping objects conditions, but i'm not sure about what i should do, how to test a collision without that kind of condition?

    Android is a pain to optimize, because each time a sound is played you loose almost 50% of framerate, no matter what the max framerate is...

    Thank you for your help. :)

  • Honestly, I ran into this issue recently with a Game I am Working on for Android. However, it wasn't the sound lagging down my device. It was the Always Events.
    I use .ogg sounds for every sound in my apps. Never had any lag issues with .ogg. Any other sound format, YES! Massive Lag! Sometimes, the audio wouldn't even play.
    So, I purchased WAVEPAD just to convert files to .ogg and to reduce the volume of the files as well. While it might sound super quiet on your laptop during development.
    Playing the same sound on ANDROID typically is 4X Louder and even the volume causes issues for some odd reason. Samsung devices, definitely does not like the loud
    audio files.

    What has helped me has been .ogg and 25% Volume of a File that started at Max volume.
    I have over 100 apps out on Google Play over the years and many of them have numerous audio files longer then an hour in them.
    All running at the same time no less and switching between all of the files at a User controlled rate of (100,1000) of a second. No Lag!

    Now as far as LAG and Frame rate drop on Android. Things I have noticed that just kill Android are the following...
    1.) Always Events
    2.) Large GIF Imported files
    3.) Audio Files other then .ogg

    Literally, one large Imported .GIF versus 500 smaller animated actives is a crazy difference on android.
    You'd think 500 animated actives would be worse, but for whatever reason. You could have 1,000 and that one big GIF will just kill the apps framerate.


    Hope this helps you some.

  • Thanks, i'll try to lower the volume of the samples, i already tried ogg format in the past and it made no difference (using audacity or built-in fusion tool). Maybe the volume will change something.

    Also speaking of gif (even if i don't use any) i was wondering if using 10 actives with one frame is better than using 1 active with 10 animations with 1 frame each (for example, when i create different bullets in my case)
    I really don't know how fusion handle graphics, what is better to use, etc...

    Do you know anything about the "save background" option?

    I've tested the volume thing, for me it's the other way, on PC the sound is 4X louder than on my mobile devices...

    Edited once, last by Dobermann (March 8, 2023 at 5:36 PM).

  • Thanks, i'll try to lower the volume of the samples, i already tried ogg format in the past and it made no difference (using audacity or built-in fusion tool). Maybe the volume will change something.

    Also speaking of gif (even if i don't use any) i was wondering if using 10 actives with one frame is better than using 1 active with 10 animations with 1 frame each (for example, when i create different bullets in my case)
    I really don't know how fusion handle graphics, what is better to use, etc...

    Do you know anything about the "save background" option?

    I've tested the volume thing, for me it's the other way, on PC the sound is 4X louder than on my mobile devices...

    As far as actives go. I have no issues with a ton of them as long as the animation is small in size. Number of animation frames does not seem to matter with fusion. However, when you make a big sized Animation. Watch out, the lag is coming!
    Save background, doesn't seem to do much difference then leaving and active sit. I prefer to leave the active sit as it can become an obstacle with no extra code. I.E. Vehicle is destroyed. Instead of actually destroying it. I make a new Animation called dead. So when the animation is forced to dead. The vehicle stays on the screen as an Obstacle.

    I am not sure what it could be then with the sounds as for me. Changing to .OGG was the solution.

  • Thanks, i'll try to lower the volume of the samples, i already tried ogg format in the past and it made no difference (using audacity or built-in fusion tool). Maybe the volume will change something.

    Also speaking of gif (even if i don't use any) i was wondering if using 10 actives with one frame is better than using 1 active with 10 animations with 1 frame each (for example, when i create different bullets in my case)
    I really don't know how fusion handle graphics, what is better to use, etc...

    Do you know anything about the "save background" option?

    I've tested the volume thing, for me it's the other way, on PC the sound is 4X louder than on my mobile devices...

    Here is an example of size that 1 .GIF caused.
    Now the weird part is I can literally make 1,000 more actives and still be nowhere near this size, Even though the one active was this .gif imported.
    Size of .gif in image below! Gif had 10 frames.

    Please login to see this attachment.

    Edited once, last by VBEinc (March 9, 2023 at 11:19 AM).

  • j'ai tellement testé de choses pour optimiser sous android!!


    le nombre d'actifs ou de decors a l'écran est important surtout sur des telephones pas trop recents.

    voila les 2 seules methodes qui marchent vraiment tres bien pour moi
    Please login to see this attachment.

  • Active object count can have an effect on mobile. I think it may have been Fernando who once said on here (correct me if I'm mistaken) that all on-screen images, whether they are actives or backdrops, are effectively treated as active objects by the Android runtime & contribute to the total count. I've certainly experienced performance issues on Android when generating levels out of 32x32 tiled backdrops, which potentially is many objects on screen at once being treated as actives.

    By making my background tiles much larger, I think I went from 32x32 sized tiles to 768x256, which meant I only needed 4-5 large tiles to cover the screen as opposed to about 200 32x32 tiles, I got a massive performance boost.

    On "always" events, you must bare in mind that an always event is the same as saying "run this event 60 times a second". There are some things you probably do want to run 60 times a second like collision checking against the player character or bullets etc, but for other things that are less essential, like maybe updating a string text, that would be a waste of computational time.

    A good trick I learned off these forums was to use an always event to increment a counter (or alterable value) which will effectively act as a frame counter, and use the value of the counter to trigger actions. For example, if you wanted to run something every other frame, you could do..

    + counter/value mod 2 = 0
    - perform action

    The action would run at 30 frames a second instead of 60 with a plain always event. The event below does exactly the same thing except it uses a bitwise operator, which is usually slightly faster than using "mod" in java, especially on non-power-of-2 numbers.

    + counter/value and 1 = 0
    - perform action

    This event...

    + counter/value mod 16 = 0 (or use "and 15" instead of mod)
    - perform action

    Would perform the action every 15th frame, and so on..

    Fusion attempts to read every non-immediate condition in your event list 60 times a second, it is therefore logical to assume that the more conditions & actions its trying to execute during this time, the more likely you will run into performance issues. Spreading some actions across frames is admittedly a very granular approach, but in the long run will greatly benefit your performance on mobile runtime.

  • Thanks for sharing your methods, i've tried a lot of them but most of my issues comes from the sounds played each time a player shoot. If i deactivate sounds, no more frame drops...

    I already use delta time so it is not unplayable but i would prefer to get a better framerate than drops from 60 to 20 FPS.
    I've tried everything for the sounds and nothing work on low spec devices but settings the sounds off.

    Also, my game has a level editor, and users can share and play on those user created maps. So if android set every objects as active, even backdrops, i understand why my game is slower on user created maps on android devices...
    I already use big tiles to avoid the issue of using too much object (256*256 backdrops) but for a level editor it's impossible to use pre-made tiles as it will reduce possibilities and creativity.

    I was wondering if it would be possible to change the way the map is created instead, i use "add backdrop" for each background element, but could it be possible to merge all objects into one?

  • Thanks for sharing your methods, i've tried a lot of them but most of my issues comes from the sounds played each time a player shoot. If i deactivate sounds, no more frame drops...
    I was wondering if it would be possible to change the way the map is created instead, i use "add backdrop" for each background element, but could it be possible to merge all objects into one?

    You're Welcome...

    I have yet to see this in action, but that would be amazing. I have seen fake versions of objects combining but that seems to cause more lag then not. The fake version had layers of two objects. So technically, it was still just as many objects but looked like the objects combined. To bad there wasn't a way to incorporate the Motive in the Quick Backdrop object to load your map graphics. Like have it load the map graphics to only the area they where placed so that it is one object instead of tiles. That would be awesome!

    As far as sounds go. I have no clue why your sounds lag your app so much. The game I am working on right now has sounds playing like crazy and tons of objects on the screen. So far, no lag at all.
    I am even running this game on my Oldest Phone with no Sound Issues or Lag.
    Only Lag I get from time to time is recording the game with a screen recorder on my old Phone.

  • As far as sounds go. I have no clue why your sounds lag your app so much. The game I am working on right now has sounds playing like crazy and tons of objects on the screen. So far, no lag at all.
    I am even running this game on my Oldest Phone with no Sound Issues or Lag.
    Only Lag I get from time to time is recording the game with a screen recorder on my old Phone.

    Well, it's something that has been discussed for a while: Please login to see this link.

    In my game, you control a character that use weapons, and enemies uses weapons too, there is an online matchmaking so, more weapons shooting at same time.
    I get FPS drops everytime a sample is played (no issue with musics). Like if the game search for the sound, load it up then play it.

    Also, how do you play sounds? In my case i use "play sample on specific channel", maybe this action use more memory?

  • Thanks for sharing your methods, i've tried a lot of them but most of my issues comes from the sounds played each time a player shoot. If i deactivate sounds, no more frame drops...

    I don't know if you use Scaling in your Android app, but yesterday I came across a huge bug that froze my phone for about 15 seconds each time.
    I had an explosion that scaled by X / Y scale + 1 and for whatever reason. During the scaling, if the user touched the screen. Instant freeze!
    Which turned out the scaling did something odd to the Multitouch object. Basically the Multitouch object went into a frozen state during scaling
    and if you touched the screen it would lock up the device.

    I say Android as it had no issues on my Laptop. No lag, nothing!

    So unfortunately, it seems like scaling on Android is bad too.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!