Random Variable heating up my phone

0 favourites
  • 8 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • A game that my friends and I made has a bunch of random generators. they all tick at different times but there are 15 of them, set variable to random 1 thru 5. Is there any way to make it so this doesn't heat up my phone? it also lags it too if I play too long. There has to be 15 random 1 thru 5 though, that's not negotiable. I can't get rid of any of those.

    Is there anyway to set it so the random 1 thru 5's dont heat up the phone nearly as much or lag the game?

  • I didn't have that problem before though when i had 10 random 1 thru 5's. The entire foundation of the game is built on random numbers so no two games are the same. They cannot be taken out. if i knock it down to 10 might that help?

    The thing is though the game starts out fine. I'm destroying objects when they get outside the layout so a bunch of sprites arent building up. As the game progresses though it gets worse and worse.

  • To be honest, I don't know a direct solution to this.

    But can you try replacing the system random generator by this or this plugin and see whether that changes anything.

  • Phoenixbowman

    I highly doubt the random variables are heating up your phone. The main reason why a phone heats up is that C2 can only use a single core of a processor - except for a few things that can be handed off in some cases. The more commands the event sheet has to process every tick, the more the phone will warm up. 15 random number generators is not enough to cause a problem. But something else is building up over time and making your phone do more work than you may think.

    So, make sure you don't have unnecessary things running - and the fact that you say the game start to lag after a while tells me that more is going on than you realize. Either objects aren't getting deleted, or some condition is true multiple times that is spawning too many new objects, or something like that. It is probably bugs in your code, or too many effects, or too many or too big graphics.

  • I had over two dozen If Overlapping an object, put the object that's being overlapped behind the one overlapping it. I got rid of all of those and replaced it with While on Screen, move object in front of the background and that really really knocked down the CPU a lot from what I can see in the debugger.

  • Did you try the debug mode and see whether any object count is rising or falling onto abnormal levels?

  • Did you try the debug mode and see whether any object count is rising or falling onto abnormal levels?

    I looked at Debug mode, the object count is not rising or falling to extreme levels. Nothing is using up a lot of CPU but it's still lagging like crazy. The phone isn't that warm either. I don't know whats going on. I do have Set Local Storage but in the debugger its not using a lot of CPU. nothing is using a lot of CPU. i simplified stuff. I cant get rid of the collision stuff, because the game relies on that. and i make sure objects that are created get destroyed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nothing is using a lot of CPU and the amount of objects doens't keep going up. Like up and up without going back down. I am completely stumped. I've simplified the code as much as I can. The On collisions are absolutley critical. That's the whole point of this game.

    I have no idea whatsoever what could be causing all this. I kid you not i've tested at least a dozen different things, various things here and there but nothing has worked. I've tried. It's still lagging after playing for awhile.

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