Frame Drop Issue

0 favourites
  • 4 posts
From the Asset Store
three fully animated characters ideal for your RPG side scroller projects
  • Hello,

    I added water streams into my game that affect enemies and the player depending on the direction they flow. I did this by changing the enemy or player's speed if they are overlapping a stream. I didn't notice frame drops at first, but now that there are more enemies in streams, I'm starting to notice it. I checked debug and I'm dropping about twenty frames. Here's a picture of the events for one of the enemies. I put "trigger once" and "only while on screen" onto all of them but that hasn't seemed to help. Is there something I'm missing?

    Thanks,

    Snalec

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Remember that it reads from the top to the bottom, so it always starts by doing those two expensive for each loops

  • Thanks! Turns out I really didn't need the for each stream condition. Taking those out of all the stream events got the frame rate back to normal.

  • Generally you want to put For Eaches after the rest of your conditions, when possible

    For example

    Donut is on screen

    For each Donut

    is MUCH better than

    For Each Donut

    Donut is on screen

    The reason is because "is on screen" filters out all the donuts, and THEN goes over them one by one

    If "for each" is first, then C3 goes through EACH DONUT one by one, and then checks if it's on screen. Much slower

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