## Love.js - A Direct Emscripten Port

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

### Re: Love.js - A Direct Emscripten Port

ivan wrote: Wed Feb 03, 2021 6:53 am The love file has to be in the same folder as the player until we figure this out.
Happy Wednesday I attached a prototype thing I quickly whipped up that allows anyone to drag-and-drop a .love file into your player and it will run. It's incredibly ugly and I hacked together some code to make it work, but it works There is also a bunch of needless checks, and I disabled caching (bc I didn't have time to test it) and fallback to compatibility version (bc it needs to be slightly smarter than changing URL)

There is also a live version on my website: https://davidobot.net/lovejs/lovejsplayer/index.html

EDIT 2: you can make compat work by probably pre-loading (depending on the user agent) the correct js files.
Attachments
lovejsplayer.zip
My projects: Raycaster, love.js v11.3 port
My library: LovelyMoon
gianmichele
Citizen
Posts: 57
Joined: Tue Jan 14, 2014 11:03 pm

### Re: Love.js - A Direct Emscripten Port

yep yep yep, definitely working. I love it!
Popolon
Prole
Posts: 11
Joined: Mon Nov 07, 2016 11:03 am
Location: France/Paris

### Re: Love.js - A Direct Emscripten Port

Nice job ! On Linux, it works perfectly on Falkon browser (Webkit based) but not at all on Firefox.
The Compatibility version work with Firefox.
Stifu
Party member
Posts: 104
Joined: Mon Mar 14, 2016 9:53 am
Contact:

### Re: Love.js - A Direct Emscripten Port

Popolon wrote: Thu Feb 04, 2021 10:34 pm Nice job ! On Linux, it works perfectly on Falkon browser (Webkit based) but not at all on Firefox.
The Compatibility version work with Firefox.
I guess it doesn't work with Firefox simply because it's missing the required headers:
In Firefox, the normal version can throw Uncaught ReferenceError: SharedArrayBuffer is not defined. Fix is discussed here. TL;DR Enable the following HTML reponse headers on the website you're hosting your project on:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Stifu
Party member
Posts: 104
Joined: Mon Mar 14, 2016 9:53 am
Contact:

### Re: Love.js - A Direct Emscripten Port

Hey guys.

I noticed Zabuyaki stopped working with love.js (remember, it is auto-refreshed from sources, so it's auto-updated regularly). The error visible in the browser console is: "Uncaught RangeError: source array is too long"

According to my tests, it seems related to the size of the game.data file. It seems it got too big for love.js to handle. Now our game is 9478 KB zipped, and doesn't work with love.js anymore. I recompressed it manually using 7zip, using the Ultra compression level, and that slims it down to 9284 KB, enabling it to work again with love.js.

Is this a known issue?
ivan
Party member
Posts: 1723
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: Love.js - A Direct Emscripten Port

Have you tried defining the allocated memory?
If you are using the love.js player you can change the memory using the &m= argument ?g=game.love&m=MEMORY
Stifu
Party member
Posts: 104
Joined: Mon Mar 14, 2016 9:53 am
Contact:

### Re: Love.js - A Direct Emscripten Port

Actually, it works with the love.js player without any arguments. I guess it does something different.

For what it's worth, I'm on a love.js version from September 2020, but the commits since then don't seem related to my problem, so it doesn't look like it's worth updating to try and fix my issue.
ivan
Party member
Posts: 1723
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: Love.js - A Direct Emscripten Port

I have a followup update on the LoveJS Web player.
It can now load files from arbitrary locations:

Code: Select all

example.com/lovejsplayer/?g=path/to/my/game.love
The supplied path is relative to the lovejsplayer's install directory (cross-domain requests will not work)

Code: Select all

&f=1         disables the fullscreen button
&r=1         disables caching
&m=10000000  desired memory to allocate in bytes
&c=1         compatibility mode
Looks like everything works fine although we are still getting some 'out of memory' crashes here and there.
Will post another update if I figure out a good way to handle this.
Attachments
lovejsplayer.zip