Page 15 of 21

Re: Love2D WebPlayer (WebGL)

Posted: Sat Aug 25, 2012 12:46 pm
by ghoulsblade
Kongregate API for Love2D ? viewtopic.php?f=4&t=10641

Re: Love2D WebPlayer (WebGL)

Posted: Sun Aug 26, 2012 4:19 pm
by zapaman
Guys, did you check out MarketJS? I've been playing around with my Ludumdare Game and the WebPlayer and so far, besides a font issue, everything works just as it should! Was thinking of "pimpin" up my LD game once finished and submitting it there!

Ghoulsblade: will you continue to work on the WebPlayer? It's one piece of awesomeness!

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 11:17 am
by SiENcE
I think for better platform support we need also Canvas 2D fallback. WebGl is nice but limited to desktops.

Ghoulsblade mentioned he will not implement Canvas 2D, but i just like to mention it here that we don't forget this :).

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 11:41 am
by Nixola

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 11:47 am
by ghoulsblade
continue work : occasionally, but it's not a priority for me, more of a "if i need something for myself, i'll implement it" situation.
I was hoping to get the community involved in working on the code, i'll extend and help with contributions, but i've done my part and i won't polish it beyond what i need for my own projects.

What's most likely to be improved in the near future is the default font, love 0.8 api adjustments, and physics.
I already started a binding for a web version of box2d, but it's still a lot to do and something doesn't work right with the few bits that are there.

Canvas2D : please make a separate thread to discuss this, we've had it flare up in here a few times and it's annoying since i really have 0 interest in it, sorry. (see also note in first post)

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 11:54 am
by ghoulsblade
nixola :
according to the error message something in note.lua, probably

Code: Select all

local args = {...}

otherwise you'll need to litter the code with print("spot01") and similar instructions to pin it down since the original .lua line numbers aren't available after conversion to javascript.

also the way you use modules might not work in webplayer, since it tries to convert lua to javascript, and that doesn't work with all language constructs.

Code: Select all

square = love.filesystem.load 'notes.lua' 'square'
i'd recommend using

Code: Select all

love.filesystem.load("mylib.lua")()
and doing something like

Code: Select all

mylib = {}
function mylib.bla () print("bla") end 
in there.

no time : according to ludumdare rules, porting is allowed even after the 48/72 hours, so you can just finish the game for native love first, and then later port it to web if you like.

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 12:24 pm
by Nixola
Thanks Ghoulsblade, that was one of the problems... Another one lies in this line:

Code: Select all

notes.soundDatas[i]:setSample(s, sin)
error during main.lua : Error: attempt to index field 'setSample' in a nil value : Error: attempt to index field 'setSample' in a nil value at lua_tableget

It runs fine on the PC, so I think the problem is Love Web player's audio module, should I pre-render the sounds (how? I can't save them with LOVE >.<) and upload them?

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 12:35 pm
by ghoulsblade
sounds don't need preload. but formats other than .wav .ogg and .mp3 will cause problems.
the error message says that somehow "notes.soundDatas" is nil.
this could be being different than in pc-love, or the entry having failed to load.
i'd suggest doing a print("setSample for i=",i) before the line and enabling the console in your browser to see the last output.
also when loading the sounds and setting notes.soundDatas to a value, check the value for being nil and print if not.

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 12:54 pm
by zapaman
@ ghoulsblade: I'm interested in doing some work on the WebPlayer, since I really see the potential in using Love for web games! Made a github account, going to fork the project and see what I can add/fix!

Re: Love2D WebPlayer (WebGL)

Posted: Mon Aug 27, 2012 1:48 pm
by Nixola
The code

Code: Select all

notes.soundDatas[i] = love.sound.newSoundData( 22050, 44100, 16, 1)
for s = 0, 22049 do
   print(type(notes.soundDatas), type(notes.soundDatas[i]), i)
--etc.
generates this output:

Code: Select all

NotImplemented:love.sound.newSoundData main.js:61
table nil 1 
EDIT: I asked to Flashgames.it's admins (it's a famous italian site for flash games) if they'll accept using LÖVE Webplayer, obviously telling them that I've got no rights and that I was only asking some informations, is it ok or I should tell them that you don't want?