Love.js - A Direct Emscripten Port

Discuss any ports of LÖVE to different platforms.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Davidobot »

gianmichele wrote: Mon Dec 21, 2020 11:24 pm I was playing some sheepolution games and all need chrome to run. Any reason for this? Will this ever run on mobile Safari?
The compatibility mode runs on nearly all browsers but has poor audio support right now.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Stifu
Party member
Posts: 106
Joined: Mon Mar 14, 2016 9:53 am
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Stifu »

Maybe Safari needs that security header thingy like Firefox does? Or does it only work in compatibility mode?
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com
gianmichele
Citizen
Posts: 63
Joined: Tue Jan 14, 2014 11:03 pm

Re: Love.js - A Direct Emscripten Port

Post by gianmichele »

Is this the year where finally love.js will become official? :D
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Davidobot »

gianmichele wrote: Wed Jan 20, 2021 6:49 pm Is this the year where finally love.js will become official? :D
If I get a general research grant for the summer I can spend that time working on whatever I want ;)
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Love.js - A Direct Emscripten Port

Post by ivan »

Yes, that would be awesome!
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Love.js - A Direct Emscripten Port

Post by ivan »

Hey, I decided to work a little bit on the love.js frontend. I think the way love.js game are built (using node.js) is way out of reach for most love2d users. Why can't we just use URL parameters like so:
https://2dengine.com/lovejs/?c=0&m=250000000 <- live demo
?c=1 or ?c=0 sets the compatibility mode (the player starts out in release mode and automatically fallbacks to compatibility mode if an error occurs - the compatibility mode works on mobile browsers so it's an important fallback IMO)
?m=250000000 sets the amount of memory
?r=1 disables the cache
Everything works fine, but I need help with a couple of things. loadPackage in game.js has the .love filesize hardcoded in there. Is the file size necessary just because of the loader? Can't we determine this size during the xmlrpc request? Any other tips on making this work as a standalone player so it can be embedded on websites? I think it would be super cool if it can switch games as a URL parameter. I would have just one of these players on my website and it could showcase all of my game demos (this would be an enormous advantage, especially if games/demos can be embedded on external websites).

Attached is what I have so far, without the "game.data" file. With a little bit of help I think we can make this a part of the love.js repo.
Attachments
lovejsplayer.zip
(3.16 MiB) Downloaded 569 times
gianmichele
Citizen
Posts: 63
Joined: Tue Jan 14, 2014 11:03 pm

Re: Love.js - A Direct Emscripten Port

Post by gianmichele »

WOW! Thanks ivan, was just looking for this. The beauty of love is that I just need the engine and a text editor, no bloat around. With love.js following the same path I would be a really happy coder :D
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Love.js - A Direct Emscripten Port

Post by ivan »

We should be thanking Davidobot, because he has put in most of the work behind love.js and knows its inner workings. Let's hope he can help us out in making a standalone love.js player. That would bring in more devs onboard.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Davidobot »

ivan wrote: Mon Feb 01, 2021 8:23 pm Hey, I decided to work a little bit on the love.js frontend. I think the way love.js game are built (using node.js) is way out of reach for most love2d users.
Hi ivan!

Thanks for your work on this! I didn't really consider node.js out-of-reach, but this definitely simplifies things for the better. In my opinion, an ideal way of presenting this would look something like this:
- have an official hosted web player on the love2d.org domain. Maybe have some forum link-in that can automatically run .love files uploaded here? This wouldn't require too much web space and as it is a static page and most processing would happen on the client-side. Perhaps an updated and official version of https://schellingb.github.io/LoveWebBuilder/run-project
- have a small .exe/app file distributed with love whereby one can just drop a .love file or folder onto the application and it will package it and run a webserver to test the game.
ivan wrote: Mon Feb 01, 2021 8:23 pm Why can't we just use URL parameters like so:
https://2dengine.com/lovejs/?c=0&m=250000000 <- live demo
?c=1 or ?c=0 sets the compatibility mode (the player starts out in release mode and automatically fallbacks to compatibility mode if an error occurs - the compatibility mode works on mobile browsers so it's an important fallback IMO)
?m=250000000 sets the amount of memory
?r=1 disables the cache
We definitely can have something like this! This looks super. Especially the fallback mode - we should definitely get that into the main repo. It solves this issue: https://github.com/Davidobot/love.js/issues/5
ivan wrote: Mon Feb 01, 2021 8:23 pm Everything works fine, but I need help with a couple of things. loadPackage in game.js has the .love filesize hardcoded in there. Is the file size necessary just because of the loader? Can't we determine this size during the xmlrpc request?
I think the filesize is there exclusively for displaying the loading progress bar. You can easily check a file's size when handling upload via JS: relevant SO.
ivan wrote: Mon Feb 01, 2021 8:23 pm Any other tips on making this work as a standalone player so it can be embedded on websites? I think it would be super cool if it can switch games as a URL parameter. I would have just one of these players on my website and it could showcase all of my game demos (this would be an enormous advantage, especially if games/demos can be embedded on external websites).
I think if we go down the LoveWebBuilder route, one can just provide a URL to a hosted .love file as a parameter to the webplayer and it should be able to compile it down and run it. This would make running things from this forum a lot more accessible :)

Thanks again for your work. Please submit a pull request on GitHub!
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Love.js - A Direct Emscripten Port

Post by ivan »

Davidobot wrote: Tue Feb 02, 2021 1:28 pm - have an official hosted web player on the love2d.org domain. Maybe have some forum link-in that can automatically run .love files uploaded here? This wouldn't require too much web space and as it is a static page and most processing would happen on the client-side. Perhaps an updated and official version of https://schellingb.github.io/LoveWebBuilder/run-project
Yes, looks cool.
Davidobot wrote: Tue Feb 02, 2021 1:28 pm - have a small .exe/app file distributed with love whereby one can just drop a .love file or folder onto the application and it will package it and run a webserver to test the game.
This is a cool idea, but not essential. Most people will expect to drop their .love file and assume that it works.
Davidobot wrote: Tue Feb 02, 2021 1:28 pm We definitely can have something like this! This looks super. Especially the fallback mode - we should definitely get that into the main repo. It solves this issue: https://github.com/Davidobot/love.js/issues/5
You are right, a better way would be to check the "user agent" string to determine if the browser supports release mode.
Davidobot wrote: Tue Feb 02, 2021 1:28 pm I think the filesize is there exclusively for displaying the loading progress bar. You can easily check a file's size when handling upload via JS: relevant SO.
Line 40 in game.js is "xhr.onprogress" which finds the file size automatically, so we don't need to hardcode this.
Davidobot wrote: Tue Feb 02, 2021 1:28 pm I think if we go down the LoveWebBuilder route, one can just provide a URL to a hosted .love file as a parameter to the webplayer and it should be able to compile it down and run it. This would make running things from this forum a lot more accessible :)
The .love file needs to be hosted on the same domain - otherwise there could be security issues.
I will look into but but I could use some help in figuring out how to change the hardcoded .love file.

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests