About function and timetick

Get help using Construct 2

Post » Sun May 05, 2013 4:42 pm

Let's say I create a function in my event sheet, and in this function, it is invoked in every tick, and the function might require 100, 200 or 300 millisec, to complete. Whether we need 100, 200 or 300 is all random.

Now, here is the question:

Is the function in C2 "thread-safe" or synchronized of some sort?

Suppose:

At timetick A, the function is invoked and need 300 millisec to complete.
At timetick B, which occurs after timetick A, let's say about 10 millisec, the function is invoked and need 100 millisec to complete.

Will this same function on timetick B will blocked until execution of timetick A is complete, or both timetick A and B can occur simultaneously?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
23
S
9
G
11
Posts: 408
Reputation: 8,015

Post » Sun May 05, 2013 5:48 pm

Whole event sheet is calculated each tick. No need to worry about concurrency with C2. :)

So at timetick A, function would start executing and the timetick would last the whole 300ms. At timetick B the function would execute again, and timetick would take again as long as calculating the whole event sheet takes.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sun May 05, 2013 6:03 pm

Also, while using events, if you want them to happen only once on the time, make sure to use "Once while true" on the conditions.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,200
Reputation: 18,317


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jul and 17 guests