Every X Seconds with Collision Cells?

Discussion and feedback on Construct 2

Post » Mon Mar 09, 2015 4:17 am

If you put:

every x seconds
enemy is overlapping player

Will it use the collision cells even though it's not the top event? If not, how would one do a "check overlapping" less often than every tick while using collision cells?
B
30
S
7
G
1
Posts: 504
Reputation: 3,341

Post » Mon Mar 09, 2015 11:01 am

Yes, it will use collision cells. The collision condition only needs to be the first condition in the event referring to those object types. "Every X seconds" is a system condition so does not refer to any object types. If you had a condition before it picking any "enemy" or "player" instances, that would force it to skip collision cells.
Scirra Founder
B
383
S
224
G
86
Posts: 24,118
Reputation: 190,444

Post » Mon Mar 09, 2015 7:54 pm

@ashley - perfect. thank you!
B
30
S
7
G
1
Posts: 504
Reputation: 3,341

Post » Tue Mar 10, 2015 3:03 pm

Ashley wrote:Yes, it will use collision cells. The collision condition only needs to be the first condition in the event referring to those object types. "Every X seconds" is a system condition so does not refer to any object types. If you had a condition before it picking any "enemy" or "player" instances, that would force it to skip collision cells.


is that mean to make the event like that ?

is overlapping object
every X seconds

or

every X seconds
is overlapping object

?
B
43
S
16
G
8
Posts: 783
Reputation: 8,238

Post » Tue Mar 10, 2015 3:15 pm

@matrixreal, you can use lots of different types of pre-conditions providing none of them involve objects that comprise the subsequent collision check. Every x seconds, a Variable equals, and so on.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Tue Mar 10, 2015 6:56 pm

@matrixreal - the second one - the first one checks every tick if its overlapping and only does the actions every x seconds, where as the 2nd one checks is overlapping every x seconds.
B
30
S
7
G
1
Posts: 504
Reputation: 3,341

Post » Wed Mar 11, 2015 12:31 pm

@matrixreal - both ways use collision cells, but it is faster to check "Every X seconds" first. Then it only does the collision check on the timer. If you check the collision then have "Every X seconds", it will wastefully check the collision every tick, and ignore the result every tick apart from the times "Every X seconds" is true.
Scirra Founder
B
383
S
224
G
86
Posts: 24,118
Reputation: 190,444

Post » Thu Mar 12, 2015 2:49 pm

wow its amazing thanks ashley for confirm that

my result with "every 0.1 seconds + is overlap " instead of "is overlap" alone are

fsp : 55 instead of 49
cpu usage : 17% instead of 28%
collisions checks : 110 intead of 450

its clearly different and i see that we earn a huge performances
B
43
S
16
G
8
Posts: 783
Reputation: 8,238


Return to Construct 2 General

Who is online

Users browsing this forum: moklamine and 7 guests