How do functions run?

0 favourites
  • 4 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • If by chance a function is called at the exact time multiple times in the same tick.

    Will the function run multiple times parallel or will it run multiple times in a queue?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was told that CPU limits to only 1 task at a time.

    I just want to confirm, but I think it doesn't fully matter since C3 reads logic in order one line at a time.

  • Functions will run as you call them and finish before anything else runs.

    The exemption of that is if you make the function asynchronous which just means it will start and run in the background while the event sheet continues with the rest of the sheet. I haven’t used it but I remember seeing it as a setting for functions.

    The async functions could be implemented in a few ways. One is with webworkers which could mean the processing could be done on another core. Another is chunks of each async function would be run at a time.

    Typically the main issue with multi threading is when multiple things are trying to modify the same thing, so I have no idea how that’s handled. Maybe it’s not at all? Maybe the manual has info about that.

    At any rate even async functions are run in the order they are called. Nothing is at the same moment.

    Typical uses of async stuff is loading a file from disk or a website. Maybe even a large loop doing something with an array. It’s not suited well when multiple async things are trying to change the same stuff. That will be unpredictable behavior with which will change it first.

  • I have been away for a while, I should of known that. Thanks

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