Softbodies are POSSIBLE! (Although REALLY Difficult...)

I understand exactly what a softbody is, and yes I understand the engine doesn’t support it, I’ve done research in the forums already.
I want to make sure it is COMPLETELY IMPOSSIBLE before rebuking the idea in my game.
If you don’t already know, a softbody isn’t a single sprite, but instead a more complicated one that relies on physics.
In my definition a softbody is an object that is created using several interconnected points, connected by springs, that enacts the forces upon the softbody to give it its physics, along with of course, mass that defines the area/volume of the object.
Although this explanation might not be 100% correct, I still wish to try making this possible in GDevelop.
When someone says something isn’t possible, not only do I wish to prove them wrong, but I know it probably is possible (this seems very stubborn, but I have a good reason for it).
What I mean by this, is that everything was created and can be recreated in some way.
All you have to do is apply the logic used to originally create it, and if it isn’t possible that way, then find another (probably unconventional) working solution.
So what do you think?

1 Like

Hi,

I am not sure if it would meet your definition but you could probably put several physics-objects together - with the right joints and well adjusted parameters - so that you get something that gets close to the properties of a softbody. But apparently that would look like several sprite-objects with physics mashed together instead of having one sprite that changes dynamically its appearance.

I think you are right, the question is only how long it would take and if the result - appearance and performance - is what you want.

Sometimes here in the forum the question comes up whether a certain kind of game or mechanic is possible to make in Gdevelop without further context. Most of the time the answer is probably yes, but more important is actually if there are better options available for achieving the same thing in a shorter time with a better outcome - if finishing something in a reasonable time is the priority of course.

1 Like

What type of forms are you interested in? I’ve seen people create multiple object blobs or slugs. Others have modified the scale of objects to create a ball that flattens on impact.

It would be nice. The closest thing would be to use the physics joints. There are a lot of different types.

https://wiki.gdevelop.io/gdevelop5/behaviors/physics2/

The joint objects could be hidden and could modify other sprite’s size and positions.

Anorher option might be to draw the form on a shape painter. Although, to use a hitbox that matches the image, you would need to either use multiple objects or maybe the Marching Squares extension. Or maybe you could use the hidden physics objects for collisions. They could form a hidden outline.

Im not saying these approachs do what you need. I also don’t know how efficient they would be. It’s an interesting concept.

1 Like

For example

1 Like

Cool - yes do it! I had thought about this and i had been working on linking multiple objects together using maths. You could ignore the physics engine and just use variables and lots of complicated threads of logic, with lashings of ‘repeat for each object’ and ‘pick all’ to check collisions id’s and distance between two objects and apply forces based on distance and vars like ‘acceleration’ etc but this might result in a lot of event reading and hair loss. But it might be an interesting experiment!

1 Like

to add further complexity. Make each pixel an object. Create your own sprite creator interface in gdevelop to convert the sprites that you create into a database of object positions for each pixel in the sprite. You then have an image made of lots of objects and can apply transformation across the object based on funky algorithms of your choosing!
or learn unity.

That’s another example of a softbody.
And that further shows me it’s possible.
Although that’s just a sprite being moved around by a couple rope joints, the blob I want to make would be more complicated, I presume.

I’ve made blob-like physics, and I’m now sure it’s possible.
I’ve made points that are interconnected with math, not any kind of rope or joint, but it still seems to work.
Although I will need to fill in the space between the points in the blob so the points can’t get caught on objects with some kind of physics based line that stops collisions.


(Ignore the spikiness, I’m not sure why that’s happening.)

1 Like

Okay, I’m done making the soft body!
The collision might be a bit janky, but that’s all in design, trust me. :wink:
It reminds me of jelly.

Here’s a link to the example.
It’s a nice soft body in my opinion.

1 Like

i’m interested into this to make some enemiess…but…

what about performances…?

Hello ResinTheFuriousMage!

Well done!
Do you use Physic engine ou only mathematics? (or the two)

I think the problem in collision is due to the small distance between collision points.
But you are on the good way.

Xierra

One blob doesn’t seem very laggy, but if you’re using a lot you’d have some issues with performance, for sure.
It’s using 24 points to make it seem more circular, and you could definitely change that to be more or less depending on your preferences, but the problem is, the dots shape the blob, and if you only had 3 dots for example, only each of the corners would be affected by collision.
I also added 24 lines that connect the dots, but they don’t really do anything, it was kinda experimental, I’m not sure if I’ll remove it yet or just add more code to replace the lines.

I’m only using Math for the blob, I may ADD physics to help with collision though, but I already tried that and it didn’t really work well, so most likely not.
The points only get stuck or cause the blob to phase into things if the dots get stuck on a corner of something, I believe.
The blob consists of 24 points that are (unless the blob is stretched) about 26 pixels apart.
And the blob also consists of 24 lines that connect the points.
I believe the lines don’t really do much for the blob, but I do want to change that.
I want to make it so the dots of the blob are affected by the movement of the lines, because trust me, it would make a difference.

I think that’s pretty cool @ResinTheFuriousMage . I was surprised to see how well my friends 8 year old son had done a soft body in Scratch. Blimey I said - have you designed your own physics engine there? as it appeared that he had - yes he said.

1 Like

Well, you could say that.
Not necessarily, but I did make it seem like there was physics.
Some things would definitely have to be improved upon, especially if someone wants to make a working game with them.

I probably left a confusing comment there - I think you’ve done very well there. What’s the math(s) linking the points together? I think though if you want to make a smooth game out of it you’d need to do it in another game engine. With ‘have you designed you’re own physics engine’ - i was referring to my friends sons efforts on ‘scratch’. I was surprised that scratch seemed to have better vector support than gdevelop.
This has been a great thread by the way!

Hello @Davedorkmouse!

Can you precise your affirmation?
Thanks.

Xierra

I love gdevelop, but - this is the sort of thing that would run much smoother in unity or godot. I’d like to see better vector support in gdevelop - it’s great with sprites. I’ve only tried the shape painter tool a couple of times but it felt awkward to me and limited and so I just extended objects between positions instead. I’m going to try it again and experiment a bit but I think that the way that gdevelop works if you had a full game with soft bodies and decent graphics it would be a bit laggy.

Ok.
Thanks for your response.
I can’t be sure but programming not in JS, it is (almost always) possible to make great things with a language. The problem you can however encounter is the slowness and difficulty to do certain things but i think all depends of how you master the tools (GDevelop, JS, paint tools, etc.)
In the (long) past, while i was not programmer at this time, my society gave the task to create on PC a real estate management application with the language … BasicA of IBM!! (which was very limited especially for UI mask screen and files management)
And so, when i finish this application after programming all that, they were enthusiasm and more than happy!

Sorry @ResinTheFuriousMage if i have cluttered your post!

A+
Xierra

2 Likes

many apologies for hijacking the thread again @ResinTheFuriousMage I had a play last and did this…

which actually runs better than i thought it would. about 50ms/frame on an average pc
it’s interesting - don’t really know how wou’d use it in a game and it almost looks 3d