Fake Physics
I'm currently working on polishing up a short game for a game jam. I'll post the updated build here before it goes live on Itch, but in the meantime I thought it might be interesting to talk about one specific feature which is going into the update: bouncing bosoms.
This is hardly treading new ground, boob physics is a pretty standard feature in many games these days (erotic or not). What I want to talk about is really just a specific way of faking it.
In 3D games it's pretty normal to implement any kind of soft jiggly physics by adding an extra bone for all the vertices that should move and weighting those verts with a smooth falloff so the whole region stretches nicely when the bone moves. Then you apply some actual physics simulation to the bone. Kawaii Physics is a good example of this approach.
In 2D games a lot of people do something similar. Tools like Spine2D which support real-time mesh deformation of 2D skeletons or "puppet rigs" let you define a polygon mesh around an image and then stretch & deform that mesh based on some physics constraint. I was originally considering this approach, it gives you a lot of control and if I would pursue more detailed animation in this project going forward I think I'd probably lean on a tool like Spine.
But, I just implemented lens distortion for Too Many Cats, so why not see if that can be twisted to do other things? Here we're distorting and zooming on specific parts of an image, but the center of the distortion is offset, which gives a nice "pulling" kind of impression. It's kind of like a mesh deform in which the mesh is pushed outward by a sphere, then the sphere is moved (but everything happens in image space).
Ok, but what does that do to a real image? The distortion on the edges does look a little extreme, after all. So I wired it up to follow a transform I could drag around, and...
The red dots are showing where the center of the distortion lies. You can see that for small offsets there aren't a ton of visual anomalies, but if you push it too far it not only drags parts of the image which look weird (like her arm) but eventually the image distorts pretty terribly.
This is the main limitation of this approach, we're just distorting a single flat image. If we would cut the image into separate layers so her arms were never part of the image being distorted we might be able to push it further, but ultimately for large deformations the mesh-based deformation will win every time. So, do we need large deformations?
In order to control the bounce through gameplay events I wrote a simple spring solver. It basically models that green point as a small mass attached to a spring which is always pulling it to the origin. By adjusting the spring's strength and the mass being simulated we can get it to jiggle in response to a force we nudge it with.
I think that's not too bad! If you really look closely you can still see a bit of her sleeve and belt getting pulled in, but I think that during gameplay it shouldn't be very obvious, and it's not enough to introduce any really unwanted distortion. I might experiment with using a mask on the image to limit the distortion in selected areas, but I'm not sure if it's really necessary or not.
The spring solver also let's us reconfigure its parameters during the game so just how stiff, bouncy, or how much of an offset is allowed, can all be varied based on her outfit or any other game state. For a solution which doesn't require modifying the underlying image at all I'm pretty happy with the results.
Here's what the final version looks like in-game:
I should have a playable build with the updates ready for patrons in a few days, but will also post it on itch sometime next week if you don't mind waiting :)
<3
-M
