flame-engine / forge2d

A Dart port of Box2D
BSD 3-Clause "New" or "Revised" License
180 stars 26 forks source link

[feature request] liquidfun support #8

Open tempral opened 4 years ago

tempral commented 4 years ago

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

erickzanardo commented 4 years ago

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

tempral commented 4 years ago

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.

feroult commented 4 years ago

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

erickzanardo commented 4 years ago

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:

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.

renancaraujo commented 4 years ago

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.

billy1380 commented 4 years ago

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?

luanpotter commented 4 years ago

@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?

spydon commented 4 years ago

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

spydon commented 4 years ago

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.

luanpotter commented 4 years ago

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.

spydon commented 4 years ago

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.

thevikke commented 3 years ago

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

spydon commented 3 years ago

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

thevikke commented 3 years ago

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?

spydon commented 3 years ago

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.

JCzz commented 2 years ago

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

spydon commented 2 years ago

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.

ehartford commented 2 years ago

I would like to have all the functionality of liquidfun

I want to implement fluid dynamics in my 2d game