Page 2 of 3

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

Posted: Mon Aug 31, 2015 9:57 pm
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.

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

Posted: Wed Sep 02, 2015 11:14 am
by Murii
Yay, glad it's finally released. I'll learn the source code and I'll start helping ya!

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

Posted: Thu Sep 03, 2015 6:44 am
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

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

Posted: Thu Sep 03, 2015 12:46 pm
by s-ol
I rarely check the "Ports" forum, glad I did. I'll try running my ld33 entry with this.

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

Posted: Thu Nov 19, 2015 4:58 am
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!

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

Posted: Sat Dec 19, 2015 1:16 am
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 :)

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

Posted: Sat Dec 26, 2015 4:46 pm
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.

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

Posted: Sat Dec 26, 2015 7:03 pm
by Nixola
Won't work here either; Chrome on Android 6.0.0, Nexus 6.

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

Posted: Tue Dec 29, 2015 10:51 pm
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.

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

Posted: Wed Dec 30, 2015 4:51 pm
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!