performance (2 questions)

For questions about using Classic.

Post » Thu Sep 15, 2011 9:31 am

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".)
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Thu Sep 15, 2011 10:51 am

I doubt it is the variables. Might be the for each if they are checking collisions.

What is the group controlling?
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Thu Sep 15, 2011 10:59 am

The group holds a collection of events, where most of the events check for overlapping/collision, as described in the starting post.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Thu Sep 15, 2011 11:32 am

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?
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Sep 16, 2011 10:11 am

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)
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Fri Sep 16, 2011 10:34 am

For each/loops can be a problem if your running them all the time and doing lots of stuff.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests