0 Favourites

performance (2 questions)

This forum is currently in read-only mode.
  • Since the fps, ingame, sometimes drops from 35 to 10, for about 2-3 seconds (I found out which group is responsible for it) and goes back to ~35, I have the following questions:

    1 sprite gets created (as in tetris blocks, but all blocks are the same) multiple times (not at once), so that eventually there are 20-60 instances of this sprite are on screen.

    question 1:

    • do the amount of private variables (in this case) affect performance?
    • do the amount of animations (ranging from 1-5 frames) affect performance?

    question 2:

    Can it be that the "for each"-condition can be the cause of the framedrop, when there are 30-50 sprites on screen?

    (the for each-condition states: for each sprite that overlaps with a certain box, create a new "extra points"-sprite. - so that every box, that overlaps that certain box, shows to the gamer that it is earning the extra points - by displaying that "extra points-sprite".)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I doubt it is the variables. Might be the for each if they are checking collisions.

    What is the group controlling?

  • The group holds a collection of events, where most of the events check for overlapping/collision, as described in the starting post.

  • It is most likely that the group, that you found responsible for the framerate drop, contains loops that run longer than you intended, or create more objects than you intended. Did you have a look at the debugger to see how many objects actually are created during those events? And, if you change, for testing purposes, the loops to always create a fixed amount of sprites, instead of collision checking, does it also drop the framerate?

  • In the debugger I was paying attention to the creation of objects.

    It is not the case that more and more objects are created.

    So, at some time it says: 400 objects created and it stays around this amount, while the framedrop happens.

    So it could be a loop, the foreach, or something else.

    With this topic, I wanted to learn some general things about performance.

    (and perhaps it could help with my own problem)

  • For each/loops can be a problem if your running them all the time and doing lots of stuff.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
331 35,573
Lordshiva1948's avatar
Lordshiva1948
Unread hot topic
353 32,102
yojona's avatar
yojona
Unread sticky
192 1,337,456
Kyatric's avatar
Kyatric Construct Team Support