High CPU Usage Mystery

Get help using Construct 2

Post » Mon Feb 01, 2016 2:39 am

.CAPX: https://www.dropbox.com/s/x0raalfkw3rku3z/Pacman%20Rush%200-2-1.capx?dl=0
C2 RELEASE: r221 (stable)
ISSUE: Prior to adding any events or objects for the Ghosts in my Pacman remix game, everything seemed to be operating okay in terms of overall game speed. But upon adding the Ghosts (there is supposed to be 16 total, 4 of each color), the CPU usage amps up to between 90-100%+.
I toggled all event lines for the Ghosts as disabled, removed the Ghosts from the layout entirely...nothing helped. So I saved the .capx and restarted C2. At first, it seemed to work. But when I re-added all 16 Ghosts and re-enabled the event lines (incomplete as they are), the same problem resumes. After several seconds, the game seriously bogs down. It's playable, but the framerate hits near-bottom and is basically slugging.

None of my past projects have really gotten so far to the point where I've encountered this problem seriously, and even those past projects had DOZENS of objects with particle effects, no less. So I'm at a loss as to what's causing this slowdown. Your insight would be greatly appreciated. Thank you.

UPDATE: I think I have solved the problem.
In the in group (line 111) "Ghosts At Junction", I added a condition that checks for the lerp value of the shifting walls and then told it only to update the junction values just once while true. I re-ran the game and it is still going fine after a couple minutes. :)
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
139
S
22
G
8
Posts: 777
Reputation: 14,830

Post » Mon Feb 01, 2016 2:56 am

Glad you figured it out. I was just about to say that I can tell it has something to do with a process, probably a loop of some kind, that isn't being closed whenever the walls move because it gets slower after every subsequent move.
B
11
S
2
G
1
Posts: 172
Reputation: 1,486

Post » Mon Feb 01, 2016 3:04 am

@teacherpeter - Yeah, originally I thought it might be a For Each loop I had going... SOMETHING that was demanding a LOT of checks per tick.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
139
S
22
G
8
Posts: 777
Reputation: 14,830


Return to How do I....?

Who is online

Users browsing this forum: Fradno and 16 guests