[Request] Add "On update not found" to Browser plugin

  • Hi Ashley,

    Current offline related conditions in the Browser plugin allow us to determine if an update is available and if it's downloaded. Which is great and works well if we want to allow user to keep on playing the old version while downloading a new one in the background.

    However very often it would be more suitable to check the new version availability at start (in the loader layout for instance) and reload (update) the game to ensure that the player is always playing the newest version before letting him enter the actual game.

    Currently it is not possible because we do not have any trigger that will tell us "I checked for an update and there is none available". So if there is no update available, we can't check if the update has been checked already or not.

    I took a look at the code and I saw that your Service Worker is already sending such message ("up-to-date") to the Browser plugin. The only thing that lacks is a condition and a little logic. I temporarily altered the Browser plugin to test it and it works flawlessly.

    I investigated and implemented all the needed code which I'm sharing below. Would you mind adding it to the official Browser plugin release please?

    == runtime.js

    if (messageType === "up-to-date")
    			this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateNotFound, this);
    		else[/code:f5suyvh5]
    
    [b]== runtime.js[/b]
    [img="https://puu.sh/z7mOf/c671fb35fd.png"]
    [code:f5suyvh5]	Cnds.prototype.OnUpdateNotFound = function ()
    	{
    		return true;
    	};[/code:f5suyvh5]
    
    [b]== edittime.js[/b]
    [img="https://puu.sh/z7mQF/32d5288e70.png"]
    [code:f5suyvh5]AddCondition(22, cf_trigger, "On update not found", "Offline", "On update not found", "Triggers when no update has been found.", "OnUpdateNotFound");[/code:f5suyvh5]
    
    The result allows something like below:
    [img="https://puu.sh/z7mVG/e821b29d34.png"]
    
    Simply saying, the user will always run the newest version once it's been uploaded to the server.
    
    [b]== EDIT (bug found):[/b]
    I just noticed that SW is not sending "up-to-date" message when the code is exported with minification. It works well without minification.
  • This would be awesome!

  • I agree, this works and should be updated in the offical plugin

  • Thanks Toby!

  • +1

  • Interesting feature, for browser-based game is a must have. Thanks Toby, +1 here!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know why this isn't apart of the browser plugin already but this is a +1 for me too

  • Awesome! This would be very useful

  • +1

    or at least the ability to invert certain browser events.

    On update found

    On update not found

    On update ready

    On update not ready

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