is a event sheet continuously looping?

Discussion and feedback on Construct 2

Post » Wed Oct 22, 2014 7:26 pm

thanks
Dan
B
8
S
3
G
1
Posts: 87
Reputation: 1,493

Post » Wed Oct 22, 2014 7:33 pm

Well:

The system will read your non trigger events from top to bottom (includes counts the same way too), once per tick (a tick triggers basically before each redraw), trigger events on the other hand can happen at anytime, even multiple times between two ticks.

So events are not continuously looped, only at certain times, but in a very frequent way (most displays refresh 60 times per seconds, thus implying 60 ticks per seconds)

Hope that awnser your question.
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 » Wed Oct 22, 2014 11:21 pm

@Aphrodite , may I ask what happens with the loops? When for example we have something like this:

-everytick ----> set Sprite X to self.X + 30 * dt
-Repeat 100 times ----> add 1 to variable Y
-etc

The Repeat event how much does it "last" when C2 reads the Event Sheet? I know that without the repeat 100 times, C2 will add 1 at every every tick, but with the loop condition what is happening under the hood? Does the program "halt" until the CPU adds the 100 values and then it continues to the next event?

I am a bit confused with the looping logic in programming

danno55 , sorry for highjacking your topic, but I thing there is some relevance into this.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Wed Oct 22, 2014 11:36 pm

Loops run in 1 tick.
So something like "Repeat 1000 times" or "For "x" from 0 to 1000" will happen in 1 tick.
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,598
Reputation: 34,823

Post » Thu Oct 23, 2014 1:11 am

@shinkan , ok, but will they happen incrementally, or it will just go from 0 to 1000 at once? And if they do happen incrementally, isn't this adding more calculation time between each tick? I mean, surely a repeat 1000 times event should demand 1000 more calculations than just a single every tick event (both having the same actions). I hope I am not as stupid as I feel right now 8/

Thanks :)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Thu Oct 23, 2014 10:47 am

eli0s wrote:@shinkan , ok, but will they happen incrementally, or it will just go from 0 to 1000 at once? And if they do happen incrementally, isn't this adding more calculation time between each tick? I mean, surely a repeat 1000 times event should demand 1000 more calculations than just a single every tick event (both having the same actions). I hope I am not as stupid as I feel right now 8/

Thanks :)


It will repeat indeed, a repeat 1000 times does 1000 the same thing, however C2 have some "cache calculations" to reduce the amount of identical calculations sometimes, also, you should only use loops when they are useful (using a loop to add 1 to a variable with a repeat 1000 times is not useful, adding 1000 is more direct, however if you want to create between 1 and 20 objects and placing them one after another, then create them within a loop like "repeat X times" where X varies from 1 to 20 is useful), in most cases, if you dont know if a loop is a good solution, it probably is not, when it is useful however, it is kind of visible.
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 » Thu Oct 23, 2014 2:08 pm

@Aphrodite , thank you for the clarification. It's the concept behind some actions that confuses me. Since I am not a programer and I am introduced to programming concepts within Construct, I feel that sometimes the logic is very clear ("do x get y"), however the lack of foundational knowledge (in programing) other times make the logic behind conditions and procedures feel somewhat obscure. I can't really put in in words, it's more like a feeling, some steps seem to be way steeper than others. Perhaps this is something that someone that has a background in programming doesn't experience as vividly as I do.

Enough psychoanalysis for one post though, thanks again for the information ;o)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Thu Oct 23, 2014 2:28 pm

eli0s wrote:@Aphrodite , thank you for the clarification. It's the concept behind some actions that confuses me. Since I am not a programer and I am introduced to programming concepts within Construct, I feel that sometimes the logic is very clear ("do x get y"), however the lack of foundational knowledge (in programing) other times make the logic behind conditions and procedures feel somewhat obscure. I can't really put in in words, it's more like a feeling, some steps seem to be way steeper than others. Perhaps this is something that someone that has a background in programming doesn't experience as vividly as I do.

Enough psychoanalysis for one post though, thanks again for the information ;o)


A quick exemple: I did a land generation concept based on arrays and tiledbackgrounds (was before the tilemap), and basically the land would generate in 4 times:

First populating the array
then correct some values in it
then apply some filtering
then create the objects

The way it was done, it took 4 ticks to do it
believe me, those 4 ticks were long (60 seconds for all of them combined), so you cann see the execution is stopped

Afaik the only heavy calculation C2 does that will not stop the game (aka: done in parralel) is the pathfinding algorythm.
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


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests