forge2d icon indicating copy to clipboard operation
forge2d copied to clipboard

[feature request] liquidfun support

Open tempral opened this issue 5 years ago • 18 comments

If is possible to implement it, would be a great option... thanks to all the Devs involved

tempral avatar Dec 01 '19 09:12 tempral

Can you please provide some links and material about this? so we can understand better your request?

erickzanardo avatar Dec 01 '19 14:12 erickzanardo

http://google.github.io/liquidfun/ At this link you can find the documentation. LiquidFun is an extension of Box2D. It adds a particle based fluid and soft body simulation to the rigid body functionality of Box2D.

tempral avatar Dec 01 '19 22:12 tempral

I really think it would be awesome to have Liquidfun! I can definitely help!

Sometime ago I gave some thoughts on doing this... Since it is a C++ lib it was a bit harder than integrating Box2D (already in Dart).

The link below gives info on how to build it for different platforms.

We could integrate it as a channel and create a Dart generator to expose the C++ API on Dart. Can be hard but maybe it can be done.

Thoughts?

https://google.github.io/liquidfun/Building/html/index.html

feroult avatar Dec 02 '19 00:12 feroult

It seems to be supported on both Android and iOS, as well as desktop, my only concern on using channel APIs is that we will have some trouble porting to desktop and maybe web.

I see two paths:

  • implementing this using the channel APIs like @feroult suggested, but not directly on Flame, we could have a flame_liquidfun package

  • porting the c++ code to dart (kind like how box2d is ported)

I have no idea which idea would be better, or easier, I know the recent dart versions has the possibility to integrated with native stuff easily using ffi, but I never tried it myself. And I don’t know how complicated this library code is to have it ported to dart, the good thing about this approach is that we wouldn’t need to change anything for desktop and web.

erickzanardo avatar Dec 02 '19 02:12 erickzanardo

There is the DART native FFI which as an interface between dart code and c++. I got this sample running: Dart code: https://github.com/renancaraujo/bitmap/blob/master/lib/transformations/brightness.dart#L35 c code: https://github.com/renancaraujo/bitmap/blob/9cd10ebf045858067542d5c55c39246db17d9678/ios/Classes/bitmap.cpp#L26

We can do something like that perhaps.

renancaraujo avatar Dec 02 '19 09:12 renancaraujo

Jbox2d https://github.com/jbox2d/jbox2d/tree/master/jbox2d-library/src/main/java/org/jbox2d already seems to have particle ported... does the dart port of box2d predate that or was it omitted?

billy1380 avatar Apr 21 '20 10:04 billy1380

@billy1380 I was unaware that particle means liquidfun. we do have some particle related classes on box2d.dart from when it was ported.

@renancaraujo @spydon do you know anything about this? maybe we had liquidfun support all along and didn't know?

luanpotter avatar May 31 '20 00:05 luanpotter

No, we don't have liquidfun support. Liquidfun is a larger extension of box2d than just the particle afaik.

spydon avatar May 31 '20 00:05 spydon

Actually I think I was wrong, I think we have liquidfun support. According to jbox2d which the dart port comes from it says:

It's technically more accurate to say it's just a port of LiquidFun now, and LiquidFun is fork of Box2D, but the library started as a Box2D port.

spydon avatar Jun 06 '20 14:06 spydon

Maybe what we need them is just an example to showcase some liquidfun specific functionality? That will also ensure our port of a port works as intended. @renancaraujo or @spydon would you like to think of something? I myself am a bit unclear on the exact distinction of both, I originally thought it was a totally different project but it seems it was something that was eventually merged into box2d itself.

luanpotter avatar Jun 07 '20 16:06 luanpotter

Alright, so I did some more investigation regarding this and we have liquidfun support in the world, but we have no support to render the particle system yet.

spydon avatar Oct 14 '20 20:10 spydon

Hey, what is the situation with the Liquid fun support? 🤔

thevikke avatar Feb 11 '21 10:02 thevikke

It depends on what part of LiquidFun you mean, I am updating the particle system at the moment in #7

spydon avatar Feb 11 '21 10:02 spydon

I'm not very familiar with the project specifics. I was wondering if it was possible to use LiquidFun with Forge2D? Or rather after you are done with updating the particle system?

thevikke avatar Feb 11 '21 11:02 thevikke

LiquidFun is built on top of Box2D in C++, and Forge2D is a Dart port of jbox2d, to simplify it. So you can never use LiquidFun directly with Forge2D, but we have some features that are included in LiquidFun.

spydon avatar Feb 11 '21 12:02 spydon

Would be cool to be able to do: https://github.com/diwi/LiquidFunProcessing/tree/master/examples

JCzz avatar Apr 25 '22 14:04 JCzz

Would be cool to be able to do: https://github.com/diwi/LiquidFunProcessing/tree/master/examples

To do what? There are a lot of examples under that link, some which can already be done, some which has functionality that aren't implemented yet.

spydon avatar Apr 26 '22 20:04 spydon

I would like to have all the functionality of liquidfun

I want to implement fluid dynamics in my 2d game

ehartford avatar Oct 20 '22 07:10 ehartford