How should I use every tick (performance)

Get help using Construct 2

Post » Mon Jun 09, 2014 12:44 pm

Thanks @Arima. I was coming back to the thread after reading an entry from the SDK manual, just learned that. That's pretty huge.
Sorry for those misconceptions about C2, this boils down to some prior experience with CJS which had big garbage collector issues, at least a couple of months ago.
@Scofano, it seems like you won't need to bother with pooling :)!
B
79
S
22
G
4
Posts: 311
Reputation: 12,774

Post » Mon Jun 09, 2014 4:10 pm

Thanks, both of you.
B
33
S
5
G
1
Posts: 163
Reputation: 2,693

Post » Tue Jun 10, 2014 3:40 am

What is the (performance) difference between:

everytick -> do something

- and -

if global variable = 1 -> do something

Would both of them use "everytick" speed?
B
33
S
5
G
1
Posts: 163
Reputation: 2,693

Post » Tue Jun 10, 2014 7:15 am

Most of the performance questions in this thread are meaningless. Read the blog post Optimisation: don't waste your time
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,681

Post » Tue Jun 10, 2014 12:20 pm

Scofano wrote:What is the (performance) difference between:

everytick -> do something

- and -

if global variable = 1 -> do something

Would both of them use "everytick" speed?


All of the event sheet (except triggers) conditions are checked every tick, you should not worry about every tick, just make sure you don't do useless actions or conditions (if you want something to happen, does it have to happen every tick, or only on particular cases? When you are checking for a condition, is it really nessecary, or can you filter down even more if that is intensive), there is no magic, no wizardry, just see what you event sheet does, and when it does it, if there are redundancy or things that should not be done in some particular cases, because it serves no purpose to do it, then don t let the system do it.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Jun 10, 2014 9:40 pm

Ashley wrote:Most of the performance questions in this thread are meaningless. Read the blog post Optimisation: don't waste your time


Thanks Ashley
B
33
S
5
G
1
Posts: 163
Reputation: 2,693

Post » Tue Jun 10, 2014 9:43 pm

All of the event sheet (except triggers) conditions are checked every tick, you should not worry about every tick, just make sure you don't do useless actions or conditions (if you want something to happen, does it have to happen every tick, or only on particular cases? When you are checking for a condition, is it really nessecary, or can you filter down even more if that is intensive), there is no magic, no wizardry, just see what you event sheet does, and when it does it, if there are redundancy or things that should not be done in some particular cases, because it serves no purpose to do it, then don t let the system do it.


Thanks, I´ll try to lower to zero unnecessary calls.
B
33
S
5
G
1
Posts: 163
Reputation: 2,693

Post » Tue Jun 10, 2014 10:30 pm

Also remember that sometimes, optimising something is not necessary, you have to see what is really taking down your game so you can optimise that in particular, this is why you should care more about organisation at first rather than optimisation, a disorganised code is too hard to optimise correctly, and also too hard to expand it, keep things organised, and everything will be easier, not only to optimise, but also to go further into developing your game.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Jun 10, 2014 10:40 pm

Aphrodite wrote:Also remember that sometimes, optimising something is not necessary, you have to see what is really taking down your game so you can optimise that in particular, this is why you should care more about organisation at first rather than optimisation, a disorganised code is too hard to optimise correctly, and also too hard to expand it, keep things organised, and everything will be easier, not only to optimise, but also to go further into developing your game.


I´ve been trying to separate in groups, so when something is not active, I disable the group and save processing.

Do you know any "rules", or tips, hints to better organize the code?
B
33
S
5
G
1
Posts: 163
Reputation: 2,693

Post » Tue Jun 10, 2014 10:48 pm

Includes are good to keep things organised by catégories (ennemi AIs in one event sheet, decorative elements in another, inputs in another one, etc..)

Groups can really help subdivising things (for exemple: one group per ennemi AI), and that can be deactivated in some cases to reduce the impact on the CPU

functions are a pretty neat thing, it help not having to repeat constantly the same things over and over, or subdivising complex math calculations, which also helps if you need to modify something (having to modify it only once rather than a lot of times). local variables and constants are also pretty good to have this "change once apply everywhere in the code" effect.

My primary objective is to try to always code in a similar way, so if there is a problem, I have an idea of where the problem can be located.

The debbuger is a good tool to have an idea of what is happening, also, sometimes I read the entire event sheet, from top to bottom, to see if there is something that doesn't feels right.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: dand, mageekm, oosyrag and 30 guests