1D Herding

I was interested in trying to portray some wildlife recently. As always the idea started off ambitious and has since lost traction. Where I originally planned to have a herd of deer, flock of birds, pride of lions and pack of wolves simulated. It lost track after the deer. Maybe I will pick up the rest when I get inspiration again. The graphics used are my own creations, kind of proud. They are 16×16 for the deer and 8×8 for the grass. The swf is 70k and it makes me wonder how much procedural code goes into 64k demos.

The basic actions are:

  • When hungry search for food
  • When hungry and @food, eat
  • When tired sleep
  • When frightened [of cursor] then alert herd and flee
  • When herd fleeing, flee from nearest threat
  • When !hungry and !tired, stay with herd
  • When with herd and idle, avoid group members (fights with previous one, bug)
I like the results, although I want to continue with the lions and improve on the idea using states. This example only uses boolean variables to control the system. Which is nice when you just fiddling, but nowhere near production quality code. I am however getting stuck with trying to create the gfx, which I was previously not concerned with. I think it is my way of procrastinating, which means I am loosing interest.