How crippling to performance are cell counts and pins?

Discussion and feedback on Construct 2

Post » Sat Aug 06, 2016 10:29 pm

So I have this one level in particular that suffers from bad frame skips. It's a huge level with 3000 objects (cavestage_5 @ashley). Far from all of these are present in canvas at any given time, but the only thing I really see excelling on this layout is the object count, cell count, and objects pinned to something. Is any of these a potential CPU hog? In a previous iteration every pin action was performed at the beginning of layout, while a video was loading. I softened this out by removing the video source and being more selective with when the pin actions takes place. This improved it somewhat, but not entirely. I'm still on the fence wether I should cut this layout into several smaller ones. The layouts that performs best in Klang are the ones with a very small object count after all.

Thanks
B
35
S
10
Posts: 386
Reputation: 3,265

Post » Sat Aug 06, 2016 11:58 pm

It's the object count versus what the objects are doing.
You can have a lot of objects on the screen if they aren't doing anything, however 3000 is a lot, even if they are static.
Image ImageImage
B
170
S
50
G
179
Posts: 8,378
Reputation: 113,425

Post » Sun Aug 07, 2016 4:40 am

On my PC I can have 10,000 objects at 60fps if they aren't doing anything... however I can have only 2,000 objects and fps is down to 30-35 if everything is doing complicated movements, etc.

I'm not sure exactly what would be causing your issue - but I found doing some simple optimistations like having a core condition "is on-screen" made a HUGE difference to performance for doing things like rotating body parts for my characters etc. If they aren't on screen it ignores all of the IK solver chain and just uses "set X/Y" position to lighten the load.

If you have a lot of moving stuff in the layout maybe only "move" them when they're within certain bounds of the viewport maybe, or even destroy them until the player gets closer to the position where they will be required.

In my map layout I have literally over 300,000 objects and it runs perfectly - because it's only drawing around ~500 or so objects at any given time on the viewport - and nothing is moving.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Sun Aug 07, 2016 10:48 am

The profiler tab of the debugger is the only interesting place to look for CPU measurements. Otherwise you're just guessing.

As @SoldjahBoy said object count alone has minimal impact on performance, it's what they're doing. If you're also talking about collision cells, they usually do a lot to improve performance! The count is just an indication of the memory overhead, which is usually not important.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,351

Post » Mon Aug 08, 2016 2:17 am

@Ashley That was exactly my point. You can have pretty much as many objects as you want if they are doing nothing or very little. When things start moving and calculating collisions that's when the performance begins to be affected with loads of objects.

Another good tip to observe is (like in my case I didn't even realise at the time) to turn off collisions for objects that don't need it. For example my weather effects don't need collision calculations - but collisions were enabled for those objects. I have maybe 600-800 "rain objects" at any time when it's raining, and the fps drop was noticeable. After disabling collisions for those objects it freed up a lot of CPU usage. :D

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499


Return to Construct 2 General

Who is online

Users browsing this forum: gameba and 1 guest