Is there a CreateWorker in the plug-in SDK similar to the scripting SDK?

0 favourites
  • 4 posts
  • Is there a CreateWorker plug-in API similar to the one in the scripting SDK? I do not see it in the docs. I am testing workers in my plug-in and want to use the official method to create more workers from the C3 runtime running in a worker.

    If there is not now and you need me to make a aha request, I can do that.

  • I've added the request to aha here: construct3-21h2.ideas.aha.io/ideas/C321H2-I-504

    In the meantime, I've been using the scripting SDK version to test (though I would rather use the plug-in API version) and it is very effective for 3DObject with higher polygon models with animation. See below for the flame chart with a number of different models each with their own worker for animation processing and a big increase in possible performance with multiple models.

    On initialization of each instance, I transfer the model and animation data once to the worker and then each tick() use postMessage from the C3 runtime thread (via plug-in) to request for animation update with a certain animation type and time stamp. When the worker is finished, I transfer the new vertex data back to the C3 runtime worker thread using an ArrayBuffer transferable, which I can read as a float array using a DataView. Using a transferable makes the transfer quick, even though a lot of data is sent. The CreateWorker API has been really handy for all of this, thanks for the nice tooling that is already there. In the C3 runtime, the plug-in uses the latest data available to do the model rendering. I am also examining ways to consider doing sync gates between worker and C3 worker runtime.

    For more complex models, I also change the animation update rate to 30 fps and this works well to allow for more latency between worker animation processing and rendering (which always runs at 60 fps using the latest available vertex data.)

    This has been inspired by the C3 RTS blog and how Ashley is doing the RTS server using a worker.

  • As I mentioned on the suggestion, plugins can already create workers in their DOM scripts, so there doesn't seem to be any need for a helper method to work around the limitations of nested workers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, I replied on the Aha site.

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