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?
if (messageType === "up-to-date")
[code:f5suyvh5] Cnds.prototype.OnUpdateNotFound = function ()
[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:
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 ASHLEY.
Interesting feature, for browser-based game is a must have. Thanks Toby, +1 here!
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
Develop games in your browser. Powerful, performant & highly capable.
or at least the ability to invert certain browser events.
On update found
On update not found
On update ready
On update not ready