Slowdown after playing a fairly large game for a while

0 favourites
  • 8 posts
From the Asset Store
This Student Workbook uses both Construct 3 & 2 encoding. It supplies client-side & php "back-end" encoding.
  • 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

  • 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?

  • 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.

  • 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...

  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Like 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.

  • Check your global objects, and global layers.. if you have global objects and global layers, it might be duplicating them.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)