Love.js - A Direct Emscripten Port

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

Re: Love.js - Port to LÖVE v11.3

Post by Davidobot » Fri Jul 31, 2020 3:27 pm

yetneverdone wrote:
Fri Jul 31, 2020 10:20 am
Hey awesome work on love.js! Can the README of the repo describe what's the difference between the original love.js?
Cheers! There is no code difference. It's meant to be a direct version update. Anything that doesn't work is probably down to wrong ES compiler settings on my part...
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

User avatar
Stifu
Citizen
Posts: 85
Joined: Mon Mar 14, 2016 9:53 am
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Fri Aug 07, 2020 10:03 pm

Davidobot, please help me get your version of love.js working. I tried to follow the instructions but I just don't get it.

Among the stuff I tried:
- Download and unzip "love.js-master.zip"
- Open Visual Studio Code (that's what I usually use when I need to work with npm, but I suck at this)
- Open the "love.js-master\src\release" folder from Visual Studio Code
- Open the Terminal
- npm install (which does a bunch of things)
- love.js .\mygame.love .\myoutputfolder (this just hangs the terminal somehow)
- love.js C:\fullpathto\mygame.love C:\fullpathto\myoutputfolder (same result as above)

I also tried npm install love.js (even though that's not what the readme.md says), and it seems to install something but then I can't manage to call it.

Help? Thanks.
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

User avatar
Davidobot
Party member
Posts: 1167
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Davidobot » Sat Aug 08, 2020 1:11 pm

Stifu wrote:
Fri Aug 07, 2020 10:03 pm
Davidobot, please help me get your version of love.js working. I tried to follow the instructions but I just don't get it.
If the love.js call doesn't work for some reason, you can just refer to index.js directly.

So while cd-ed into the directory where love.js is :

Code: Select all

./index.js path/to/game.love path/to/folder
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

User avatar
Stifu
Citizen
Posts: 85
Joined: Mon Mar 14, 2016 9:53 am
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Sat Aug 08, 2020 2:33 pm

Thanks, but I'm still stuck. From what I see, love.js and index.js are not in the same folder, and from what I understand, index.js internally calls love.js. index.js is in love.js-master, and love.js is in love.js-master\src\release. So I suppose I should just go to the right folder (and make it my working directory) depending on whether I want to use index.js or love.js.

I'm not even sure what tool to use to cd into the right directory. What do you use? I tried Visual Studio Code (gets stuck after each love.js or index.js command for some reason, forcing me to kill the terminal) and the Node.js or Windows command prompts (both ask me which program to use to open the .js file, and I don't know).

Edit: hmm, maybe I should use Node.js as the application to run the js file. I tried that, but when I do, Node.js opens with a prompt that says "Love file or directory:" (as if it ignored my command parameters which already specify that). I tried putting the full path to my .love file in there, but that only results in Node.js closing instantly. I wonder if that could be due to it not running with admin privileges or something.
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

User avatar
Davidobot
Party member
Posts: 1167
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Davidobot » Sat Aug 08, 2020 7:21 pm

Stifu wrote:
Sat Aug 08, 2020 2:33 pm
Thanks, but I'm still stuck. From what I see, love.js and index.js are not in the same folder, and from what I understand, index.js internally calls love.js. index.js is in love.js-master, and love.js is in love.js-master\src\release. So I suppose I should just go to the right folder (and make it my working directory) depending on whether I want to use index.js or love.js.
The proper folder to be cd-ed into is love.js-master. You're getting confused between love.js the node package and the file. The node package is just called love.js and running the command love.js just runs index.js under the hood. The love.js file found in src/release is the love binary compiled to JS.
Stifu wrote:
Sat Aug 08, 2020 2:33 pm
I'm not even sure what tool to use to cd into the right directory. What do you use? I tried Visual Studio Code (gets stuck after each love.js or index.js command for some reason, forcing me to kill the terminal) and the Node.js or Windows command prompts (both ask me which program to use to open the .js file, and I don't know).
Um, any terminal where you have access to node should be fine. I use the New Windows Terminal
Stifu wrote:
Sat Aug 08, 2020 2:33 pm
Edit: hmm, maybe I should use Node.js as the application to run the js file. I tried that, but when I do, Node.js opens with a prompt that says "Love file or directory:" (as if it ignored my command parameters which already specify that). I tried putting the full path to my .love file in there, but that only results in Node.js closing instantly. I wonder if that could be due to it not running with admin privileges or something.
Good, that means it's working. Just specify the .love file and output folder as command line arguments to running ./index.js
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

User avatar
Stifu
Citizen
Posts: 85
Joined: Mon Mar 14, 2016 9:53 am
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Sat Aug 08, 2020 9:28 pm

Davidobot wrote:
Sat Aug 08, 2020 7:21 pm
The proper folder to be cd-ed into is love.js-master. You're getting confused between love.js the node package and the file. The node package is just called love.js and running the command love.js just runs index.js under the hood. The love.js file found in src/release is the love binary compiled to JS.
Yeah, I'm pretty confused. So that means the node package is just optional, if I understand correctly. I'll ignore it then.
Davidobot wrote:
Sat Aug 08, 2020 7:21 pm
Good, that means it's working. Just specify the .love file and output folder as command line arguments to running ./index.js
As I said, my command arguments seem to get ignored.
I run this, for example:

Code: Select all

.\index.js C:\zabuyaki.love C:\Zabuyaki
Result: it asks me which program should be used to open index.js, and when I pick Node.js, the new Node.js prompt asks me "Love file or directory:", but no matter what I type in there, the prompt gets closed instantly and nothing happens.

Sorry for being dumb. By the way, I'm on Windows 7, I wonder if that could be a problem.
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

User avatar
Davidobot
Party member
Posts: 1167
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Davidobot » Sun Aug 09, 2020 6:20 am

Stifu wrote:
Sat Aug 08, 2020 9:28 pm
when I pick Node.js, the new Node.js prompt asks me "Love file or directory:", but no matter what I type in there, the prompt gets closed instantly and nothing happens.
How about if you pick node to the default program? Or call from the node terminal (why does Windows have so many?!)

"npm install" installs dependencies so it's not optional, as far as I'm aware.
Stifu wrote:
Sat Aug 08, 2020 9:28 pm
Sorry for being dumb. By the way, I'm on Windows 7, I wonder if that could be a problem.
No worries at all. This exchange could be useful to others. If you'd like, you can pm me the file and I can do the conversion for you, to even test if the game will run in Web.
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

User avatar
Stifu
Citizen
Posts: 85
Joined: Mon Mar 14, 2016 9:53 am
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Sun Aug 09, 2020 6:56 am

Davidobot wrote:
Sun Aug 09, 2020 6:20 am
How about if you pick node to the default program?
Oh, that changes things a bit! Instead of opening a new Node.js window, this makes everything stay in the Node.js command prompt.

Here's what I get:

Code: Select all

C:\Users\Blabla\love.js-master>.\index.js --title Zabuyaki C:\zabuyaki.love C:\Zabuyaki
Love file or directory: C:\zabuyaki.love
Output directory:
C:\Users\Blabla\love.js-master>
It does not matter what I put in "the Love file or directory:" line, then it just shows "Output directory:" without letting me type anything there, then puts me back from where I started. In other words, I think it does the same thing as it did when I manually picked Node.js as the program to run JS files, except now it's all displayed in a single window and it doesn't auto close anymore once it's done.
Davidobot wrote:
Sun Aug 09, 2020 6:20 am
Or call from the node terminal (why does Windows have so many?!)
Yeah, that's already what I do by default.
Davidobot wrote:
Sun Aug 09, 2020 6:20 am
"npm install" installs dependencies so it's not optional, as far as I'm aware.
I think I'm good on that side. My node_modules folder is filled with 205 folders for a total of 20 MB.
Davidobot wrote:
Sun Aug 09, 2020 6:20 am
No worries at all. This exchange could be useful to others. If you'd like, you can pm me the file and I can do the conversion for you, to even test if the game will run in Web.
Thank you. Well, I think we're close to getting it to work, so let's keep trying.
Maybe I should just record a video of everything I'm doing and send it to you. Maybe then you'll see what I'm doing wrong.

Edit: done recording that video, and sent it to you. Thanks.
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

User avatar
Davidobot
Party member
Posts: 1167
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Davidobot » Sun Aug 09, 2020 8:39 am

Stifu wrote:
Sun Aug 09, 2020 6:56 am
Edit: done recording that video, and sent it to you. Thanks.
I'll post it here because I think it's useful for everyone. Once you install Node, make sure it's included in PATH (such that you can run node and npm in normal terminal).

Then, after running npm install just run

Code: Select all

node index.js game.love game_folder
Windows by default apparently doesn't run .js files properly. Even from the Node terminal.

EDIT: I also updated the github readme. Doing npm link makes the command love-js (I renamed it) globally-accessible.
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

User avatar
Stifu
Citizen
Posts: 85
Joined: Mon Mar 14, 2016 9:53 am
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Sun Aug 09, 2020 9:32 am

Davidobot wrote:
Sun Aug 09, 2020 8:39 am
Once you install Node, make sure it's included in PATH (such that you can run node and npm in normal terminal).
I double checked and that was already the case.
Davidobot wrote:
Sun Aug 09, 2020 8:39 am
Then, after running npm install just run

Code: Select all

node index.js game.love game_folder
This worked! Hooray! Thank you very much. :)
Davidobot wrote:
Sun Aug 09, 2020 8:39 am
EDIT: I also updated the github readme. Doing npm link makes the command love-js (I renamed it) globally-accessible.
That's cool. I hope that helps other people.
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests