A Math Based Personality For Games

We make no apologies for being hardware focused here at Hackaday, but that doesn’t mean we aren’t occasionally impressed by a particularly inspired feat of bit wrangling. For example, [t3ssel8r] has taken a break from his game to discuss his procedural animation system and the beautiful math behind it.

Sometimes, rather than having specific keyframes, games will instead use procedural animation. This means that the position is determined on the fly rather than a predetermined set of positions. Developers can use the combination of IK or FK (inverse or forward kinematics) to solve for rotation and positions of the joints that will place the end at a specific position. Particularly with crawling multi-limb things, it’s pretty easy to put a limb on the ground and keep it there until it’s too far away, pick a new spot, and move it there. It’s simple code to write and looks convincing. It can handle complex terrain and situations with different limb positions.

However, it doesn’t offer the chance to inject some life or personality into the movement as keyframes do. [t3ssel8r] goes through the equations and reasoning behind his semi-implicit Euler solver-based system. There are some fantastic explanations in the video, but the short version is that he has three parameters to control the system’s frequency, dampening, and initial response. This allows him to tweak the behavior in a somewhat intuitive manner. One problem is stability; if the timesteps get too large, the position quickly explodes outwards. Using eigenvalues (who ever thought you’d use those) to determine the minimum timestep allows the system to remain stable and take multiple smaller steps when needed or just bound the change temporarily.

If you’re looking for more animation, this blender plugin renders your PCB traces in a new light.

18 thoughts on “A Math Based Personality For Games

      1. Heh, what was that Commodore 64 (And other ports) game that must have inspired it? Track and Field, Summer Olympics or Daley Thompson’s Decathlon or something like that.

    1. Ask him to come up with a solution that solves the same problem as this article but doesn’t use calculus. He’ll either have to really think outside the box or come to the conclusion that calculus isn’t a waste of time for this problem. In either case it should be a valuable experience for him.

    2. He’s 16.

      The explanation that will get him is:
      Calc gets you money which gets you power, both of which get you pus^h^h^hgirls.
      He’s just seeing the terrible ratio in the calc class and doesn’t yet understand.
      He’s not really wrong, calc won’t get him laid directly. Only thing that matters to a 16 YO.

      Also it’s spelled ‘calculus’ but pronounced ‘calcuseless’.

      He could just be bad at math. My freshman class (at the start of the year) in engineering was bigger then the rest of the school. Seats opened up fast though.
      World needs ditch diggers (Civils) too.

        1. There are two kinds of people in the world.

          Those that think math is hard and those that quit studying math while it was still easy.

          Dropped signs? Failed to carry?
          You might, in fact, be bad at math. It appears to have gotten hard for you very early. Can you add/sub fractions?

          1. The second group of people you mentioned is, for the most part, a subset of the first.

            I’ve had plenty of profs who understood the subject plenty well enough but needed a very heavy proofread of anything they put out. Why the spite?

          2. If you ask most mathematicians, arithmetic barely qualifies as math. It stands to reason that if you’re bad at arithmetic, you might still make an excellent mathematician.

    3. Lot of people here saying to trick him or pander or whatever but the bullshit meter is a sensitive one at that age. Don’t lie to him or play it up. It’s the reason most of the equations we use even exist, and that’s inspiring in its own right.

      Pardon me if I’m preaching to the choir but algebraic solutions are faster computationally and often easier to use for humans, it’s just a lot of the times calculus is what gives you those solutions. You can’t expect them all to be handed to you in a neat little list covering every situation (stack overflow only gets you so far =P), as an actual engineer you have to be capable of deriving them and reasoning about them from first principles, and that’s done very often w/ calc

      (though not always – I think seeing the various Maps of Mathematics is probably really what inspired me to settle down and blow through calc so that I could get to linear algebra -> graph theory and combinatorics. Seeing how many more fields of math there are just made my rebellion from the gut-level feel just a little more petty and silly, you might consider googling a few for him and researching a few more examples)

      Beyond the mechanical pieces they give you in calculus it’s just a whole different way of thinking about systems that change over time.

  1. Everyone worries about spotting the rise of Skynet, but nobody worried this is the rise of Sirius Cybernetics Corporation that may inflict untold misery on the galaxy? :-D

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.