Symmetry, Part 2

Published by Tom on

In the last post, I talked a little about adjustments I’d made to make symmetry more common. Before finalizing code changes that will affect creature evolution, I try to generate populations of creatures with those changes and then score them, alongside (and in comparison to) creatures who evolved without code changes. It’s fairly time-consuming but it helps me to make sure the changes have really helped and don’t have negative side effects. The most recent batch had a weird anomaly, though:

Creatures only get a score of 1/10 if they exhibit some kind of glitch. The circled outliers have nothing that should explain why they are so much worse than the others, except that they were generated on my desktop computer and evaluated on my laptop, whereas the others were both generated and evaluated on my laptop. This is worrying, because it’s extremely important for the game that creatures behave the same across different hardware. It would be very unfortunate to have an ecosystem collapse because you loaded a savegame on your laptop, or to have a fantastic creature on your machine die instantly when you send it to a friend.

So I generated new batches of the ‘problem’ populations on my laptop: if both still performed poorly, I could sleep soundly knowing it was just a coincidence that the two desktop populations had problems; if they both performed better, then I have a very serious and hard to fix bug to deal with. The results I got…

make no sense. One is better, and one is the same! I’m grasping at straws now, but maybe the number of failures is small enough that it could be random statistical fluctuation. One of the populations may have regressed to the mean and one did not. I’ll be running all five again, with even bigger sample sizes, to see if the errors wash out or remain. Hopefully, an answer will be forthcoming soon.

My previous investigations in symmetry made me think that symmetry was more useful for balance and steering than for raw swimming speed. Additionally, target-seeking creatures were an area I had been meaning to improve, because they took a long time to evolve and once they did, they were often quite slow. Often the earliest creatures to evolve in a playthrough would just blindly swim through the water, eating algae and bumping into things. They should be easy prey, but predators were frequently so slow that by the time they were done swooping down on their targets, their targets were a dot on the horizon and were never even aware they were in danger.

Currently, when genes mutate, it’s random; any size, orientation, or neural wiring is as likely as any other. My first idea was to make certain useful-for-steering combinations more common. For example, a steering fin could grow on a fast-swimming but aimless fish, redirecting the drag from the water to turn the whole creature so that it moves towards a goal. Pushing the probability up a bit would improve the game without reducing its ability to simulate all kinds of creatures. This improved things, but not as much as I needed. After a day or two, I experimented with changing some neurons so that they push harder or softer based on whether doing so would tend to turn the creature towards the target or away from it. This also helped, but not enough.

One significant problem was that creatures knew their current velocity, but swimming can involve lots of variations in the minute-to-minute motion of the creature, so trying to steer by pointing the current velocity towards a target isn’t necessarily helpful. My wife had the key insight, noting that the creature’s head position and orientation kind of ‘encoded’ the creature’s average velocity over a long period of time and would make a better choice than velocity for steering. Doing so and also adjusting the code for creature heads to accentuate this trait got the creatures finally steering well.

Thanks for reading!
Tom

Categories: Tech

3 Comments

Wick · July 3, 2018 at 4:12 pm

Something I’ve noticed is that your creatures seem to do a lot of paddling to move. If you look at fish, a lot of the time they’re not actually doing much; almost all of their motion is from gliding through the water. Maybe if you lower the water friction, it’d encourage more streamlined/symmetrical creatures?

    Wick · July 3, 2018 at 4:20 pm

    My first creatures had the same problem : https://imgur.com/a/fwH9Q46
    I think I solved it by making really sure that surfaces not exposed to forward motion don’t contribute to drag, and relying on the fact that the velocity – squared factor means that small surfaces don’t add almost any drag.

      Tom · July 4, 2018 at 7:41 am

      That’s a good idea. Your creatures in Crescent Loom have a very natural swimming style. I’ll try that out and come back with the results. Thank you!

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *