-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a web app version using love.js and GitHub Pages #72
Comments
Davidobot/love.js#7 using love.audio.stop on only a single source resolves the issue |
Website now hosted on https://github.com/FormularSumo/Star-Wars-Galaxy-Collection-Web. |
The only noticeable difference was the audio restarting/sometimes changing
Character duplication occurs whenever sortdeck() is called I believe |
Caused character duplication occasionally (on website version or when auto-sorting disabled)
Character duplication fixed |
It might now be possible to get video working using a workaround discussed here #72 (comment) |
Another important thing is to get it working as a PWA. This is currently working fine on Firefox. It doesn't work on Chromium or Safari/iOS. Install prompts would be good. Screenshots too. |
Somehow Chromium was unable to detect the manifest file when the script was placed about it, now it does.
PWA is now working on (iOS) Safari and partially working on Chromium. On Chromium it's still just saying add to home screen not install, I think adding a screenshot might fix this? Additionally on Chromium and Firefox on Android the logo has an extra white box around it which is not supposed to be the case. |
Install still not working on Chromium, maybe service workers are still needed? |
Turns out it just wasn't finding the files. Installs is now working in Chromium, with screenshots and browser prompts. The logo is now correct on Chromium and Firefox too |
It would be good to get the app working offline using a service worker. The app resolution and screen filling also still need fixing on mobile... Also the fullscreen button is not needed on Android when installed as a PWA on Chromium (is on Firefox), and doesn't do anything on iOS |
Changing the scope now enables it to work offline, the service workers correctly update. I'm not sure what happens if there is an update to what's hosted on the server now |
I attempted to fix resizing using https://github.com/MrcSnm/Love.js-Api-Player) but turns out console wrapping is disabled by github pages so that doesn't work. |
Testing results
|
I've been trying to get threads working on the web version since #81, however I've been unable to make it work so far. I've switched to compiling in non-compatibility mode and included love.worker.js. I've yet to get the "Uncaught ReferenceError: SharedArrayBuffer is not defined" error, but to be thorough I also tried using a script (from this issue) to add the correct cross-origin headers, as Github pages doesn't support this, but without any effect. I've also done all my testing with the game and the Love wiki thread example. My testing has been in localhost anyway, which I think should support the headers, at least with the extension I've temporarily installed to always enable. Also strange is the Love.js compatibility example does not work with threads despite saying it should, and the non-compatibility one won't run whatever I do (extension, firefox/chrome, whatever). So I think I'm going to have to conclude that threads are currently broken in Love.js and easiest thing is if I just rewrite it to be like it was previously, doing image decoding on the main thread :/ I should test on Github pages as well just to double check, and also check if non-compatibility mode works there on all browsers - if so would presumably be better than compatibility mode ("dodgy audio") |
Initial test of non-compatibility mode: works fine in Firefox and Chrome, not Safari (who would have guessed). Testing now with cross-origin script |
This is now fixed by the above commit |
For some reason desktop Chromium browsers are using the monochrome logo for PWA installation, on Windows and Linux. Meanwhile Chromium on Android is using the non-monochrome one even with "themed icons" on. Idk who thought that was a good idea. For the meantime, might be best to just remove the monochrome icons until they're working, maybe follow/open relevant Chromium bug tracker issue. |
Service Workers should update more reliably now as they return this.skipWaiting() so don't require a full page close/open to reload. I've also outputted to console when a new content is downloading. Seems to be working as desired as per FormularSumo/Galaxy-Collection#72 (comment)
Changing to |
Non game code (fullscreen button) is also updating now, on Chrome desktop and Firefox mobile at least. Firefox desktop is is refusing to for some reason. |
I've now tried only caching the files which should be needed to run the game - index.html/love.js/love.wasm/game.js. However, now the game isn't updating at all. I assume that somehow game.data not being cached is causing it not to update, which shouldn't happen but is. I'm thinking that potentially I could disable caching in game.js and then enable it here instead. |
So my current thoughts are that what I'm doing should be working, but isn't (nobody's said that before), and I have 3 options.
For now, 1 seems like the best approach. It's not great to duplicate ~70MB on the user's device for no good reason, but is seems to be the only approach that'll avoid all the other pitfalls. And if I do get it working without lots of reloads then I can revisit trying to get it working again after. |
If I then reload the service worker, it does get deleted while still using the latest version |
I've now set the page to reload after a new service worker is activated, with the aim of then causing new game data to download (if applicable). Unfortunately whether the new service workers decides to find the new game.js file seems to be incredibly temperamental. Sometimes it does, straight away, other times it only does if it's been awhile (only if not already reloaded?) (maybe 10 minutes?) and other times it requires a new service worker or game.js to be deleted. |
Also, Firefox seems reliably slightly slow at updating service workers, anywhere from 10-40(?) minutes, whereas Chrome does it instantly. |
It currently seems to be working reasonably reliably. Still not working straight away, and sometimes more reloads needed, but more often than not it seems to be working as intended (across Linux/Android/iOS) which is good... Deleting the game.data cache is only working when you reload the page, which is better than only when there's a new service worker, but still not ideal. |
Monochrome icon on desktop mostly fixed I think FormularSumo/Galaxy-Collection-Web@5832f9e (Windows needs testing still). Still no monochrome icon on Android, but I don't think Google/Chrome have got around to implementing that yet. Hopefully when they do it'll just work. |
FormularSumo/Galaxy-Collection-Web@e02f166 Added some in-game screenshots to web install (not allowed on Play Store build) |
Returning to resizing shenanigansUsing mostly default Love.js (pre FormularSumo/Galaxy-Collection-Web@c9fcd71) game doesn't really resize on mobile except sometimes when you enter/exit fullscreen. On the plus side it's never rendered off-screen or stretched. (Check this) Using this solution: Davidobot/love.js#16 in the Chrome mobile device emulator, until I click on it, the game is always filling the screen, but (CSS) stretching instead of resizing correctly. After I click it doesn't resize at all. And after entering or fullscreen, it works perfectly... If I then add the resizeCanvas function/listener, it causes the game to seemingly never resize (Chrome emulator)... although according to my above comment this is Love2d not resizing rather than the canvas Using Davidobot/love.js#50 (comment) doesn't change behaviour except for when in fullscreen, then it stretches instead of resizing on Chrome emulator. Might retest later if I can fix initial resizing not working. |
Now that 0.12 has been officially released and the web build is largely functional/stable, I'm going to close this issue and migrate the remaining issues into https://github.com/FormularSumo/Star-Wars-Galaxy-Collection-Web/issues |
Repo and web-specific issues - https://github.com/FormularSumo/Star-Wars-Galaxy-Collection-Web
Partially fixes #31, allowing the game to be run on iOS as a web app. Also adds support for macOS (which I don't currently build for) and any platforms not supported by Love2D, and is generally an easier way to play the game than downloading and installing it.
Using
https://github.com/Davidobot/love.js
https://pages.github.com/
The text was updated successfully, but these errors were encountered: