Liquidfun JavaScript - LFJS - [behavior], devlog, ideas, suggestions

  • Since we are talking about polygon decomposition... would this allow objects to break/shatter into smaller individual pieces from a big one? That would be cool :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sort of, yeah. I wouldn't even need/want individual pixels. I take triangles at ~10px too, probably even bigger.

  • WackyToaster / newt,

    Noita = Amazing!!

    It's hard to tell if the particles in Noita are from a port of Liquidfun or if the devs rolled their own version from scratch. Definitely c++ and some pretty amazing destruction effects.

    In LFJS you could do the physics destruction but the challenge would be to get the graphics to reflect the shapes you create. In LFJS you can set bespoke collision shapes from Array.AsJSON inputs using texture coordinates for a sprite, but there is no way in C3 to chop up an image and divide it into shapes (ie Canvas won't allow rotation, so that's no use here). The obvious work around would be to make your scenery out of already exploded sprite images, all carefully positioned to look intact, and then make them into dynamic bodies when they get broken off.

    To destroy objects in stages then you could add child objects to a parent body as fixtures (using the LFJS Assimilate joint) - first break off a parent and its children, then subsequently break off the children. There are limitations to this my plugin: you can't add a child object that is also a parent of other children - you'd have to be smart in how you designed your terrain/scenery destruction. Here's an example of progressive destruction using just this technique (it's to be included with the plugin). Be under no illusion - Noita is an amazing technical achievement!

  • For something like a worms game you can use texture maps using blends. Of course that's pretty limited.

    Pasting textures would be pretty interesting. A lack of rotation isn't a deal breaker.

  • wow, nice!

    can your plugin create elastic particles, as in the original?

  • wow, nice!

    can your plugin create elastic particles, as in the original?

    Thanks, q3olegka

    And, yes - here's elastic/rigid becoming elastic/fluid (well, elastic / not-fluid...). Shape taken from the sprite's collision polygon:

  • Nearly there...!

    Interactive example: Demo

  • cool =)

  • This looks amazing, I am looking forward to the release and seeing what everyone does with it.

  • For texture mapping across rectangular objects to create a 'complete' rectangular object, I'm thinking that something like a building could have one big texture map of the building assigned to the LFJS 'bricks' that make up the building. Then perhaps at runtime, create the building brick by brick in place and use a texture map effect to pick a sub-image of the full texture depending on the location of the brick in the building (e.g. a srcOriginStart, srcOriginEnd offset into the larger texture, it would be easy to create this effect.) Then have a Giant Robot smash the building and have fun!

  • Here's what I mean about applying texture across many sprites as an example (using C3 physics.)

    Each block is a sprite w/ one big texture. A function creates a rectangle of sprites and 'divides' a building texture between the sprites and then we can apply physics to the sprite group and have fun with the building. I am hoping this is applicable to LFJS...

    OffsetTexture Addon and Example

  • Mikal,

    That effect and its application are pure genius!!

    It is possible to also do this with LFJS, in the same way as in the example using the standard Physics - the behavior swap was easy and LFJS has similar performance.

    However, doing this with particles is an intriguing concept that I will look into today... I am not convinced it will be possible but it's definitely worth a look (particles don't have rotation, so each would have to be assigned one color from the large image - a photograph image may not work but some pixel art might well be ok).

  • MikalYoooooo this is awesome!

    particles don't have rotation, so each would have to be assigned one color from the large image - a photograph image may not work but some pixel art might well be ok.

    You know... technically both are pixel art, one just has more pixels. But I know what you mean. One thing I defenitely would be intrigued by is how many particles I can throw at my computer before it explodes. I guess a HD image won´t work that well, considering the 2 million particles that would be.

  • No promises - but inspired by Mikal 's example above, I'm looking into adding a separate set of particle system methods.

    Currently, when you create a particle system you can set a sprite to be used to render each particle. These are set by group or identified by a tag at creation. This means you can use different objects to draw different groups of particles, with or without running animations.

    What I want to do is analyse a sprite's image and then have the particle group create particles with color values to mimic the image. Because of a limitation of Liquidfun JavaScript, this color-particle option will not be compatible with the current way of drawing particles. However, most particles are small and using only one sprite image to render them probably won't matter.

    I need to have a good think about the system's versatility - if the reality is that people don't mind setting a particle group's color when a group are created (as opposed to identifying a sprite type to be used) then I may end up deleting the first set of methods. Then you'll just identify a render sprite once and then change the group color settings as appropriate. Or render group from an image...

    This is going to take a few days to work through. Just to let you know. And I have yet to test how SetUnpremultipliedColor() impacts on performance, so all of this might be nothing more than an experiment...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)