Page 1 of 1
Adding Liquidfun support to Love
Posted: Wed Sep 27, 2017 6:51 pm
by frabert
Hi everyone! I am trying to modify Love to use Liquidfun instead of plain Box2D as a physics engine. So far I managed to compile it fine, but now that I have to add the additional Particle APIs, I am facing a problem: I don't really understand how the box2d glue code is organized...
It seems like there are different layers of abstraction built into Love's code, for example:
Code: Select all
physics/Joint.cpp
physics/box2d/Joint.cpp
physics/box2d/wrap_Joint.cpp
What is the standard way of adding APIs to existing modules?
Re: Adding Liquidfun support to Love
Posted: Thu Sep 28, 2017 5:47 am
by erasio
Ha. I'm about 70% done porting it.
You can safely ignore the outer files. We'll only need the files within the box2d folder.
The plain filename is there to provide a love friendly interface and to have an object we can use as user data.
Wrap_xyz is the lua binding. Defining the functions and executing the code of the objects. Usually also doing some casting and a few behind the scenes stuff.
From the top of my head I only recall that you'll need wrap_physics, add a particle system to the user data, and add files for the particle system & particle group + wrappers for both minimum. Oh yeah. You'll also add your new classes as friend to I think shape and World.
Re: Adding Liquidfun support to Love
Posted: Thu Sep 28, 2017 6:43 am
by frabert
erasio wrote: ↑Thu Sep 28, 2017 5:47 am...
Thank you very much! Anyway, is your code open source? I would love to split the efforts, and starting from zero when something's already been done seems a bit wasteful to me, but if you don't want to share your efforts I completely understand.
Re: Adding Liquidfun support to Love
Posted: Thu Sep 28, 2017 5:14 pm
by erasio
The development itself not no.
I plan on releasing the finished thing minus my current commit history (as I tend to push things that probably don't belong into the public).
But I don't have an ETA on when it's finished. This year for sure. But beyond that I really can't tell as I can't say how many issues I'll be facing yet. Plus I'm working ~5 - 10 hours a week tops
If you think you can quickly finish it. Drop me a PM and I'll get you the current files. I kept to the general löve coding standard (mostly). Though the custom objects still need work on the API (as I'm not at the point where I can judge what elements you need and how) and I just started with the bindings code.
If you wanna wait that's cool too.
Though starting is actually quite easy. I orientated myself at the other files in the box2d folder. Mostly mousejoint (for no particular reason). Just copy what they're doing there. Worst case: You have to rewrite some parts bit by bit when you notice you need them differently (there's never a lot of code or anything complex going on).
Re: Adding Liquidfun support to Love
Posted: Thu Sep 28, 2017 5:26 pm
by frabert
erasio wrote: ↑Thu Sep 28, 2017 5:14 pm
If you think you can quickly finish it. Drop me a PM and I'll get you the current files.
I don't think I can give any kind of meaningful estimate as it is my very first time encounter with Love's codebase :/ I guess I'll just wait and poke around and see what can be done...
erasio wrote: ↑Thu Sep 28, 2017 5:14 pm
I orientated myself at the other files in the box2d folder. Mostly mousejoint (for no particular reason).
I guess that the fact that it's right above ParticleGroup in the alphabetic order helped a bit!
I know because I used that file too as a guide