Love.js - A Direct Emscripten Port

Discuss any ports of LÖVE to different platforms.
Post Reply
User avatar
Homosexual
Prole
Posts: 1
Joined: Sat Feb 20, 2016 9:49 pm

Re: Love.js - A Direct Emscript'em Port

Post by Homosexual »

I just gave it a shot with a little project using only draw.circle and draw.text, and while the debug version worked fine the release on threw me a js exception. As I'm completely oblivious to .js, web stuff, and code in general, I haven't dug deeper into the problem.
I'm just here to say thank you, tanner. This is a -massive- step towards a future full of löve. :awesome:
pizza
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: Love.js - A Direct Emscripten Port

Post by Tjakka5 »

Coming back to my previous question on getting data from JS.

There's 2 things I really need love.js to do.
First one being, passing me the resolution of the browser window, so the game can scale accordingly.
And second.
Somehow reading data from the server, so I can, for example, put in block data in a .json, which it then will read and add to the game, without having to recompile the game.

You were saying you cant do that "right now", does that mean that we'll be able to in the (hopefully soon) future?
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Love.js - A Direct Emscripten Port

Post by Tanner »

Tjakka5 wrote:Coming back to my previous question on getting data from JS.

There's 2 things I really need love.js to do.
First one being, passing me the resolution of the browser window, so the game can scale accordingly.
And second.
Somehow reading data from the server, so I can, for example, put in block data in a .json, which it then will read and add to the game, without having to recompile the game.

You were saying you cant do that "right now", does that mean that we'll be able to in the (hopefully soon) future?
You don't need love.js to do either of those. You can change the canvas size with css and you can write arbitrary data to the emscripten filesystem from JS using the same API emscripten does in its compiled code.

https://kripken.github.io/emscripten-si ... rview.html

https://kripken.github.io/emscripten-si ... m-API.html
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: Love.js - A Direct Emscripten Port

Post by Tjakka5 »

Ah, thank you very much, I was already thinking of all kinds of complex ways to get data into love, totally forgot about the filesystem.
Bambo
Prole
Posts: 41
Joined: Thu Mar 24, 2011 8:23 pm
Location: Warrington, England
Contact:

Re: Love.js - A Direct Emscripten Port

Post by Bambo »

Hey, trying to build a game using the performance release doesn't seem to work for me.

It does work using the debug and compatability folder.

Here's a log:

Code: Select all

unreachable code after return statement love.js:8:100113
unreachable code after return statement love.js:11:65646
unreachable code after return statement love.js:14:205640
unreachable code after return statement love.js:8:100113
bad name in getProcAddress: glIsVertexArrayOES,glIsVertexArray love.js:1:27303

Error: [string "boot.lua"]:229: Already initialized love.js:1:3399
stack traceback: love.js:1:3399
	[C]: in function 'init' love.js:1:3399
	[string "boot.lua"]:229: in function <[string "boot.lua"]:223> love.js:1:3399
	[C]: in function 'xpcall' love.js:1:3399
Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters. love.js:1:3399
Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters. love.js:24:15713

uncaught exception: abort("Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.") 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
assert@http://localhost:8000/love.js:1:7547
_emscripten_set_main_loop@http://localhost:8000/love.js:1:70494
_emscripten_set_main_loop_arg@http://localhost:8000/love.js:1:281879
bl@http://localhost:8000/love.js:6:1273
callMain@http://localhost:8000/love.js:24:14301
Module.setStatus@http://localhost:8000/:61:13
run/</<@http://localhost:8000/love.js:24:15143

If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information. <unknown>
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Love.js - A Direct Emscripten Port

Post by Tanner »

It's hard to know what the issue might be without being able to see your code. The release builds don't give very helpful error messages.
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: Love.js - A Direct Emscripten Port

Post by MadByte »

I've trouble setting up the server. It gets stuck after the game file has been downloaded. It says "running" but nothing else happen (using Chrome).
Here is my installation:
Image

Pack.bat:

Code: Select all

@echo off 
%~dp0/python/python %~dp0/emscripten/tools/file_packager.py game.data --preload %~dp0/game@/ --js-output=game.js
Packages get created. I put them into the "release-compatibility" directory to test them.
Any obvious mistakes? Thanks in advance.
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Love.js - A Direct Emscripten Port

Post by Tanner »

Not sure. Can you use the debug directory and then post what you get in your browser console?
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: Love.js - A Direct Emscripten Port

Post by MadByte »

edit
alright, my mistake (case sensitivity issue in code).
thanks anyway.
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Love.js - A Direct Emscripten Port

Post by Tanner »

I've put a lot of work into getting Love to build with emscripten using the existing Love cmake build system. Everything seems to be working now. It's still not for the faint of heart but everything is much more consolidated and straightforward than it was before.

It requires, of course, the emscripten SDK to be installed. This project won't compile with the released binaries so you will need to use the pseudo-release tagged as `sdk-incoming-64bit`. If you can get that compiled and installed then the rest of this should be a cakewalk.

Clone my fork of Megasource.
https://bitbucket.org/TannerRogalsky/megasource

And then clone my fork of Love into `libs/love` as per the megasource instructions.
https://bitbucket.org/TannerRogalsky/love

Check out the `emscripten` branch of each of these. Then make a build folder inside of megasource and run `emcmake cmake -H.. -B. && emmake make`. It should spit out a debug `.js` build.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest