Slowdown after playing a fairly large game for a while

Discussion and feedback on Construct 2

Post » Thu Jun 08, 2017 7:32 am

So, my brother and I have been working on a 2D side scrolling Metroidvania type game for about a year now. The game is getting pretty large, and what I've noticed is that the frame rate begins to drop dramatically after playing for a while and going through several layouts. On a fresh startup, the game runs fine, but eventually the FPS goes down the drain. If you restart the game, problem fixed, but we surely don't want players to have to restart the game in order to have a consistently playable frame rate.

Has anyone else experienced this that can offer any advice? My initial thought would be that some things aren't getting unloaded from memory after layout changes, and it eventually bogs everything down. But everything I've read from Ashley's blogs seems to indicate that C2 loads and unloads everything per layout.

I know a CAPX would be helpful, but I'm hesitant to post it because we have tons of hand made pixel art that I'd rather not make readily available on the internet ;) .

If I need to offer any more details, please ask. I appreciate any help!

EDIT: Our game is only for desktop, so we shouldn't have a hardware bottleneck
B
17
S
4
Posts: 11
Reputation: 963

Post » Thu Jun 08, 2017 10:48 am

Does it happen only if you play actively for a while, or does it bog down if you just leave the game running without playing as well?

What does the task manager say about memory usage over time? Does it grow?

What does the debug profiler say about cpu usage over time and on different layouts?
B
38
S
16
G
6
Posts: 537
Reputation: 7,582

Post » Thu Jun 08, 2017 11:52 am

Construct 2 memory management is great and pretty efficient so its not that for sure, it has to do something on how you arranged your events. You probably don't destroy the objects that leave the screen so after a while they build up and its making the game to lag.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,357

Post » Thu Jun 08, 2017 6:05 pm

@hookecho

Yeah, I would check how many objects there are at the start and later when things bog down. It could be something like every bullet you fire is still flying out there way off screen, or other objects building up over time. Check how many collision checks it is doing. make sure anything off screen is not doing stuff that is cpu intensive...
B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Fri Jun 09, 2017 8:09 pm

@ErekT

It happens either way. I've just tested it for about 8 hours today and my task manger shows that my CPU and memory usage stay pretty consistent. CPU rarely goes over 50% and memory stays around 50-60% (I only have 4 gigs).

However, I just noticed the debugger says my estimated CPU usage is around 90% when the slowdown begins, and it never seems to fully recover. I have no idea what could be using so much CPU power.

@imhotep22 @AllanR

I do have a couple of layouts that use bullets as weather effects (like rain and snow). For example, I have a raindrop sprite that is created every 0.025 seconds at a random X position relative to the main character, and the bullet behavior causes it to fall to the ground. I'm pretty sure they're set to destroy when they hit the ground, but wouldn't they be destroyed anyway at the end of the layout? Or do bullets persist from layout to layout?

Also, is it possible that having to check for a collision for each rain/snow particle is too much work for the engine? Or that creating that many sprites so fast is causing slowdown?

What I really don't understand is why it works perfectly on a fresh start (even the heavy particle layouts), but deteriorates over time.

Thanks for your responses
B
17
S
4
Posts: 11
Reputation: 963

Post » Fri Jun 09, 2017 9:26 pm

You can check in the debug more to see what events take the most CPU usage. If it gets over +90% its an processing issue rather then graphical rendering, you probably have to many collision checks per second, to many bullets flying on the screen, or to many enemies calculating path to the player etc etc.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,357

Post » Sat Jun 10, 2017 2:10 am

Like @AllenR said, have you checked the object count in the debugger? At the point when the game is slowing down, what does the object count do? Does it stay constant, or is it increasing? If you have a situation where objects are being created and not destroyed you would see the object count gradually increasing and eventually that could slow the game down.
B
65
S
46
G
57
Posts: 385
Reputation: 35,690

Post » Sat Jun 10, 2017 2:42 am

Check your global objects, and global layers.. if you have global objects and global layers, it might be duplicating them.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests