Sunday, October 30, 2016


My end goal is to make full procedural 3D creatures. The (vague) goals I have are:
  • Animation - Creatures move in believable ways. Ideally, given any layout of a creature, this should be able to help it figure out how it can best move, stand, run, etc.
  • Evolution - Various creatures can develop through based on what works best in their given environment. Physical traits such as size, size and position of various limbs, muscle strengths, etc. can develop overtime, and in this way "species" can arise..
  • Communication - Creatures don't exist in isolation: communication of some kind is used to send signals to other creatures to inform them of various things. I would like to have multiple different kinds of creatures living together with shared resources in some equilibrium (such as Predator-Prey dynamics). Simple communication could be mating calls, ownership of territory, being the "alpha", more advanced ones would be ant-like colony behavior or Bee Dancing.
  • Open source: I would like to create open, free tools that allow others to use these creatures in whatever projects they have and expand upon my work here if desired
I don't actually care if they look realistic in the sense of modeling and texturing and such because the behavior is more of what I am interested in.

Where I'm at so far is:

I can simulate the Hill-Type Muscle to impose biological constraints to help creatures learn to move in believable ways, as they did here. This was horribly gross but, assuming my simulation is correct, I think I did it :)

I would like to use Unity because it is a very easy to use program that many people are already familiar with, and so I am not reinventing the wheel. However I also need joints that don't randomly explode like Unity joints, and I need to be able to Simulate 5-10 seconds of movement in a few milliseconds so I can evaluate the performance of creatures quickly.

To do this, in the last week I wrote my own physics engine underneath Unity. It has rigidbodies with velocities and collisions, joints that work extremely reliably, is deterministic so you can run an evaluation and then later replicate the results, and is compatible with typical Unity physics so an actual Unity rigidbody can interact with my custom rigidbodies. It is able to simulate about 100 creatures a second, each of which has been run for 500 "steps" which is equivalent to 5 seconds. I'd like to speed this up but it's not bad for now. I'm then running a Genetic algorithm on some arbitrary metric I pick (say, trying to get the creatures to keep the average position of their head as high as possible to encourage "standing up" or even "jumping") and seeing what creatures run the best. Once I find ones that work well, I can view them in "real time" and simulate a step every frame and still see the exact behavior that it was evaluated on which can be pretty fun.

Right now I'm playing with various basic types of creatures with very basic distance joints (you can think of them as simply spheres with a rod attached between them that contracts or expands based on the creature's internal logic), but I'm going to next look into making more detailed joints with some kinds of limits - eventually using the Hill Type Muscle Model - and potentially creating various different kinds of internal logic.

That's where I'm at :) I'll be making posts as this progresses, and hopefully I'll be able to achieve something that is decently cool.