Chadori's Recent Forum Activity

  • Hi everyone,

    All addons are now rewritten for worker mode and modules, along with new features, sdk updates and bug fixes. A new version should be out in a few hours.

  • That's great! Thank you for the new additions.

  • By far the easiest solution is to load the SDK on the runtime side (i.e. in the web worker). If all the SDK does is use fetch/XHR/WebSockets etc., there's no reason it can't run in a worker: all those features are available in workers too. It may be that the SDK only needs a few minor changes, such as replacing window with self or globalThis, and then it may just work. You should ask the Photon developers about it.

    I followed your advice, and it seems to be the most practical solution. Thank you!

  • Thank you for your advice.

    However, this was actually a different matter, this is regarding Cordova plugins. It looks like the easiest way to handle traditional callbacks, in my opinion after porting a few addons.

    This is my sample:

    this.AddDOMMessageHandlers([
    	["on-mobile-sdk", e => this._OnMobileSDK(e)]
    ]);
    this.AddRuntimeMessageHandlers([
    	["StartSDK", e=> this._StartSDK(e)],
    	["Initialize", e => this._Initialize(e)]
    ]);
    

    Then,

    // Dom-Side.js
    _StartSDK()
    {
    	if (this._isMobile)
    	{
    		this._SDK = window["plugins"]["sdk"];
    		this.PostToRuntime("on-mobile-sdk", {});
    	}
    	else
    	{
    		console.warn("[Mobile SDK] You need to export to mobile in order to run.");
    	}
    }
    
    // Instance.js
    _OnMobileSDK()
    {
     this._isMobile = true;
    }
    

    This is more effective as you add more methods, the ones above are for the purpose of visualization.

    I was wondering if these are valid official SDK methods or should I rewrite it to what's supported. If it's not supported, could you kindly give me a quick reference to the methods I should use instead?

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You have to design around it. For example instead of directly accessing the "Is connected" state, post messages when the state changes to update a boolean on the runtime side, which can be accessed synchronously. This can end up being very complicated for more advanced state, and especially so when there is a real-time aspect.

    Thank you for the suggestion, I have already implemented it like that on simple SDKs like PlayFab. It updates the properties of the instance.js side whenever there are changes with the properties used by the method from the domside.js. Therefore, allowing me to recreate the SDK's synchronous methods in the instance.js.

    However, my issue is from convoluted SDKs like Photon's where its properties are updated from multiple branching sources. Which I agree what you've said, it is very complicated for more advanced state, which is why I'm asking for advice on how I can solve it in this advanced case. Thank you.

  • Here is the Photon JS SDK for context, in case you are curious.

  • Hi Ashley,

    There seem to be some SDKs that do not support worker threads, like Photon Cloud's SDK.

    Here are some sample methods:

    SDK.prototype.isConnected
    SDK.prototype.isInLobby
    SDK.prototype.isJoinedToRoom
    SDK.prototype.isConnectedToGame
    SDK.prototype.availableRooms
    

    These methods are in their SDK.js. The SDK.js is loaded through an external-dom-script dependency. However, there are methods that do not have anything to do with the DOM, which have properties that are only compared or parsed, hence synchronous.

    The issue is that I don't know a way for the domSide.js and instance.js to communicate synchronously. For instance, a condition called Is Connected or an expression called AvailableRooms().

    I could call PostToRuntime() every time the properties inside a method changes and recreate the methods inside the instance.js. However, most of the methods in the SDK are convolutedly hardcoded, there are no specific target where changes can be listened to, it would need an entire rewrite of the SDK, and that's not practical since the SDK will always be rewritten for every new version.

    I managed to workaround some simple SDKs like PlayFab. Although, SDKs or libraries like Photon can't seem to support it.

    Kindly advise. Thank you.

    Tagged:

  • Also, could you confirm if we can use these methods as well?

    this.AddDOMMessageHandlers([[handler, e => callback(e)]]);
    this.AddRuntimeMessageHandlers([[handler, e => callback(e)]]);
    

    Thank you.

  • Hi Ashley,

    Is the PostToRuntime(handler, data) an official SDK method, I can't seem to find it in the SDK and it is the method that best suits my addons. I can only find PostToRuntimeAsync being mentioned. Can you confirm?

    Thank you.

    Tagged:

  • Construct 3 r227.2 now allows the collection addons to work, please update your Construct 3 to the latest version. Until R11 releases, kindly set the Scripts Type property to Classic. Thank you.

  • Announcement

    Hi everyone, some of you might have noticed that the new modules support is causing issues with the collection addons. Until the issues are resolved, please use the stable r225 version for now.

    Due to some technicalities, mostly for support with older Android devices, we are required to implement the worker mode feature beforehand, to be able to overcome the current issues. These changes are also related to the new closure compiler support.

    It is a goal to release R11 soon, which will include the solution to these issues.

    The master collection will also be moved into GitHub for source control, in hopes of hastening the packaging time for each release, to save time for more maintenance and additions in the collection, and most especially for quick delivery of updates.

    Thank you for your time, that's all for now.

  • Yeah, I figured that could also be an issue.

    I understand. Thank you for your time.

Chadori's avatar

Chadori

Member since 10 Oct, 2014

Twitter
Chadori has 49 followers

Trophy Case

  • 10-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • RTFM Read the fabulous manual
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

24/44
How to earn trophies