So I wanted to draw a rope of slime between two points: it stretches, thins, and then breaks. The obvious starting point was to use the physics system of the engine. I already used physics to animate a cable the player can use to measure the internal pressure of your patient, and this would be pretty similar.
With the kind help of a fellow dev from the Swiss Game Hub, who told me about the relevant Godot physics gotchas, I got to work. Soon, I had a functioning simulated rope spanning between two points, but it didn't behave like I wanted. If you moved one of the end points, the rope would sway and bounce back and forth, which looked wrong. What I really needed was the end result of this bouncing and swaying, the curve the rope eventually settled into.

At which point it occurred to me that perhaps this was a mathematical curve, like a parabola. If I could calculate the shape of this line directly without having to do all this physics stuff, the result would be faster and cleaner. And indeed, the line of a rope between two attachment points does have a name: it's a catenary.
Unfortunately, calculating the shape of a catenary is somewhat math-heavy, but I found an article by Alan Zucchoni that I was able to adapt. Which yielded me this nice arc between the two attachment points, no physics simulation needed. This basic version was very slow, so next, I added the optimisations discussed in the article and brutally reduced the required accuracy. This reduced the number of steps needed to calculate a point on the line from around 6500 to around 15, making it nice and fast even with lots of slime.

I added two more things: an option for little triangular areas at either end where the slime rope is attached at two different points, and an animation for the line breaking with the two halves of it falling down. Technically, this falling-down motion would require physics again, but I just faked it out by having the points of the line rapidly move to below the attachment points - it's such a fast movement that you can't tell it's technically wrong.

And there we go! Slime! Ropes of slime!
I'm very pleased with what I've created here. One step closer to a really nice/horrible looking game. Next up, I will be making similar but simpler systems for slime oozing down, droplets, and spreading pools.
(Also, a catenary sounds like a cat-canary hybrid, a confused creature that wants to eat itself.)
(Also, you should subscribe to my mailing list if you haven't yet. There's cat pictures and extra commentary!)
