Optimization question.

Get help using Construct 2

Post » Sun Oct 19, 2014 2:09 am

I am currently working on optimizing my game, "Psi." One method I'm using is doing an instance count before having the sub events activate. If Boxmutant.Count > 0 then... Does that seem like a good approach?
Image
B
20
S
4
Posts: 382
Reputation: 2,984

Post » Sun Oct 19, 2014 5:55 am

Without more info about the sub-events I'd say no. If the sub-event has conditions that pick boxmutant objects then comparing the object count is redundant since if there are no instances then it automatically won't run.

Basically for optimizing you should only optimise slow areas and somehow check performance before and after to see if things were improved. Me personally, I try to keep events simple and readable. The profiler can be useful to check what percentage of the country's each event group is using, and help identify what areas need More attention.
B
94
S
33
G
113
Posts: 5,356
Reputation: 73,273

Post » Sun Oct 19, 2014 1:54 pm

@R0J0hound - if the sub event is a "for each" loop, would a count condition keep the loop from running when no instances are present or will the loop not run anyway, without such an additional condition?
Image
B
20
S
4
Posts: 382
Reputation: 2,984

Post » Sun Oct 19, 2014 2:06 pm

The golden rule: if you can measure a performance improvement, it's worth it; if not, you're wasting your time.

I doubt you will be able to measure any performance improvement from disabling when there are no instances, because in that case there are no instances to run conditions/actions/loops on, so there's still nothing to do.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Sun Oct 19, 2014 4:16 pm

OK, thanks @Ashley - I'm trying to wrap my head around optimization and the most efficient use of events.
Image
B
20
S
4
Posts: 382
Reputation: 2,984


Return to How do I....?

Who is online

Users browsing this forum: zenox98 and 7 guests