About function and timetick

0 favourites
  • 3 posts
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)