Quick question about performance (CPU usage) - Need expert advice

From the Asset Store
[ C3 ] Firebase-Performance support C3 build service iOS | Android.
  • Alright so my game has 80 objects when it's running. My android phone heats up when I play my game!

    I realized that I don't need 30 of those objects until Game Over... Initially, they're invisible, but they exist on screen.

    Question is, how much would it help in performance if I do one of these:

    1) Destroy them on Start of Layout, and spawn them all when needed?

    2) Since they're all positioned manually as I want them, I don't want to do the above (placing them back again through programming will be a mess), would it help if I move everything by Self.X + 3000 and bring them all back by Self.X - 3000 (i.e. removing them from screen).

    Thanks!

  • 80?

    Get a new phone.

  • The number of objects doesn't matter as much as behaviors and effects you have applied on these objects, and events that are running on every tick.

    Effects can be very slow on mobile, as well as some behaviors. Try to disable them when not needed.

  • If you can provide these details, I might be able to guess.

    1. Phone Specs / Android Version
    2. Game Screenshot

    Though, since you are at the point where you are asking if your events are performant. I don't think it's an event performance issue. So, I think it's just, you are using a phone that's either

    1. GPU-Blacklisted
    2. or, too old.

    I wouldn't worry about it.

    This is a good read about that: construct.net/en/blogs/construct-official-blog-1/optimisation-dont-waste-time-768

  • Thanks dop2000, that was a good advice. I will try disabling the objects with behaviors when not in use.

    I had effects before, removed them all, because it used to lag crazily on my phone.

    Thank you chadori, I am using LG G Pro 2 (3GB RAM), Android 5.0.1.

    This is the game: https://play.google.com/store/apps/details?id=com.cricket.iogames

    Yes you're right, I had recently also optimized my events, they were more than 400 in the game layout, but after using Groups and using more functions, I could reduce them to 250 active events where majority are just trigger events. I also converted most of the every-tick events to every after 0.03 seconds.

    The above did seem to help improve the performance slightly. (CPU usage from 10% to about 8% avg).

    Thanks for the link! I did read it a long time ago, but time to read again ! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • newt, Yeah, that's me. Can't I help the beginners? I remember facing a lot of such issues when I started.. and yes I'm still learning despite years of use of C2/C3. But I've also learnt enough to help others, especially programming/logic related issues. And yes, I'll change my phone. Thanks for your suggestion -_-

  • I also converted most of the every-tick events to every after 0.03 seconds.

    This is not a solution. These events will still run approx every 3 out of 5 ticks. If you have lots of such events, you need to change the logic, use more triggers, functions, on timer events etc.

    For example (this may not be the case in your game, but I've seen it too many times) - testing if Enemy.health<=0 on every tick. This is unnecessary, you can do this check in the event where the enemy is hit.

  • Alright so my game has 80 objects when it's running. My android phone heats up when I play my game!

    I realized that I don't need 30 of those objects until Game Over... Initially, they're invisible, but they exist on screen.

    Question is, how much would it help in performance if I do one of these:

    1) Destroy them on Start of Layout, and spawn them all when needed?

    2) Since they're all positioned manually as I want them, I don't want to do the above (placing them back again through programming will be a mess), would it help if I move everything by Self.X + 3000 and bring them all back by Self.X - 3000 (i.e. removing them from screen).

    Thanks!

    Here's what I've faced on my mobile games:

    1. Avoid ticking as much as possibble. Don't execute stuff unless you have to, this will lead you to an event driven approach. For instance, HUD use to be something you have to update frequently but using text objects or forcing Construct to draw a sprite font every tick is terrible. Instead, determine the events that will trigger an update and call an UpdateHUD function to improve performance.

    2. Too many Physics objects. Use only what you need or what "looks good" aiming always to the minimum.

    3. Using too many Platform behavior objects. This behavior is quiet heavy even for a PC, some people tend to use it instead of a physics behavior. For performance reasons, try not to have more than 3 objects with platform beh.

    4. Too many particles with large lifetime. It will demand the engine to process each object created individualy, so it is self explained.

    5. Effects. Some shaders are really gpu intensive, so you will have to figure each out by trial and error. Mobiles have way less processing capacity than a PC, so always test your effect alone in your phone and build over it or completely remove it if your phone has les than 30fps (aim for that)

    6. Text Objects are really heavy to render in a mobile, use sprite fonts if you need lots of text objects, however you can still them use them as long as you don't update them every tick.

    7. HTML objects like Input fields, buttons and so on tend to be heavy in my experience, so use as few as possible or try to isolate the "forms" layouts from the game layouts.

    Hope it helps.

  • Thanks a lot sotano42 !! Really helpful suggestions!

  • Thanks a lot sotano42 !! Really helpful suggestions!

    My price is to play a free game I made :D of course in construct and I faced tons of performance problems.

    Her it is... enjoy: bit.ly/30pvbcr

  • sotano42 Oh I just did !! That's awesome! Well made, shows how much efforts you put in there!

    Also, I noticed how you made the background objects produce such an awesome 3D effect! Really liked it. It's fun and engaging!

    Alright, time for some non-positive feedback as well. Don't worry, couldn't find many.

    1) I think the vibrations can be changed to patterned.. like ( [0.5s ON]-[0.2s OFF] ) x 5 because with the current vibration, I thought I was getting notification. Longer one can be once, only at the end. Just a thought. It may be only me.

    2) I tried viewing a Video Ad.. but it never loaded. Tried twice. I am in the UK, it should have worked. Pls check.

    Anyway. Well done there! I am going to rate it 5 stars.

    Oh. I have a price too for feedback. Why not play my game too? :P

    play.google.com/store/apps/details

    Cheers.

  • Dr.Hasan Thanks for the feedback, the game is the result of like 4 iterations plus tons of analytics behind...

    About the ads, that's pretty much out of my hands :( there's an expected match rate but fails from time to time (AdMob). I been posting bugs and receiving fixes on the Admob plugin from Scirra, they did some changes based on some exceptions I gathered, but it seems the Admob team has been messing around with their service. Anyway, the match rate is acceptable, around 90% ... you may try later just to make sure it was a temporary problem.

    And your game looks great too. According to Game Analytics, Word games are the top ones with more retention.

    Your game feels fun... I'm not a english native speaker so I had a hard time lol... but there were a couple of things that failed:

    1.On the crossword game I pressed help and the game closed :o

    2.I couldn't pass level 1, it seems there was some kind of bug since I wrote "Low" and the game told me I was correct but then the crossword grid didn't filled.

    3.I coudln't figure out the last word with C,L,E,E,O,M (3 letter word) and ended with a W (wasn't low) You may need to check if it was my mistake or a game bug.

    And I got intrigued by this:

    1. When there are no users connected, do you mock up a local play as with another player?

    2. What ad service are you using? did you connected it with enhance?

    The game seems to have a lot of design behind, congrats!

    You may need to market it more and would suggest to polish the text objects to match the graphs (imo, just my subjective recommendation, I'm not saying is wrong or anything, I'm just thinking on a better UX)

  • sotano42 Thanks a lot for the feedback! and I'll check the problems out. The crossword however, I remember, it was some other word like COW or MEW etc. It's basically checking against the words I've already set, to fill them in.

    Yes, you guessed it right. I have used some AI bots if no real user is found, you can still play with 'someone', and they chat too! :P

    Oh I had set up Chartboost ads, as a Backup, if Admob fails to load, Chartboost shows up. Which it does but I'm going to remove Chartboost now because despite all the impressions, it doesn't give me revenue. Not worth it. The unreliable Admob is still better alone.

    By the way, I tried again, Your video ad worked!

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