Motor2D - Löve2D for the Web with Emscripten

Discuss any ports of LÖVE to different platforms.
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: Motor2D - Löve2D for the Web with Emscripten

Post by undef »

Hey, I've just been trying out Motor2D with my LD33 game, had to make a couple of adjustments before it ran.
Now it freezes though as soon as I'm trying to eat people, I suppose that's a bug in Motor2D, so I thought you might be interested in the .love.
Attachments
game.love
Motor2D adjusted version of my LD33 game
(1.43 MiB) Downloaded 243 times
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Motor2D - Löve2D for the Web with Emscripten

Post by Murii »

Yay, glad it's finally released. I'll learn the source code and I'll start helping ya!
rnlf
Prole
Posts: 7
Joined: Wed Jul 29, 2015 1:15 pm

Re: Motor2D - Löve2D for the Web with Emscripten

Post by rnlf »

Hi undef,

I'll give it a look. If there's something I can fix in Motor, I will do it :cool:

Cheers,
rnlf
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Motor2D - Löve2D for the Web with Emscripten

Post by s-ol »

I rarely check the "Ports" forum, glad I did. I'll try running my ld33 entry with this.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
kbmonkey
Party member
Posts: 138
Joined: Tue Sep 01, 2015 12:19 pm
Location: Sydney
Contact:

Re: Motor2D - Löve2D for the Web with Emscripten

Post by kbmonkey »

I grabbed the source and made a build, it is impressive what you have done so far! I can see where some of the API is not yet implemented (on the GitHub issue too), but this is very promising!
User avatar
kbmonkey
Party member
Posts: 138
Joined: Tue Sep 01, 2015 12:19 pm
Location: Sydney
Contact:

Re: Motor2D - Löve2D for the Web with Emscripten

Post by kbmonkey »

Can anyone tell me what touch device (mobile/tablet) support is like? I created a demo to test-drive touch, but it seems sporadic at best. It seems to register one or two click at best when lucky, then no response.

Just wondering, is all. Thanks :)
Attachments
game.love
(810 Bytes) Downloaded 219 times
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Motor2D - Löve2D for the Web with Emscripten

Post by T-Bone »

kbmonkey wrote:Can anyone tell me what touch device (mobile/tablet) support is like? I created a demo to test-drive touch, but it seems sporadic at best. It seems to register one or two click at best when lucky, then no response.

Just wondering, is all. Thanks :)
I tested this on my Lumia 920 running WP8.1. I only see a black box, regardless of wether I click or not.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Motor2D - Löve2D for the Web with Emscripten

Post by Nixola »

Won't work here either; Chrome on Android 6.0.0, Nexus 6.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
rnlf
Prole
Posts: 7
Joined: Wed Jul 29, 2015 1:15 pm

Re: Motor2D - Löve2D for the Web with Emscripten

Post by rnlf »

Hi everybody,

I've made some additions and have just released version 0.0.3. If you were using the git master, there won't be many major additions, except for joystick support.

Here is a short list of changes:

Code: Select all

Major Additions

    Added love.graphics.Mesh.
    Added love.graphics.ParticleSystem.
    Added multi-canvas rendering and shaders.
    Added love.math.BezierCurve.
    Added most love.joystick functionality (Missing: vibration, loadGamepadMappings, saveGamepadMappings, setGamepadMapping).

Minor Changes

    Added Canvas:clear.
    Added conf(t.identity).
    Added error checking to static audio source loading.
    Added error checks when loading images.
    Added love.audio.setVolume.
    Added love.audio.Source:setPitch and getPitch (Currently no action in Emscripten).
    Added love.filesystem.getDirectoryItems.
    Added love.filesystem.getLastModified.
    Added love.filesystem.isDirectory.
    Added love.filesystem.isFile.
    Added love.filesystem.setIdentity.
    Added love.filesystem.write.
    Added love.graphics.getFont.
    Added love.graphics.isSupported stub.
    Added love.math.isConvex.
    Added love.math.linearToGamma and love.math.gammaToLinear.
    Added love.window.getDimensions.
    Added missing destructors to audio sources.
    Added some missing ImageData functions.
    Added stubs for Source:setPosition, setRelative and setAttenuationDistances.
    Fixed computation of on-screen coordinated on fragments in shaders.
    Fixed love.filesystem.read.
    Fixed love.graphics.newSpriteBatch: Allow using canvas instead of only image as texture.
    Fixed: SpriteBatch:setTexture only supported Images, not Canvases.
    Fixed: Streaming sources stopped playing when loading took too long after the music already started playing.
    Improved error handling in love.load.
    Made TOTAL_MEMORY configurable from JS.
You can get it here.

I also found a few things that will be really hard to make 100% compatible,maybe somebody has some ideas what to do about that:
  • Emscripten's OpenAL implementation does currently not support setting the pitch of audio sources. I've checked the code and it would be relatively easy to fix that for static sources (I have some proof of concept code if someone is interested), but it will be a nice little headache to fix that for streaming sources (this is a problem with how the WebAudio API works).
  • Shaders: Depending on OS and browser, the GLSL compiler may be more or less pedantic about things. I've seen cases where GLSL that worked nicely on Linux broke on the same machine and browser on Windows. This has to do with the D3D backend that some browsers seem to use. There are other differences that are GLSL ES vs core GLSL related. These are the things I found so far:
    • GLSL ES does not allow floating point suffixes (so use 0.1 instead of 0.1f)
    • GLSL ES requires actual floating point numbers where core GLSL allows implicit casts. So instead of 10 * 5.0, use 10.0 * 5.0 or 10 * 5, depending on context. Same for variables.
    • On some Windows systems, the compiler will falsely claim that not all paths of the effect (or effects) function return a value, when clearly they do. The solution is to turn something like

      Code: Select all

      if(...) {
         return vec4(...);
      } else {
         return vec4(...);
      }
      
      into something like

      Code: Select all

      if(...) {
         return vec4(...);
      }
      return vec4(...);
      
      This has solved most compatibility issues I've seen so far.
  • Joysticks. They are killing me. I get different results for every browser and OS and none is the same as in LÖVE. This has to do with emscripten's SDL2 port in conjunction with the HTML5 Gamepad API. Changes include but are not limited to:
    • The DPad may be a set of buttons on one browser, an axis on another browser and a hat in LÖVE.
    • Trigger buttons may be buttons or axes depending on browser.
    • The gamepad interface may map different buttons and axes than one might expect. Especially triggers may be binary (0/1) instead of float values in the given range.
  • Threads. No such thing in the browser, sorry.
If you find more incompatibilities, please let me know. Sometimes it's just a mistake I made, sometimes it's impossible to fix with today's HTML5 standards (especially audio stuff!)

I hope you like the new release, it can run more and more games!

It is still based on LÖVE 0.9.2 though. For the next release I'm going to revise all functionality and check for 0.10.0 compatibility.


EDIT: I forgot to add the love.gamepadpressed, gamepadreleased and gamepadaxis callbacks. They are now in the master branch, so if you need them, you'll have to build it on your own. Sorry.
User avatar
OttoRobba
Party member
Posts: 104
Joined: Mon Jan 06, 2014 5:02 am
Location: Sao Paulo, Brazil

Re: Motor2D - Löve2D for the Web with Emscripten

Post by OttoRobba »

That is pretty impressive progress! Great job! Have you tried contacting the Mozilla devs for the audio/gamepad issues? They were really helpful in porting Godot to Emscripten (can't remember the exact dev that helped but I can look it up if you want).

I'm on 0.10.0 but I just might try using this with 0.9.2 if I have the time for it :D

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests