Page 1 of 21

Love2D WebPlayer (WebGL)

Posted: Sun Mar 18, 2012 5:32 pm
by ghoulsblade
cloudsdemo : http://ghoulsblade.schattenkind.net/love-webplayer/
github: https://github.com/ghoulsblade/love-webplayer

WARNING: still incomplete, some of the love api won't work yet
notYetImplemented:ttf-fonts,spritebatch,framebuf,physics,threads,0.8stuff...
shouldBeWorking:newImage+draw,keyboard,quads,pixelFonts,printf,mouse,joystick,audio

goal : play games made for love2d inside the browser without plugins (webgl+javascript capable browser required)

usage: unpack .love file (rename to .zip), add the .js files and the index.html from love-webplayer, upload the whole folder to webserver, open in browser, play

tech : webgl for display, github.com/mherkender/lua.js to run lua code in javascript




EDIT: i guess we'll need love.web api next to love.phone/love.android soon ;)

EDIT: if you want to discuss pure html5/canvas (without webgl), NaCl, flash or similar alternative tech or browser plugin, please make a new thread instead. I'm only interested in a webgl implementation and the others have already been suggested.

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 6:17 pm
by coffee
Very nice. I already saw very good code engines export to JS and with enough speed. Would be nice see LOVE do same steps. Congratulations.

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 7:00 pm
by Kingdaro
Do you have any idea how long we've needed this?

;~;

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 8:40 pm
by SiENcE
First Löve Android.
Now a Löve WebPlayer.

What next :awesome: ?

I think, one of the next Löve versions should official support one of these (or both) ports. Hopefully they are going official one day.

Now testing... ;-)

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 8:44 pm
by TechnoCat
I think I could whip up a love.joystick and love.keyboard really quickly. I'd like to fork this and make a pull request. That sound cool?

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 9:21 pm
by ghoulsblade
sure, help appreciated =)
next i'll be working on :
* require/dofile/love.filesystem.load (needs some ajax magic)
* input : mouse + keyboard
* chew my way through love api stuff and test with a few demos/games
* no sound for now, will look into that later

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 9:28 pm
by TechnoCat
ghoulsblade wrote:* require/dofile/love.filesystem.load (needs some ajax magic)
I know javascript solutions? http://requirejs.org/ https://github.com/wycats/minispade
ghoulsblade wrote:* input : mouse + keyboard
https://github.com/tzuryby/jquery.hotkeys
love.mouse.setGrab: http://dvcs.w3.org/hg/pointerlock/raw-f ... index.html
ghoulsblade wrote:* no sound for now, will look into that later
http://www.html5rocks.com/en/tutorials/webaudio/intro/ http://www.html5rocks.com/en/tutorials/webaudio/games/

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 11:08 pm
by coffee
TechnoCat wrote:
ghoulsblade wrote:* require/dofile/love.filesystem.load (needs some ajax magic)
I know javascript solutions? http://requirejs.org/ https://github.com/wycats/minispade
ghoulsblade wrote:* input : mouse + keyboard
https://github.com/tzuryby/jquery.hotkeys
love.mouse.setGrab: http://dvcs.w3.org/hg/pointerlock/raw-f ... index.html
ghoulsblade wrote:* no sound for now, will look into that later
http://www.html5rocks.com/en/tutorials/webaudio/intro/ http://www.html5rocks.com/en/tutorials/webaudio/games/
So, why this isn't already done? :D
Good luck to both and for the project. :)

Re: Love2D WebPlayer

Posted: Sun Mar 18, 2012 11:33 pm
by ghoulsblade
I cleaned the code up a bit and made dummys/stubs for all top-level functions.

main.js now has a few helper functions:
e.g. the javascript function call_love_keypressed (key,unicode) can be used to call love.keypressed(key,unicode).
This should help when implementing keyboard & mouse.

love.audio.js now has an example of how to bind objects (like audio source).
This should be a good starting point if someone wants to implement audio.

looking forward to pull requests on github ;)

Re: Love2D WebPlayer

Posted: Mon Mar 19, 2012 12:50 am
by coffee
I'm using OSX. For now only working in Chrome. For my surprise not working in updated Safari. Also not working in Firefox 3.6 and Opera. In Chrome seems good.