CocoonJS slow down

Discussion and feedback on Construct 2

Post » Tue Feb 11, 2014 4:03 pm

Strange thing keeps happening. I made a very simple game for mobile... hardly any graphics, no music, no sound... but I kept noticing some severe slow down, and couldn't figure out why.

I pulled my game apart, and found that whenever a global variable is altered, the game pauses. Originally I had a global variable constantly being altered, but I've now changed it to once every second. Low and behold, now I get a slow down once every second.

Anyone else able to replicate this?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
80
S
12
G
7
Posts: 965
Reputation: 10,750

Post » Tue Feb 11, 2014 6:00 pm

Never had any issue like this with CocoonJS.

Is it doing anything else when updating the variable?
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Tue Feb 11, 2014 6:17 pm

@ArcadEd, yes, but nothing major.



This is what it looks like. As soon as I disable that line at the bottom, everything runs perfectly smooth.

No idea why.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
80
S
12
G
7
Posts: 965
Reputation: 10,750

Post » Tue Feb 11, 2014 6:22 pm

In the code above, why are you checking the overlap of sprite3 twice?

Not sure why that would make a difference.

B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Tue Feb 11, 2014 6:26 pm

@ArcadEd

Oh sorry, I was in the middle of testing between overlap and collision when I took the screenshot. One of them was meant to be crossed out.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
80
S
12
G
7
Posts: 965
Reputation: 10,750

Post » Tue Feb 11, 2014 6:40 pm

Checking for collisions is vey expensive, especially if there are lots of these sprites at once. REmove the collision check and see if you still get the slow-down.
-Mike
B
49
S
9
G
4
Posts: 426
Reputation: 7,041

Post » Tue Feb 11, 2014 7:30 pm

@Brashmonkey :
Also I think the collision check is better done before checking the variable, due to the change in C2 collision detection (I could be mistaken).

For the variable, I don't know at all though, maybe you could try alterating a non global variable to see if that changes something (like a text value), even though I don't think this is worth it in the long run
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Feb 11, 2014 9:37 pm

If there is not going to be an else there, you can also move the is Alive check to the top level as well.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Wed Feb 12, 2014 2:25 am

What's the difference with using Overlap vs actual On Collision with Object, performance difference? My game uses only the later, and there's no problems with slowdowns... even on a crap HTC Incredible S with an old 1ghz dual core.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614


Return to Construct 2 General

Who is online

Users browsing this forum: mihirolover, RonMob, Tjums and 18 guests