Random Variable heating up my phone

Discussion and feedback on Construct 2

Post » Fri May 19, 2017 1:27 am

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?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Fri May 19, 2017 1:31 am

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.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Sun May 21, 2017 8:29 pm

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.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sun May 21, 2017 11:46 pm

@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.
B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Sun May 21, 2017 11:51 pm

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.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Mon May 22, 2017 12:25 am

Did you try the debug mode and see whether any object count is rising or falling onto abnormal levels?
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Mon May 22, 2017 12:33 am

randomly wrote: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.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Mon May 22, 2017 12:59 am

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.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634


Return to Construct 2 General

Who is online

Users browsing this forum: justifun and 11 guests