Total of the items on the screen (mobile)

0 favourites
  • 15 posts
From the Asset Store
Cue in the war drums and battle cadences with Total War Game Music Loops!
  • Hello everyone,

    In my game, sometimes I get to have 20 enemies (each with four frames of animation) on the screen. This slows the game. Is there any way out to avoid this or CS2 this is impossible?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Lag can be cause a combination of many factors. 20 enemies are a lot, but it should still be ok unless, you are using physics or path finding for each of those enemies, as they eat up a lot of computing resources. Or you are using large resolutions on those enemies sprite, as the larger the resolution, the more memory it takes up.

  • No, there is not physical. Enemies use bullet and move down (as Space Invaders). I am testing in coonconJS launcher, and the game's performance is lacking. I've taken all the particles and the next step is to remove the animations of four frames. I'm running out to have more to take =/

  • How big are your animations frames?

    20 enemies with 4 frames of animation on the screen at once. That will put a load on your mobile device.

    If you want to use explosion. Instead use a single image explosion sprite and use "Fade"..

    https://tinypng.com/ helps a bit too.

  • Are all 64x64 px, the animation has four frames in loop and a 2.5 speed and is optimized.

    Even creating five enemy at a time (when the first wave with 5 die, comes another wave with 5), play "stutters" from scratch.

    I ran on the PC with the debug CS2, CPU usage is wavering, I found 80% too much for what was happening on the screen (5 enemies with bullet 90 degrees).

  • How old is your device? A contemporary phone should not have too much of a problem with 20 enemies.

    Older ones won't be good though. Even with heavy optimization.

  • something else is eating up your perfomance

    check for open loops, and see if the sprites colision masks have weird shapes, remember to always use squares

  • Memory seems a bit high, but other than that, everything looks ok. Try looking at the profile section of the debugger. It should tell you which section of the code is taking the most processing power. You should be able to identify which part you need to work on.

  • Wait a sec. Doesn't that basically mean there are 80 Sprites on screen then? Since One sprite with four animation frames is considered to be 4 Sprites. Am I correct or wrong?

  • I do not know if an object with 4 frames is considered 4 objects. My game is pretty much a space invaders, I really do not understand what may be happening.

    The Phones that use Moto G is a second generation and I'm using cooconJS Launcher to test.

  • I'm not sure if that's the problem, but you should use cocoon.io instead. If I'm not wrong, cocoon is not updating the js version anymore.

  • Are all 64x64 px, the animation has four frames in loop and a 2.5 speed and is optimized.

    Even creating five enemy at a time (when the first wave with 5 die, comes another wave with 5), play "stutters" from scratch.

    I ran on the PC with the debug CS2, CPU usage is wavering, I found 80% too much for what was happening on the screen (5 enemies with bullet 90 degrees).

    That's on your PC debug? 83% CPU usage?!

    That's ridiculous and suggests something wrong that's causing way too much CPU overhead.

    For reference, I have many hundreds of Fighters flying around fluidly dog-fighting each other with particles, trails, explosions and all that collision checking and I'm not even above 50% CPU usage.

  • I suspect you have event(s) triggering repeadly that needn't be. Make sure that if any conditions are meet they are not trggering over and over stuck in a loop. Print or draw things to screen to help debug and use the profiler...

  • when I change the debug mode tab to display only the performance window, the same screen that showed 80% of CPU usage changes to 06%. I believe the other screen, to have several things going on in the debug overload the CPU. Makes sense?

  • Yep, that's more normal.

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