Loveballs, A love2d Softbody lib

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
blzr
Prole
Posts: 4
Joined: Thu Oct 30, 2014 6:05 pm

Re: Loveballs, A love2d Softbody lib

Post by blzr »

It takes a lot of bälls to make something like this. Good jorb, sir.
IndieRetro
Citizen
Posts: 51
Joined: Mon Apr 15, 2013 8:21 pm
Contact:

Re: Loveballs, A love2d Softbody lib

Post by IndieRetro »

ArchAngel075 wrote:Loving this as its giving me some small idea to persue!

It took awhile to adapt to this, since i use onContact callbacks and normals of contacts to set a "isGrounded" variable for the player on the ground so that i can control when one may jump, but sadly the sofBody.fixture isnt exactly the right fixture to call setUserData() on.

After a tweak i now cycle through softBody.nodes and call setUserData() on those fixtures (it even opened for some funky jumping mechanic so i dont mind)

I do mind though the following and #suggestions# :

1. Open a function to fetch each nodes body/fixture/shape for fiddling, i feal dirty some-how using softBody.nodes[n].fixture
2. Method to change the radius of the softBody on the fly.

The following is more of a call for help on how I can go about implementing the feature in my game :
If i take a softBody and by some way "stretch" it and then have it split into two softBodies whom share the same radius that is half the original.
The above is what i hope to achieve as the main mechanic of the game/snippet I am attempting...something of a blob that splits and rejoins as needed but with the REALLY amazing tessellation and wobbles on the way...

For checking if the softbody has made contact with the ground, I personally make a rectangle physics object, set it to be a sensor with fixture:setSensor(), and then I attach that sensor object to the center node, the main body of the softbody. I keep the rotation of it fixed to stay always below the player with a joint, that way I can easily check if the softbody is grounded, if you check my later videos on my softbody game you can see this in action.

As for the splitting into two softbodys, my best suggestion would be to do something like this:

1: Set the frequency of the softbody to really low as its about to split
2: Apply a force in the direction away from the center body for all of the nodes to the left and right of the center body, making it stretch sideways
3: Wait a few seconds, and then destroy the softbody, at the same time creating 2 new ones to the left and right of the original softobdy position.

Sorry about the bodge job of a lib, I know doing nodes is a pain in the ass, I've never really made a lib before. I do plan on re-writing all of this to be much cleaner and easier.

Oh and dont forget to post some videos of what you're working on! I'm yet to see my lib in use outside of my own games :)
irc.freenode.org ##oodnet
http://exez.in/
User avatar
ArchAngel075
Party member
Posts: 319
Joined: Mon Jun 24, 2013 5:16 am

Re: Loveballs, A love2d Softbody lib

Post by ArchAngel075 »

Oh i will see if using the center rect sensor will work out thanks for the inform.

About splitting, a friend I conversed with suggested a less intensive? method. Simply make the splitting a animation whose each frame of the animation is scaled such that it will be the radius of the player (doable if you use a ratio) and lastly delete and create a new player object with the detached leftovers object - Though this will cause the player to be a pure circle each split.


Regarding reducing the size, for now ill just "assume" the size or make-up of the player decreases etc and have a static size unless a detach occurs explicitly (special event). I can always patch the size change if/when its possible.

I like blobs. and the reactions my friends gave when i said "play with this Love-able game loveballs with bouncy things!"


Quick Edit :

If and when i have more productive than just the framework code complete ill share videos. feedback is important...
User avatar
nfey
Citizen
Posts: 63
Joined: Tue Feb 18, 2014 9:50 am
Location: Romania

Re: Loveballs, A love2d Softbody lib

Post by nfey »

I have no idea how to use this for an actual game mechanic that will not feel gimmicky (I will however take the challenge of coming up with something) and I don't have anything meaningful to contribute to the discussion. But I just wanted to say that this looks awesome :) Well done.
IndieRetro
Citizen
Posts: 51
Joined: Mon Apr 15, 2013 8:21 pm
Contact:

Re: Loveballs, A love2d Softbody lib

Post by IndieRetro »

nfey wrote:I have no idea how to use this for an actual game mechanic that will not feel gimmicky (I will however take the challenge of coming up with something) and I don't have anything meaningful to contribute to the discussion. But I just wanted to say that this looks awesome :) Well done.

Thanks! Here is my project with it ^^

irc.freenode.org ##oodnet
http://exez.in/
User avatar
ArchAngel075
Party member
Posts: 319
Joined: Mon Jun 24, 2013 5:16 am

Re: Loveballs, A love2d Softbody lib

Post by ArchAngel075 »

EDIT *See Below for a question related to draw()*
EDIT #2 *semi-answered but...*
Edit #3 tried fixing my fork...
EDIT #4 REMOVED convoluted nonsense...

interesting! Its close to what i would like to achieve, actually i want to *steal* the blobs look, those eyes....

My project *will* be a mix of sorts of risk of rain and Binding of Isaac but using a gimmick where the players size and health is linked as well as its make-up. Also affecting its abilities etc :D The blob/wobble-effect is just so perfect.

[Removed all prev edits: see edit #4]

Edit #4 :
I removed all the nonsense. Instead im working on a more simple modification. See next post >>
Last edited by ArchAngel075 on Sun Jan 25, 2015 10:25 pm, edited 1 time in total.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Loveballs, A love2d Softbody lib

Post by Jasoco »

IndieRetro wrote:
nfey wrote:I have no idea how to use this for an actual game mechanic that will not feel gimmicky (I will however take the challenge of coming up with something) and I don't have anything meaningful to contribute to the discussion. But I just wanted to say that this looks awesome :) Well done.

Thanks! Here is my project with it ^^

First off, that's Loco Roco and it's awesome. It's been so long since I had the demo on my PSP.

Secondly, change the video title. "ASD" gives me some really really strange and sometimes horrible looking related videos.
IndieRetro
Citizen
Posts: 51
Joined: Mon Apr 15, 2013 8:21 pm
Contact:

Re: Loveballs, A love2d Softbody lib

Post by IndieRetro »

Jasoco wrote: First off, that's Loco Roco and it's awesome. It's been so long since I had the demo on my PSP.

Secondly, change the video title. "ASD" gives me some really really strange and sometimes horrible looking related videos.
Hehe, loco roco inspired me to create this lib and game ^
irc.freenode.org ##oodnet
http://exez.in/
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Loveballs, A love2d Softbody lib

Post by s-ol »

IndieRetro wrote:

Thanks! Here is my project with it ^^
Hey! that's the teeworlds sun in the background!

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
ArchAngel075
Party member
Posts: 319
Joined: Mon Jun 24, 2013 5:16 am

Re: Loveballs, A love2d Softbody lib

Post by ArchAngel075 »

updated my fork, no more buggy canvas or love.graphics.translate :

Changes of note to fork : (from your original master)

#1 : Added a Sbody:update() function, it calls the tessellate bit in your original [Sbody:draw], meant to be called in love.update()
#2 : Added a Sbody:getPoints() function, returns the self.tess[#self.tess] table of a softBody
#3 : Added my requested getFrequency() function - used to lerp frequency in my game.
#4 : Modified the draw() function to reset line-width to 1 to avoid leaking line-width changes (preferably one would fetch what the line width is and then reset back to what it is since it wont allways be 1 prior to calling draw())

Link to repo I forked. changes in init.lua

Hope this would be better for you to deal with.

Also question :

I really want to avoid needing to take a series of points for love.graphics.line() and scaling etc them to draw a smaller circle, any more optimized method other than using many loops to scale points ?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests