How do I add a JobWorkerScript to my behavior?

  • I am trying to create an async Pathfinding behavior but I can't get the jobworker to ..work.

    I've been pretty much following the official implementation (official pathfinder plugin) on this part since I haven't found any documentation related to async/jobworkers and such.

    I have a js file inside my c3runtime/ folder and after I've added it to my addon.json file-list, I've been trying to create a jobworker inside my c3runtime/behavior.js like this:

    but the game fails to start and the browser prompts me with this error:

    I am using Web Server for Chrome with CORS Headers checked but I don't think this is the problem since the first error is a GET FAIL.

    Plugin files: ufile.io/k7owm

    Thank you for your time.

  • *Update*

    I got this working after I exported the project as nw.js and copied the script file inside the application folder.

    It seems the thing that I got wrong here is the placement of the script file as it should be part of the application (even in preview mode), I think.

    Can somebody explain to me what I should do from here? Is there any command or 'folder' where I can place my script file in order to be fetched in preview mode?

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • *Update #2*

    I think I got it working by providing the web server path to my file. (http://localhost:xxxxx/c3runtime/name.js)

    So far it is only working in a dev testing environment, I have to do a little more digging to get the path once the addon has been normally installed. (for preview mode)

    Now my question is reduced I think to how do I "inject" a js file into my construct 3 application or project without the need to copy it manually.

  • Now my question is reduced I think to how do I "inject" a js file into my construct 3 application or project without the need to copy it manually.

    have you added this way?

    construct.net/en/make-games/manuals/addon-sdk/reference/specifying-dependencies

  • Oh, I used this when I was still in addon dev mode and commented it out. (used it wrongly tho 'copy-to-output' type)

    But now it makes sense, thank you Eren .

  • hopeslicer - could you please add a quick summary of what method worked for you in the end - for other devs looking at using worker scripting?

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