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,974

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
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

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,974

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
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

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,974


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, nahima, tarek2, Yahoo [Bot] and 12 guests