How do I optimise this?

Get help using Construct 2

Post » Mon Jan 25, 2016 1:40 am

Hi Guys,

I'm doing a simple shooter and I already see some prformance issues... Could you take a look on this one please.

Image

This screen has been taken while all enemies were dead so the "isDead" boolean is true. I also checked with the "qq" variable if it searches for the path for dead enemies - and it's not. So the only one thing here the engine is doing is just loop through enemies (100 objects) and check the isDead boolean.

As far as I know there is nothing (or almost nothing) faster than checking a boolean value. And it takes 3 to 4 % of my i7 CPU O.o.

Can this be optimised somehow?
ImageImage
B
27
S
16
G
64
Posts: 909
Reputation: 36,442

Post » Mon Jan 25, 2016 2:48 am

"Move along path" should be in event 3, not 2. Not sure if this will improve performance, but it is incorrect at the moment.
ImageImageImage
B
71
S
21
G
212
Posts: 3,616
Reputation: 119,661

Post » Mon Jan 25, 2016 3:02 am

Ah that is true. Thanks @blackhornet. However this doesn't solve the performence problem. Engine is not even passing the condition, so it looks like family SOL/loop is slow.
ImageImage
B
27
S
16
G
64
Posts: 909
Reputation: 36,442

Post » Mon Jan 25, 2016 3:09 am

You could try a "For each Enemy". Sometimes you end up picking more objects than you expect, so "Event 0.5" AND "For each", then move the rest to a sub-event.
ImageImageImage
B
71
S
21
G
212
Posts: 3,616
Reputation: 119,661

Post » Mon Jan 25, 2016 3:24 am

I tried that earlier, I thought maybe engine is looping enemy for every condition or something... but no - same result.
ImageImage
B
27
S
16
G
64
Posts: 909
Reputation: 36,442

Post » Mon Jan 25, 2016 3:40 am

I just realized that I was looking all that time at how to optimize "Enemies track player" group... and just noticed that it's wrong group... the one which brings problems is "Enemies attack player".

And I even pointed that with a red dot on the screenshot haha... time to go sleep.

BTW: The "Enemies track player" uses 0.1% so checking boolean values is indeed as fast as expected ;)
ImageImage
B
27
S
16
G
64
Posts: 909
Reputation: 36,442


Return to How do I....?

Who is online

Users browsing this forum: ALLMarkMade and 8 guests