CocoonJS slow down

0 favourites
  • 9 posts
From the Asset Store
Set of tiles to create a map for top-down games with island theme
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Never had any issue like this with CocoonJS.

    Is it doing anything else when updating the variable?

  • ArcadEd, yes, but nothing major.

    <img src="http://imageshack.com/a/img841/963/ydtm.png" border="0" />

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

    No idea why.

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

    Not sure why that would make a difference.

  • 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.

  • 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

  • :

    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

  • If there is not going to be an else there, you can also move the is Alive check to the top level as well.

  • 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.

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