How do I - will using groups optimize performance ???

Get help using Construct 2

Post » Mon Jul 28, 2014 1:03 am

hi,
iam using 200 object moving on every tich self.y+5*60*dt and destroy them when y > 800
i know its too much ... iam trying to use groups on even sheet but i see that i have same performance
cpu usage is about 40 to 50 %
and the game is really slow on mobile
any suggest ?
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Jul 28, 2014 1:12 am

Have you tried just lowering the number of objects? 200 is insane for a mobile device, the max I ever use for mobile dev is 25 - I mean can you even make out 200 objects on screen?

In regards to your question, I was unaware of any performance gain related to using event groups, to my knowledge its a cosmetic feature with the added benefit of letting you call large chunks of event code
B
61
S
22
G
10
Posts: 647
Reputation: 10,453

Post » Mon Jul 28, 2014 1:43 am

I fail to see, if you *need* to move 200 sprites onscreen, how groups could help.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Jul 28, 2014 8:13 am

Groups are not only usefull for organizing your event sheet, but mostly for the ability to activate/deactivate large pieces of code when not needed..

For instance:
If you put all your events for an ingame menu in a group and only activate that group when the menu is visible/available it can save construct a lot of checking time and as such improve performance..

I wonder why you need to use 200 objects this way..
Must be a better method, meaning one with less impact on performance..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jul 28, 2014 8:40 am

If objects are slow moving, try moving them less often.

If they are moving faster, try adding motion blur to prevent jerky movement at less than per-tick intervals (for very fast objects, this can even help with every-tick movement quality).

Reducing the number of objects always works; again, if we are talking bullets here, try making clusters of projectiles (say a triangle of 3 bullets) to maintain density while dramatically reducing your object count.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Jul 28, 2014 11:44 am

hi , thanks for all for reply
the 200 object are not all on screen
only 20 are on screen
but the rest are moving to be visible on screen
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Jul 28, 2014 3:01 pm

If it was me? I'd add behavior Destroy Outside Layout to the sprites & then use a different method to get them back onto the screen. When you have the 200 sprites still doing stuff offscreen, the computer still has to do all the math associated with the sprites' motion AND image. That's probably what's causing the CPU usage.
Phase 1: Collect Underpants.
Phase 2: ????
Phase 3: Profit!
B
16
S
5
G
4
Posts: 106
Reputation: 2,450


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests