18 November 2024 - Lore Tweaks, and Inverse Kinematics
<<< Previous Post
Next Post >>>
Two completely unrelated topics in one blog post? Hell yeah!
Lore Tweaks
After some time spent spitballing with my buddy Gryph (who, if you do not know, helps to write lore and contemplate ideas), I decided on some slight name changes and lore changes for the included races playable in the game.
- Humans are cringe naenae babies who wrecked Earth. They were replaced by an evolutionary offshoot called Gaians.
- Numolon (the cat race) are now Kirivians.
- Balaur (the bird race) are now Avelians.
- Novan are the same because they are really cool.
Inverse Kinematics
One of the core systems needed to make entities work is the system that tells them how to move and interact with the world. Inverse Kinematics is one of these techniques, and it's something you use every day without even realizing it. It is the mathematics that figures out how to rotate linked parts (like an arm, with a shoulder and elbow) so that it reaches out and touches something.
This is a lot easier said than done and there's a lot of algorithms ranging from trivially simple to godly complicated to achieve this with varying pros and cons.
I've implemented these so far:
- Two-segment / "shoulder and elbow" IK
- CCD IK
Two-segment IK
This is a very simple algorithm which, as the name implies, has two segments. It is sometimes called "shoulder and elbow" IK because you can imagine it like your arm, with a shoulder which you can rotate (mostly) freely, and an elbow joint which works like a hinge.
This type of IK is specifically designed to solve for this setup of joints, and can use some special shortcuts to make it very fast and accurate. However, as the name implies, it is limited to only two segments. You can't add any more segments for more advanced rigs.
This type is useful in niche scenarios, but in those niches it is by far the most performant and most accurate solution possible, with instantaneous convergence to the goal (most other algorithms need to run over and over again to "refine" their results).
CCD IK
CCD IK stands for Cyclic Coordinate Descent Inverse Kinematics. It is a technique which supports any amount of segments. It works by rotating each segment so that it rotates the end of the limb/chain of bones towards the target point to reach to.
Doing this repeatedly for each bone over and over again, will eventually cause it to bend and reach the goal. It's an okay technique, and it's not too hard to implement. It also has the benefit of supporting limits, like hinges, which can even include ranges of rotation.
As a caveat, it can often get stuck and hit what are called "singularities", where there is no obvious solution to the mathematics employed to determine the rotation. CCD is prone to spazzing out in some scenarios, basically. It's a balance between versatility and capability to reach its target.
This technique is great for robotic arms and other mechanical assemblies.
I may change what algorithms I go for, though I anticipate all of my use cases can be addressed with these two.