Particle CPU hog

Bugs will be moved here once resolved.

Post » Wed May 13, 2015 5:14 am

Problem Description
A one shot particle eventually takes 100% CPU

Attach a Capx ... .capx?dl=0

Description of Capx
I, on purpose, blasted the screen with a bunch of particles. Remove some of these lines if it brings your computer to a complete halt. The purpose is to show that eventually, the FPS at first goes right down... then eventually speeds up as the particles exit the screen. Then after waiting approximately 15-20 minutes (900+ seconds), the FPS drops down to near frozen state again... eventually it sometimes crashes the browser. This works BEST on a slower computer... and must be done without WebGL.. but will work on any speed computer eventually.

Steps to Reproduce Bug
  • Load game and observe FPS
  • Wait till most particles leave the screen and observe FPS
  • Wait 15-20 minutes (900+ seconds), and observe FPS drop again

Observed Result
FPS Drops down, and CPU consumption rises.

Expected Result
CPU consumption should not rise at all.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
Windows 7 64BIT

Construct 2 Version ID
204.2... but has happened for many months... only recently found out what the issue was after many hours of testing.
Posts: 201
Reputation: 4,625

Post » Thu May 14, 2015 3:11 pm

Closing as won't fix. I can reproduce, but what is happening is you are creating one-shot particles that effectively are never destroyed. The size of the particles object is a box bounding all the particles, and as particles wander off in all directions, the box gets bigger and bigger. The engine uses collision cells as an essential optimisation to keep collision testing fast, but one thing it has to do for that is update which cells an object is in, and a huge and continually expanding object requires an increasing burden of collision cell updating, which is what happening. Also significantly you have set a gravity, so it's not just a linear rate the object expands: it's accelerating.

I can't imagine why it's useful to do this anyway: either you want the particles to disappear after a while, in which case you should let them be destroyed, or you want to keep the particles on-screen, in which case you should make them continuous and have a timeout, or just use sprites which wrap to the layout.
Scirra Founder
Posts: 25,073
Reputation: 199,682

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests