Moonshine - A lightweight Lua VM for the browser

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Moonshine - A lightweight Lua VM for the browser

Post by Tanner »

http://moonshinejs.org/

I haven't had a chance to play with this yet but I would be interested to see if this could be leveraged to really get Love2D in the browser. Most of our SDL calls could be replicated through a JS API. I'll probably do some benchmarks and practical tests tonight if nobody beats me to it.
User avatar
OttoRobba
Party member
Posts: 104
Joined: Mon Jan 06, 2014 5:02 am
Location: Sao Paulo, Brazil

Re: Moonshine - A lightweight Lua VM for the browser

Post by OttoRobba »

The company responsible for it actually wants to port the LÖVE webplayer to it I think. They did a talk a while ago, let me find it...
http://2013.capitoledulibre.org/confere ... e-web.html
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Moonshine - A lightweight Lua VM for the browser

Post by master both »

OMG, It's true, it says at 24:03 in the video and it look really promising.
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Moonshine - A lightweight Lua VM for the browser

Post by Tanner »

OttoRobba wrote:The company responsible for it actually wants to port the LÖVE webplayer to it I think. They did a talk a while ago, let me find it...
http://2013.capitoledulibre.org/confere ... e-web.html
Hey, that's cool! I should maybe contact him to see if he's done anything on that front.

In the meantime, this is what I did last night: https://github.com/TannerRogalsky/moonshine-love2d

It's not much. Essentially just the load, update and draw callbacks hooked into the luv.js callback loop. It's not really a benchmark but the delta times in the update loop look good, you know, for doing nothing. The main issue I've run into is that, because of the ways in which javascript and lua prototypes differ, calling out into a javascript prototypes function can result in the scope for that js function being wrong.

For example: upon calling

Code: Select all

love.canvas.setBackgroundColor(255,0,30)
, `this` inside of the js function is `Window` when it should be the Canvas object.

Code: Select all

love.canvas:setBackgroundColor(255,0,30)
results in a proper `this` being passed but, as you might expect, it's passed as the first argument to the function which is not how things work in javascript, generally. I ran out of time to check if that's an actual problem or just a side-effect of me trying to chain together two large libraries that I've never used before. :P
User avatar
Reef
Prole
Posts: 33
Joined: Sun Mar 04, 2012 10:19 pm

Re: Moonshine - A lightweight Lua VM for the browser

Post by Reef »

I really wish Love games could work in the browser. I know work has been done in the past but as I understand, it is out of date and I don't have the skills to contribute in any meaningful way. I've spent so long waffling back and forth between platforms to learn to make games on without making any progress, but I've come back to Love due to the great community here and open source, cross platform nature of the framework. The recent work on android has been super exciting to watch too! It would be so much simpler to show off my work if I could put it on a webpage. I think it would hold me more accountable to making progress.
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Moonshine - A lightweight Lua VM for the browser

Post by Tanner »

Reef wrote:I really wish Love games could work in the browser. I know work has been done in the past but as I understand, it is out of date and I don't have the skills to contribute in any meaningful way. I've spent so long waffling back and forth between platforms to learn to make games on without making any progress, but I've come back to Love due to the great community here and open source, cross platform nature of the framework. The recent work on android has been super exciting to watch too! It would be so much simpler to show off my work if I could put it on a webpage. I think it would hold me more accountable to making progress.
That's my intention with this. Project's like luv.js are great but in order for it to really work, I think, it needs to work with existing Lua code and without browser plugins.

Unfortunately, it looks like there is definitely a problem with Moonshine respecting a prototype instance function's scope. I've opened an issue here: https://github.com/gamesys/moonshine/issues/12

We'll see if anyone picks it up. It doesn't seem like it would be easy for me to fix by myself.
User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Moonshine - A lightweight Lua VM for the browser

Post by qwook »

The moonshine-love2d project is actually pretty neat!

I got my project up and running really quickly: https://twitter.com/qw00k/status/464147673990561793

I'll be down to contribute when I have more time.
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Moonshine - A lightweight Lua VM for the browser

Post by jjmafiae »

Very cool, the readme is a bit confusing.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Moonshine - A lightweight Lua VM for the browser

Post by T-Bone »

This looks really cool! Can confirm that it runs quite well on IE on WP, which is nice. I agree with the goals of getting a plug-in free LÖVE solution in the browser, that would be a huge step forward in comparison to what we're doing now.

Wouldn't it be easier to use WebGL for graphics though, rather than a regular Canvas? There are OpenGL ES versions of LÖVE now that seem quite stable, and as far as I know WebGL is really similar to OpenGL ES.
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Moonshine - A lightweight Lua VM for the browser

Post by Tanner »

jjmafiae wrote:Very cool, the readme is a bit confusing.
Yeah, the project isn't really in a state where I'm ready for other people to be using it. It's exciting to me that qwook got stuff up and running but there's a bunch of stuff missing that I consider necessary for an alpha release.
T-Bone wrote:Wouldn't it be easier to use WebGL for graphics though, rather than a regular Canvas? There are OpenGL ES versions of LÖVE now that seem quite stable, and as far as I know WebGL is really similar to OpenGL ES.
This is very true. WebGL will be necessary to fully implement Love's graphics API. Unfortunately it doesn't work on mobile so what I'm currently working on is using WebGL with the 2D canvas as a fallback, while using Love's GLES branch as an example. It's looking like a lot of work, though, so I'm considering moving it into a second beta milestone. Feel free to add any comments on the related issue.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests