Platform behavior and lag [Solved]

This forum is currently in read-only mode.
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • Okay, so I'm having some trouble with the platform behavior and a lot of objects on screen.

    In the cap, there's 2 layouts. One uses a basic follow camera, the other a sprite with

    the platform behavior. The Cam layout with the follow camera will handle 7, 8000 objects

    like a champ, with no framerate drops at all. The Plat layout, however, is unplayable.

    It only seems to lag when there's more than 2000 objects on the screen. The problem is

    that the game is going to exceed that almost always. I know that the random terrain generator is not optimized in it's current state, in that it will fill the whole layout, but it seems that

    regardless of how many objects there are over 2000, it will still lag just as badly.

    I'm wondering how to fix this, right now I'm thinking writing my own special stripped down

    platform behavior, but I'm hoping to avoid that. Or perhaps it's just my computer, I dunno.

    Help is always appreciated!

    The plat layout has standard platformer default controls. The cam layout uses the mousewheel

    to control the speed of the follower. You can destroy blocks by holding down LMB and mousing

    over them.

    You can download the cap right here.

    Thanks!

    EDIT: Clarity.

  • It's because of all the solid objects you're platform object is having to check for collisions with. With thousands of objects, that's thousands of collision checks every frame, which can be incredibly taxing.

    What you need to do is optimize your terrain generation. It would be best to only generate solid blocks in spots where it will be possible for the player to collide, and have the rest be non-solid blocks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ^^

    Yeah a good optimization might be the Canvas object. You can paste those objects into the canvas, destroy them, and then update the canvas collision mask. Keep in mind that this will exchange some vram for performance, so use it only where needed.

  • It's because of all the solid objects you're platform object is having to check for collisions with. With thousands of objects, that's thousands of collision checks every frame, which can be incredibly taxing.

    What you need to do is optimize your terrain generation. It would be best to only generate solid blocks in spots where it will be possible for the player to collide, and have the rest be non-solid blocks.

    After having slept on it, I came to that conclusion. I didn't think that it would be

    calculating collisions for every single object, so I had never tried using less solids.

    Very easy to fix, too.

    ^^

    Yeah a good optimization might be the Canvas object. You can paste those objects into the canvas, destroy them, and then update the canvas collision mask. Keep in mind that this will exchange some vram for performance, so use it only where needed.

    I will have to try that.

    You both have been a great help to me. Thank you!

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