Looks like there were 2 issues:
The harder-to-find issue was that it doesn't like the gammacorrect config option. Anytime I enable gammacorrect in the config file, it doesn't run properly.
The other more obvious issue was the way I was bringing in shader code. I had the code stored in .glsl files, and was reading them in via love.filesystem.read. When I just put the shader code inline, it works fine. Or, if I put the shader code in a .lua file that simply returns a string, and load the code via require, that also works.
Love.js - A Direct Emscripten Port
Re: Love.js - A Direct Emscripten Port
Good to know. Thanks for debugging! I'll look into those things.logorrhea wrote:Looks like there were 2 issues:
The harder-to-find issue was that it doesn't like the gammacorrect config option. Anytime I enable gammacorrect in the config file, it doesn't run properly.
The other more obvious issue was the way I was bringing in shader code. I had the code stored in .glsl files, and was reading them in via love.filesystem.read. When I just put the shader code inline, it works fine. Or, if I put the shader code in a .lua file that simply returns a string, and load the code via require, that also works.
- alberto_lara
- Party member
- Posts: 372
- Joined: Wed Oct 30, 2013 8:59 pm
Re: Love.js - A Direct Emscripten Port
This happened on Manjaro Linux, maybe an OpenGL/Graphics driver issue (since I had problems when seeing google maps in 3D mode), it works fine in Ubuntu MATE:alberto_lara wrote:Hey, I just tried to run this game but I get an error, any idea what could be wrong?
Re: Love.js - A Direct Emscripten Port
It seems the code was not updated for a while, if possible I hope it to be integrated into the official Love2D ports, as it seems to be stable enough and need not so much modification(compared to other HTML5 ports) to original code base.
Re: Love.js - A Direct Emscripten Port
With the current available technology, I'm of the opinion that this project will never be good enough to become one of the actual targeted platforms for Love. I have hope that advances in Web Assembly and shared memory threads in the browser will, in time, yield a more satisfactory result.
In the meantime, I still think that love.js is amazing. That a project as complex as Love can be compiled to javascript and work as well as it does is freaking magic. Enjoy it how it is and when the tech is there, believe me, I'll be the first person to push this forward.
In the meantime, I still think that love.js is amazing. That a project as complex as Love can be compiled to javascript and work as well as it does is freaking magic. Enjoy it how it is and when the tech is there, believe me, I'll be the first person to push this forward.
- Sheepolution
- Party member
- Posts: 264
- Joined: Mon Mar 04, 2013 9:31 am
- Location: The Netherlands
- Contact:
Re: Love.js - A Direct Emscripten Port
Hey Tanner, do you think you can/plan to fix the page freezing when getting an error? It can be solved by removing the while loop in love.errhand, I believe.
Re: Love.js - A Direct Emscripten Port
I'd like to! That's probably an entire day of work, realistically, so it's gonna be a little bit.
-
- Citizen
- Posts: 66
- Joined: Tue Jan 14, 2014 11:03 pm
Re: Love.js - A Direct Emscripten Port
Hey guys, first of all great great job.
Has anyone looked into integrating some of the sdks that html5 portals require for publishing. Is it difficult? Not supported?
Thanks,
Gian
Has anyone looked into integrating some of the sdks that html5 portals require for publishing. Is it difficult? Not supported?
Thanks,
Gian
-
- Prole
- Posts: 2
- Joined: Wed Jan 18, 2017 7:24 am
Re: Love.js - A Direct Emscripten Port
Thanks for love.js/love2d. I found it through picolove with the goal to scale my game from its pico8 prototype.
I found a simple solution to integrate REST APIs with love.js using stdin/stdout:
Both setvbuf and read a single byte is required or it won't work. Now you can request javascript XHRs from lua.
If you use the release version you will need to preallocate more memory:
Love.js is using lua 5.1 and is missing the bit module. You can use these functions instead:
I found a simple solution to integrate REST APIs with love.js using stdin/stdout:
Code: Select all
//in index.html
var input="input"; var inputIdx=-1;
var Module = {
print: function(sout) { console.log('lua stdout: ' + sout) },
//[...]
preRun : [function() {
function stdin() {
++inputIdx;
if(inputIdx>input.length)
return 0;
return input[inputIdx].charCodeAt(0);
}
Code: Select all
-- in main.lua
function love.load(arg)
io.stdout:setvbuf("no")
io.stdin:setvbuf("no")
io.stdin:write("output")
sinp=io.stdin:read(1)
while sinp~=nil do
sinp=io.stdin:read(1) end
end
If you use the release version you will need to preallocate more memory:
Code: Select all
//in index.html
var Module = {
TOTAL_MEMORY:100000000, // 100MBs
Code: Select all
-- in main.lua
function bit_xor(a,b)
local p,c=1,0
while a>0 and b>0 do
local ra,rb=a%2,b%2
if ra~=rb then c=c+p end
a,b,p=(a-ra)/2,(b-rb)/2,p*2
end
if a<b then a=b end
while a>0 do
local ra=a%2
if ra>0 then c=c+p end
a,p=(a-ra)/2,p*2
end
return c
end
function bit_or(a,b)
local p,c=1,0
while a+b>0 do
local ra,rb=a%2,b%2
if ra+rb>0 then c=c+p end
a,b,p=(a-ra)/2,(b-rb)/2,p*2
end
return c
end
function bit_not(n)
local p,c=1,0
while n>0 do
local r=n%2
if r<1 then c=c+p end
n,p=(n-r)/2,p*2
end
return c
end
function bit_and(a,b)
local p,c=1,0
while a>0 and b>0 do
local ra,rb=a%2,b%2
if ra+rb>1 then c=c+p end
a,b,p=(a-ra)/2,(b-rb)/2,p*2
end
return c
end
function bit_lshift(a,n)
return bit_and(a*2^n,4095)
end
function bit_lshift32(a,n)
return bit_and(a*2^n,4294967295)
end
function bit_rshift(a,n)
return math.floor(a/2^n)
end
function bit_bits(x)
local powers={
nil,nil,nil,nil,
nil,nil,nil,nil,
nil,nil,nil,nil,
nil,nil,nil,nil,
}
local i,n=1,0
while x~=0 do
local r=x%2
if r==1 then
x,n=x-1,n+1
powers[n]=i
end
x,i=x/2,2*i
end
end
function bit_sum32(a,b)
return bit_and(a+b,4294967295)
end
Re: Love.js - A Direct Emscripten Port
Nice work! I'm kinda new to this, but do you think that could open the gate to luasockets? This feature is probably the only thing that prevents me from making my game with love.js. I'm currently making a multiplayer HTML5 game with Pixi.js but it's hella hard compared to LÖVE.danvdragos wrote: I found a simple solution to integrate REST APIs with love.js using stdin/stdout:
Who is online
Users browsing this forum: No registered users and 1 guest