Love.js - A Direct Emscripten Port

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

Re: Love.js - A Direct Emscripten Port

Post by Davidobot » Sun Sep 13, 2020 10:39 am

MadByte wrote:
Sat Sep 12, 2020 7:22 pm
I tested it on desktop Chrome / Chromium as well - same issue. :P
I think it has to do with different resolutions and/or scaling/dpi.
D0NM wrote:
Sun Sep 13, 2020 7:44 am
Now trying to see where does our Zabuyaki stop working with lovejs.
Stifu wrote:
Sat Sep 12, 2020 1:06 pm
Disabling shaders
I finally figured out why some shaders don't work. It's a matter of strict type casting. So if you have any multiplication/division with floats/doubles, you need to make sure that both numbers are written as doubles. So something like (taking screen to be a vec2 in the example)

Code: Select all

screen / 2
won't work, but

Code: Select all

screen / 2.0
will!
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

User avatar
ivan
Party member
Posts: 1614
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Love.js - A Direct Emscripten Port

Post by ivan » Sun Sep 13, 2020 5:53 pm

Hey, I almost got this working in compatibility mode.
First off I got the following error:

Code: Select all

Error: [string "boot.lua"]:530: conf.lua:21: attempt to index a nil value
love.js:9 stack traceback:
love.js:9 	[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
love.js:9 	[C]: in function 'error'
love.js:9 	[string "boot.lua"]:530: in function <[string "boot.lua"]:380>
love.js:9 	[C]: in function 'xpcall'
love.js:9 	[string "boot.lua"]:787: in function <[string "boot.lua"]:780>
love.js:9 	[C]: in function 'xpcall'
Basically I am trying to load the game's options file in conf.lua using love.filesystem.load
After removing my conf.lua completely I managed to get it started.
I see my splash screen but everything goes black after that point.
The music and menus seems to work, but the screen is totally black.
I tend to use scissors a lot and no shaders at all.
I can provide a love file upon request.
Any tips on getting this fixed?

User avatar
pgimeno
Party member
Posts: 2311
Joined: Sun Oct 18, 2015 2:58 pm

Re: Love.js - A Direct Emscripten Port

Post by pgimeno » Sun Sep 13, 2020 7:24 pm

ivan wrote:
Sun Sep 13, 2020 5:53 pm

Code: Select all

Error: [string "boot.lua"]:530: conf.lua:21: attempt to index a nil value
What about showing what conf.lua line 21 does?

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

Re: Love.js - A Direct Emscripten Port

Post by Davidobot » Sun Sep 13, 2020 7:53 pm

ivan wrote:
Sun Sep 13, 2020 5:53 pm
Hey, I almost got this working in compatibility mode.
...
The music and menus seems to work, but the screen is totally black.
I tend to use scissors a lot and no shaders at all.
I can provide a love file upon request.
Any tips on getting this fixed?
If you use scissors, you might need to specify some setCanvas flags. Like the *boolean stencil (false)* on this page: https://love2d.org/wiki/love.graphics.setCanvas

Much like the android port, this one is quite picky this things.

Also, Firefox and chrome render things differently, so try with different browsers.
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

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

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Sun Sep 13, 2020 8:13 pm

Davidobot wrote:
Sun Sep 13, 2020 10:39 am
I finally figured out why some shaders don't work. It's a matter of strict type casting. So if you have any multiplication/division with floats/doubles, you need to make sure that both numbers are written as doubles. So something like (taking screen to be a vec2 in the example)

Code: Select all

screen / 2
won't work, but

Code: Select all

screen / 2.0
will!
Thanks for the tip, we'll try that. :)
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

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

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Mon Sep 14, 2020 7:44 am

Ah, by the way, a feature request. Running love-js game.love game -d (-d for double, or something) could generate a lovejs package which would contain the code for both the pthread version and the compatibility version, and during execution, it'd detect if your browser supports pthreads in order to pick the best version. What do you think?
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

User avatar
ivan
Party member
Posts: 1614
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Love.js - A Direct Emscripten Port

Post by ivan » Mon Sep 14, 2020 10:21 am

pgimeno wrote:
Sun Sep 13, 2020 7:24 pm
ivan wrote:
Sun Sep 13, 2020 5:53 pm

Code: Select all

Error: [string "boot.lua"]:530: conf.lua:21: attempt to index a nil value
What about showing what conf.lua line 21 does?
Attached is my .love file if you want to take a look, but note that it's a big project.
I had to remove my conf.lua to circumvent this issue.
My game tried to use love.filesystem.read from conf.lua and that was causing the crash.
Looks like the next hurdle to overcome is "cannot resume normal coroutine".
Davidobot wrote:
Sun Sep 13, 2020 7:53 pm
Much like the android port, this one is quite picky this things.
Keep up the great work, I would definitely use love.js for all of my game demos if I mange to get it working.
Attachments
arena.love
(13.99 MiB) Downloaded 48 times

User avatar
slime
Solid Snayke
Posts: 2899
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Love.js - A Direct Emscripten Port

Post by slime » Mon Sep 14, 2020 11:21 am

Davidobot wrote:
Sun Sep 13, 2020 7:53 pm
If you use scissors, you might need to specify some setCanvas flags. Like the *boolean stencil (false)* on this page: https://love2d.org/wiki/love.graphics.setCanvas

Much like the android port, this one is quite picky this things.
FWIW, scissors don't need any special setup or setCanvas flags - they don't require a stencil buffer or anything else. They should work everywhere all the time on all platforms.

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

Re: Love.js - A Direct Emscripten Port

Post by Davidobot » Mon Sep 14, 2020 1:05 pm

ivan wrote:
Mon Sep 14, 2020 10:21 am
My game tried to use love.filesystem.read from conf.lua and that was causing the crash.
Looks like the next hurdle to overcome is "cannot resume normal coroutine".
The "cannot resume normal coroutine" happens if there are errors in the coroutine (loading.lua in this case)

Here's a .love that I modified to get it passing the splash screen. I don't recall all the changes (you can do a git diff) but it was something like:
- Use love.filesystem.getInfo(fn) before attempting to read a file to make sure it exists. (in app.read) [this was for loading bindings.lua or something]
- Make sure to use doubles in the shaders (1 -> 1.0; 0 -> 0.0)

It currently crashes when trying to load the level. I'll leave that up to you though ;)
Stifu wrote:
Mon Sep 14, 2020 7:44 am
Ah, by the way, a feature request. Running love-js game.love game -d (-d for double, or something) could generate a lovejs package which would contain the code for both the pthread version and the compatibility version, and during execution, it'd detect if your browser supports pthreads in order to pick the best version. What do you think?
Could you make an issue on GitHub with the request? It's easier for me to keep track of things that way.
Attachments
arena.love
(13.99 MiB) Downloaded 44 times
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

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

Re: Love.js - A Direct Emscripten Port

Post by Stifu » Mon Sep 14, 2020 3:11 pm

Davidobot wrote:
Mon Sep 14, 2020 1:05 pm
Could you make an issue on GitHub with the request? It's easier for me to keep track of things that way.
Sure. But I can't find the Issues page on your repo. Is it disabled, maybe?
On my own GitHub repos, I have an "Issues" tab between the "Code" and "Pull requests" ones, but there is none on your repo. Typing the /issues URL does not work either and redirects me to /pulls.

Edit: this has been resolved, and the issue has been created.
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests