love.js standalone player

Discuss any ports of LÖVE to different platforms.
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.js standalone player

Post by ivan »

Thank you for the clarification. I will take a look at this issue when I have a chance.
The same fix is available for Apache as an .htaccess file.
glitchapp
Party member
Posts: 264
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: love.js standalone player

Post by glitchapp »

Hi, I'm trying to pack the game for love.js and below you can find the errors that appear when I run the server which is done with python: python -m SimpleHTTPServer 8000

My game is here: https://codeberg.org/glitchapp/fish-fil ... llets-mini

Code: Select all

Failed to allocate internal command buffer.
WebGL context was lost. love.js:1:63325
Uncaught out of memory
Failed to allocate internal command buffer. love.js:1:63325
After refreshing the website I receive the following errors:

Code: Select all

bad name in getProcAddress: glIsVertexArrayOES,glIsVertexArray love.js:1:27310
    ASM_CONSTS http://localhost:8000/release-compatibility/love.js:1
    _emscripten_asm_const_iii http://localhost:8000/release-compatibility/love.js:1
    tnb http://localhost:8000/release-compatibility/love.js:13
    _eglGetProcAddress http://localhost:8000/release-compatibility/love.js:1
    pKb http://localhost:8000/release-compatibility/love.js:17
    hhb http://localhost:8000/release-compatibility/love.js:12
    aab http://localhost:8000/release-compatibility/love.js:16
    vea http://localhost:8000/release-compatibility/love.js:9
    Tza http://localhost:8000/release-compatibility/love.js:8
    tua http://localhost:8000/release-compatibility/love.js:8
    uea http://localhost:8000/release-compatibility/love.js:9
    Saa http://localhost:8000/release-compatibility/love.js:9
    GS http://localhost:8000/release-compatibility/love.js:7
    wEb http://localhost:8000/release-compatibility/love.js:17
    invoke_iiiii http://localhost:8000/release-compatibility/love.js:1
    rq http://localhost:8000/release-compatibility/love.js:6
    xGa http://localhost:8000/release-compatibility/love.js:5
    sIa http://localhost:8000/release-compatibility/love.js:5
    zGa http://localhost:8000/release-compatibility/love.js:5
    RFa http://localhost:8000/release-compatibility/love.js:5
    REb http://localhost:8000/release-compatibility/love.js:17
    invoke_vii http://localhost:8000/release-compatibility/love.js:1
    sGa http://localhost:8000/release-compatibility/love.js:5
    DGa http://localhost:8000/release-compatibility/love.js:5
    QFa http://localhost:8000/release-compatibility/love.js:5
    BKa http://localhost:8000/release-compatibility/love.js:5
    xGa http://localhost:8000/release-compatibility/love.js:5
    sIa http://localhost:8000/release-compatibility/love.js:5
    zGa http://localhost:8000/release-compatibility/love.js:5
    PFa http://localhost:8000/release-compatibility/love.js:5
    bl http://localhost:8000/release-compatibility/love.js:6
    callMain http://localhost:8000/release-compatibility/love.js:24
    setStatus http://localhost:8000/release-compatibility/:61
    run http://localhost:8000/release-compatibility/love.js:24
    (Async: setTimeout handler)
    run http://localhost:8000/release-compatibility/love.js:24
    (Async: setTimeout handler)
    run http://localhost:8000/release-compatibility/love.js:24
    runCaller http://localhost:8000/release-compatibility/love.js:24
    removeRunDependency http://localhost:8000/release-compatibility/love.js:1
    applyMemoryInitializer http://localhost:8000/release-compatibility/love.js:24
    xhr_onload http://localhost:8000/release-compatibility/love.js:1
    (Async: EventHandlerNonNull)
    readAsync http://localhost:8000/release-compatibility/love.js:1
    doBrowserLoad http://localhost:8000/release-compatibility/love.js:24
    <anonym> http://localhost:8000/release-compatibility/love.js:24

Code: Select all

Error: [string "boot.lua"]:432: No code to run love.js:1:3407
Your game might be packaged incorrectly love.js:1:3407
Make sure main.lua is at the top level of the zip love.js:1:3407
stack traceback: love.js:1:3407
	(tail call): ? love.js:1:3407
	[C]: in function 'error' love.js:1:3407
	[string "boot.lua"]:432: in function <[string "boot.lua"]:274> love.js:1:3407
	[C]: in function 'xpcall'
I'm not sure what I'm doing wrong, any hints?
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.js standalone player

Post by ivan »

Based on the third error message, my question is: did you package and upload your .love file correctly? The "main.lua" file of your game should be in the top directory of the love/zip file. Furthermore, you can specify which .love file to run in the love.js player using the "g" parameter:

Code: Select all

https://example.com/lovejs_folder/?g=FishFilletsMini.love
The .love file must be in the same folder as the love.js standalone player.
glitchapp
Party member
Posts: 264
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: love.js standalone player

Post by glitchapp »

It is in the same folder, I packaged the game with: python ../emscripten/tools/file_packager.py game.data --preload FishFilletsMini.love@/ --js-output=game.js

and there are no errors after that command.

The game is properly packaged because it runs when I double click on it.

Not sure if the errors below help:

Code: Select all

76 localhost:8000:1245:21
76 localhost:8000:1257:21
    printErr http://localhost:8000/?g=FishFilletsMini.love:1257
    abort http://localhost:8000/love.js:24
    iKb http://localhost:8000/love.js:17
    Prb http://localhost:8000/love.js:13
    REb http://localhost:8000/love.js:17
    invoke_vii http://localhost:8000/love.js:1
    Nrb http://localhost:8000/love.js:13
    Mrb http://localhost:8000/love.js:13
    Lrb http://localhost:8000/love.js:13
    func http://localhost:8000/love.js:1
    callRuntimeCallbacks http://localhost:8000/love.js:1
    ensureInitRuntime http://localhost:8000/love.js:1
    callMain http://localhost:8000/love.js:24
    setStatus http://localhost:8000/?g=FishFilletsMini.love:1288
    <anonym> http://localhost:8000/love.js:24
    doCallback http://localhost:8000/love.js:1
    done http://localhost:8000/love.js:1
    reconcile http://localhost:8000/love.js:1
    syncfs http://localhost:8000/love.js:1
    <anonym> http://localhost:8000/love.js:1
    (Async: EventHandlerNonNull)
    getRemoteSet http://localhost:8000/love.js:1
    onsuccess http://localhost:8000/love.js:1
    (Async: EventHandlerNonNull)
    getDB http://localhost:8000/love.js:1
    getRemoteSet http://localhost:8000/love.js:1
    syncfs http://localhost:8000/love.js:1
    getLocalSet http://localhost:8000/love.js:1
    syncfs http://localhost:8000/love.js:1
    syncfs http://localhost:8000/love.js:1
    syncfs http://localhost:8000/love.js:1
    <anonym> http://localhost:8000/love.js:24
Uncaught abort(76) at jsStackTrace@http://localhost:8000/love.js:1:17162
stackTrace@http://localhost:8000/love.js:1:17345
abort@http://localhost:8000/love.js:24:15936
iKb@http://localhost:8000/love.js:17:40239
Prb@http://localhost:8000/love.js:13:238294
REb@http://localhost:8000/love.js:17:22497
invoke_vii@http://localhost:8000/love.js:1:301753
Nrb@http://localhost:8000/love.js:13:238073
Mrb@http://localhost:8000/love.js:13:236208
Lrb@http://localhost:8000/love.js:13:236143
func@http://localhost:8000/love.js:1:27935
callRuntimeCallbacks@http://localhost:8000/love.js:1:20413
ensureInitRuntime@http://localhost:8000/love.js:1:20929
callMain@http://localhost:8000/love.js:24:13954
setStatus@http://localhost:8000/?g=FishFilletsMini.love:1288:22
@http://localhost:8000/love.js:24:16564
doCallback@http://localhost:8000/love.js:1:131947
done@http://localhost:8000/love.js:1:132095
reconcile@http://localhost:8000/love.js:1:114867
syncfs/</<@http://localhost:8000/love.js:1:110926
@http://localhost:8000/love.js:1:112692
EventHandlerNonNull*getRemoteSet/<@http://localhost:8000/love.js:1:112599
getDB/req.onsuccess@http://localhost:8000/love.js:1:111591
EventHandlerNonNull*getDB@http://localhost:8000/love.js:1:111524
getRemoteSet@http://localhost:8000/love.js:1:112294
syncfs/<@http://localhost:8000/love.js:1:110791
getLocalSet@http://localhost:8000/love.js:1:112186
syncfs@http://localhost:8000/love.js:1:110718
syncfs/<@http://localhost:8000/love.js:1:132187
syncfs@http://localhost:8000/love.js:1:132110
@http://localhost:8000/love.js:24:16474

Code: Select all

If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information. love.js:1:301828
[post-exception status] All downloads complete. localhost:8000:1257:21
[post-exception status] Preparing... (0/1) localhost:8000:1257:21
[post-exception status] Preparing... (0/2) localhost:8000:1257:21
[post-exception status] Preparing... (1/2) localhost:8000:1257:21
[post-exception status] All downloads complete. localhost:8000:1257:21
[post-exception status] Running... localhost:8000:1257:21
    printErr http://localhost:8000/?g=FishFilletsMini.love:1257
    setStatus http://localhost:8000/?g=FishFilletsMini.love:1307
    run http://localhost:8000/love.js:24
    runCaller http://localhost:8000/love.js:24
    removeRunDependency http://localhost:8000/love.js:1
    applyMemoryInitializer http://localhost:8000/love.js:24
    xhr_onload http://localhost:8000/love.js:1
    (Async: EventHandlerNonNull)
    readAsync http://localhost:8000/love.js:1
    doBrowserLoad http://localhost:8000/love.js:24
    <anonym> http://localhost:8000/love.js:24
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.js standalone player

Post by ivan »

Hello again. I know very little about Python servers.
You need to make sure the headers are set correctly as described below:

Apache
https://github.com/2dengine/love.js/blob/main/.htaccess

NGINX
viewtopic.php?p=249988#p249988
gianmichele
Citizen
Posts: 67
Joined: Tue Jan 14, 2014 11:03 pm

Re: love.js standalone player

Post by gianmichele »

is this now in sync with love 11.4?
Thanks a lot for doing this btw!
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.js standalone player

Post by ivan »

@gianmichele
Yes, it should be compatible with 11.4 (at least in theory)

I only wrote the frontend for love.js, whereas the actual port is maintained by Davidobot.
The source code is released under the MIT License although I am considering switching to zLib in order to be better aligned with the other versions of Love2D.

I just rewrote the love.js player to use the Fetch API and to take advantage of more modern JavaScript features:
https://github.com/2dengine/love.js

We need to bring more attention to love.js so it can become a part of the official Love2D distribution.
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.js standalone player

Post by ivan »

Just pushed two significant fixes to GitHub:

- loaded files are cached based on the URI not just the package name
- fixed a module/import bug
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.js standalone player

Post by ivan »

Just pushed another update:

- love.js will now show the "nogame" screen if the loaded resource is not a valid ZIP archive
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: love.js standalone player

Post by milon »

ivan wrote: Mon Jul 17, 2023 7:04 am We need to bring more attention to love.js so it can become a part of the official Love2D distribution.
That's an awesome idea! How do we do that? What's the actionable step(s) that forum users can take?
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests