confusing performance

Discussion and feedback on Construct 2

Post » Sat Feb 28, 2015 2:35 am

@Colludium
I tested your capx, On Col was using 94% CPU versus around 10% of Is Overlap with Trigger Once.
B
68
S
24
G
19
Posts: 1,755
Reputation: 17,553

Post » Sat Feb 28, 2015 2:51 am

@Silverforce - I had about the same - the On-Collision has a massive and surprising overhead to it. I would certainly use Overlap / Trigger Once if the situation allows; however, if you need to know whenever a collision happens to a new object, while another similar object is overlapping, the On Collision trigger seems to be the simple way to go (although I'm sure that you could use Overlap with an array for a much better result in situations like this). I'm pretty sure that Ashley said in another thread that the two methods in that example are essentially identical - but that clearly isn't the case!
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 » Sat Feb 28, 2015 2:54 am

...Just to add - the main difference is that a second or subsequent overlap condition will not be registered by using overlap/trigger once, whereas the On Collision does detect multiple occurrences of collisions between multiple objects.
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 » Sat Feb 28, 2015 3:13 am

Silverforce wrote:Each bullet has to check against enemies, each enemy has a separate left & right shield which when depleted, the collision is ignored and checks if it collides with the hull afterwards. Drones also check for collision to enable/disable some movement.


Looking at your collision count in the screenshot, even though you have 1300+ objects, it doesn't actually do a lot of collision checks (approx. 115 / t). Which obvious is because it not 900-1200 bullets, but mostly all kinds of other objects. But you could try for fun to increase the fire rate of your ships and maybe set the bullet damage to 0 or something and just really let the ships fire like crazy to crank up the numbers of bullets and see how much performance drops and how quickly. Because with low amount of objects, you wont really see a huge difference. And 115 /t collisions are very low already, which ofc is just good that you don't need more.
B
44
S
11
G
2
Posts: 1,181
Reputation: 6,816

Post » Sat Feb 28, 2015 3:16 am

Colludium wrote:@Silverforce - I had about the same - the On-Collision has a massive and surprising overhead to it. I would certainly use Overlap / Trigger Once if the situation allows; however, if you need to know whenever a collision happens to a new object, while another similar object is overlapping, the On Collision trigger seems to be the simple way to go (although I'm sure that you could use Overlap with an array for a much better result in situations like this). I'm pretty sure that Ashley said in another thread that the two methods in that example are essentially identical - but that clearly isn't the case!


In my context, most of the col occur with bullets or lasers and such so I can do Is Overlap -> disable collision of bullet & spawn various effects then destroy bullet. So it only triggers once.

On Col seem to have a very high overhead and its limiting the CPU in other ways, because even in situations where its 40% CPU usage, the fps isn't 60, its down to ~40.
B
68
S
24
G
19
Posts: 1,755
Reputation: 17,553

Post » Sat Feb 28, 2015 7:10 am

I think this is a big deal, we should ask @Ashley about this.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Sat Feb 28, 2015 7:58 am

Number of objects too large
B
14
S
2
Posts: 15
Reputation: 788

Post » Sat Feb 28, 2015 8:25 am

FYI to everyone: debug readings are not to be trusted. If you really want to run comparisons, make a spritefont readout and populate it with fps/cpu/objCount/etc.

Anyway: When I experimented with this back a few months ago, my impression was that 'on collision' and 'is overlapping' tended to be similar to each other vis-a-vis CPU usage. However, when pushed really hard (bullet hell shooter with thousands of bullets), 'is overlapping' had pretty consistent performance, whereas 'on collision' seemed to cause more instances of stutter and slowdown, even if the average CPU/FPS was the same.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,187

Post » Sat Feb 28, 2015 9:31 am

Interesting findings. I'm seeing a improvement by doing this (image below), though compared with the complex collision checks going on in the other event sheets, this is still taking up the most % which I don't quite get. As @TiAm says though debug readings are not 100% accurate.

@Hasuak - yes I have very silly naming conventions haha.

Image
B
43
S
13
G
8
Posts: 606
Reputation: 7,360

Post » Sat Feb 28, 2015 11:16 am

TiAm wrote:FYI to everyone: debug readings are not to be trusted. If you really want to run comparisons, make a spritefont readout and populate it with fps/cpu/objCount/etc.

Anyway: When I experimented with this back a few months ago, my impression was that 'on collision' and 'is overlapping' tended to be similar to each other vis-a-vis CPU usage. However, when pushed really hard (bullet hell shooter with thousands of bullets), 'is overlapping' had pretty consistent performance, whereas 'on collision' seemed to cause more instances of stutter and slowdown, even if the average CPU/FPS was the same.


I know that the readings are not 100% accurate, but I don't see the huge importance in that, as stated earlier, its not that important whether its 90.1% CPU Util or 91.3%. But that you can and will see a difference in performance and a severe FPS drop, which you don't have to measure really because you can see everything is lagging around.

According to the r155 collision changes that someone posted earlier, not all of it seems to be working as stated there. It says that for optimal performance it is suggested that you put "Is overlapping" before any other picking condition to avoid C2 having to brute force collision checks. However in another program I made for testing collision, I get better performance (10-13 FPS improvement) when putting "Is overlapping" as the last condition, after Im done with the picking conditions, which should make it brute force and therefore give worse performance, but its the exact opposite from my experience at least. And that test is with 1700-2000 moving objects, so 10-13 fps is not a small increase.

(After running it again, its actually more like 17-23 fps with 1740 object)
B
44
S
11
G
2
Posts: 1,181
Reputation: 6,816

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests