
This is a continuation of the "origin of Squishies" post. Part 1 can be found here: Part 1 - Brainstorming & Art.
11 AM on Day 1
Since I still had time (it was 11 AM of day 1), I wanted to see if I could make the blobs a bit "squishy". I thought it could be fun to have them stretch and get squished together on impact. Maybe not the most important thing to work on but oh well I still had time and it sounded like a fun challenge. :smile:
Squishiness
For the squishiness I wanted to try using the Physics in Unity. Using real physics would give the most natural feeling when a Squishy would be thrown against a wall. Invisible springs inside the blob would make sure the blob would be compressed when it would hit the wall and those springs would push the corners back and bounce it off the wall. Squishiness! :grin:
The idea I had was simple. Instead of one object, the blob would be made of five objects: a center object and four corner objects which were connected with invisible springs. In the images below, the red, orange, light green and green squares are the corner objects, the center object is quite small and not really shown.
Squishiness Experimentation
I attached some springs and started with drop tests, dropping five blobs from different heights. Some examples below:

While the idea sounds simple (5 objects and a bunch of springs), getting it right ended up being really difficult. It took A LOT of experimentation.
If I put some spring joints/connections too hard, the frequency of the springs would go up and the whole thing would start vibrating. If I attached the joints in the wrong position the blob would become unstable and it would start bouncing around on its own. On the other hand, when the diagonal connections (connecting opposite corners) were not strong enough, the blob would just tilt to the right or left (see 5 above) and if I did not give the springs enough strength in general they could not even counteract gravity and the Squishy became flat. Aaaah...
New inspiration...
At one point I even gave up. (I mean, what kind of weird thing am I spending my time on anyway?) After taking a break, showing it to someone and getting some new inspiration on how to attach the springs, I got motivated again. With new inspiration it suddenly started behaving more like I wanted. Finally, after a total of four hours of experimentation, I got something I liked!
Below is a screenshot of the final game. (I will talk about the hair later.) All the jumping and moving you see is just physics! How cool is that!? The only thing the code does in the image below is call AddForce in the center of the blob twice. Once in the beginning to jump to the right and once to jump the platform.
At the start of the animation below looks like the Squishy pushes itself forward with one of his feet, but that is just the springs doing that somehow. Same for when it rolls a bit further or when it rotates in mid air. The squishy physics looks even cooler than I imagined... :astonished: (How does squishiness even cause such side effects?)

Final configuration

The final configuration had 16 spring joints/connections for a single Squishy. Every corner object had 2 joints connecting to the opposite side and the center. I called these the "diagonal" connections. Every corner object also had 2 joints connecting to the next corner object. I called these the "clockwise" connections for the lack of a better name. The experimentation learned me that the diagonal joints have to be a lot stronger ("frequency" 30) than the "clockwise" ones ("frequency" 10), but you definitely need both types. Next to the configuration of the spring connections, I also learned that the mass distribution is essential for getting the best squishy behavior. The corner objects have mass 0.1 while the center object has mass 1.
I you want to know, more, have a look at the code... Squishies is open source!
Together this makes the Squishies Squishy! :smiley:
Hairy Squishies!
So, the Squishiness Physics were finally done. Phew... (Was it worth it?)
One thing that still bothered me however was how the hair I painted was completely static. I used a single image for the Squishy and simply deformed that image. But the hair was painted on the Squishy image and that simply did not look right. It did not move naturally. I wanted to see the wind and acceleration in the hairs!
But that is something for another time as this post is already becoming a bit long...
To be continued...
This was part 2 of "the Origin of Squishies". I hope you enjoyed the read!
Future posts will look into the hair animation, platformer path finding and the AI... Stay tuned for more!
If you want to see the Squishies "alive", you can find them here: https://ldjam.com/events/ludum-dare/44/squishies.