Total of the items on the screen (mobile)

Discussion and feedback on Construct 2

Post » Mon Nov 16, 2015 7:01 pm

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?
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Tue Nov 17, 2015 5:20 am

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.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Tue Nov 17, 2015 6:53 pm

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 =/
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Tue Nov 17, 2015 7:00 pm

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.
Image
B
82
S
16
G
4
Posts: 503
Reputation: 8,988

Post » Tue Nov 17, 2015 7:41 pm

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


Image
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Tue Nov 17, 2015 9:41 pm

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.
B
79
S
29
G
32
Posts: 482
Reputation: 19,915

Post » Tue Nov 17, 2015 11:03 pm

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
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Wed Nov 18, 2015 1:51 am

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.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Wed Nov 18, 2015 4:31 am

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?
Risk Rocket now available on Google Play
Image
B
36
S
15
G
6
Posts: 337
Reputation: 6,300

Post » Wed Nov 18, 2015 1:46 pm

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.
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests