Creatures Community Chat

Thursday, September 30, 2010

The Island: Brains


We've all got em. But a lot of the time we've little idea how they work, especially the average Joe on the street. I personally find brains incredibly interesting and try to do as much reading up on them as possible.

I've recently finished "The New Brain: How the Modern Age Is Rewiring Your Mind" by Richard Restak and I'm part way through "The Cult of the Amateur: How Today's Internet is Killing our Culture and Assaulting our Economy" by Andrew Keen, which although predominantly about modern media does go into some interesting insights into how our brains are being rewired by technological influences.

So having an insignificant understanding of brains, thoughts, learning and memory you can only imagine just how daunting the idea of coding one of my own feels.

For the past couple of weeks I've been doing a stack of reading on how the Norn brains were developed. There's a couple of interesting articles and even a talk by Steve Grand on how the brains were put together and it's given me a good starting point. If you're interested in reading the articles yourselves do a Google search for either "Creatures - Artificial Life Autonomous software agents for home entertainment" or "Creatures - Entertainment Software agents with Artificial Life".

Both are a good read, and there's also a couple of other articles out there that might be worth your time. As I said they've given me a starting point, but obviously the structure of the code itself isn't available, so I'm going to have to do a lot of guess work to make these things functional.

My goal isn't to try and replicate Grand's work and recode the Norn brains in Javascript. Frankly even if I had the original code in front of me I probably couldn't do it.

What I hope to achieve is a simplified version of the Norn brain and the next few posts will likely be related to my ramblings as I try and figure things out. If I've misunderstood anywhere how Grand structured the brain feel free to correct me, but ultimately there is no 'wrong' way to go about this. I want to understand how these creatures work, not just replicate and through my understanding I may come to different conclusions than Grand did.

So with that in mind, let's get started.

The 'find food', 'get food', 'eat food' and 'decrease hunger' steps are mostly there to remind myself these are extra functions I'm going to need to code. Although not directly related to the learning process, without them the Norn wont be able to move around and get to the learning stage.

I'm particularly perplexed as to how I'm going to get the visual function to work. There's a brief rambling on Grand's blog as to how he's thinking of making vision operate in future works, but I've found very little on how it all works in Norns.

In terms of keeping it simple I think I'll put in code that allows them to 'see' a certain distance, only in front of them and hopefully within a certain field. I think most of this should be doable through the built in camera functions in Unity, specifically the raytrace from camera functions.

I haven't thought too much about the digestive system yet. I want to make the Norn able to move about and interact with the world before I go down that path. For now I'll just aim for a system that produces energy when it eats, but without that energy the Norns organs will slowly shut down. I know in Creatures there's a glucose, starch etc system but for a prototype is seems largely redundant.

The main bit of interest for this is the psydo code I've written, which I think very basically explains how Norns go about learning currently.

From what I understand concepts are loosely and randomly wired at birth. For example at birth a Norn may think that pushing objects decreases their hunger. Upon trying this they figure out they're wrong and try another concept. They'll keep trying this until something sticks, namely eating. Once successful a reward chemical is produced which stores the action to drive relationship and adds it to the digital neurons.

In the next stage the Norn then takes this learned concept and tries to apply it to other objects. Almost all my baby Norns, after eating their first bit of food then try and bite into anything they can find, such as a toy. Eventually they realise this doesn't work and try other concepts, until they learn pushing is the best idea.

On top of this certain neurons may have an initial weight set to them, which account for instincts.

There are parts I'm currently not understanding. For example, if a creatures hunger drive was randomly wired to try and eat another creature at birth, but another creature cannot be found, how does the Norn learn that eating other creatures is a bad idea and move on to another object? This would be easy enough to avoid in an early prototype with limited objects, but it's something I'd like to account for now to allow for future growth.

The other thing that confuses me is how Norns in current games don't seem to learn terribly well. If my understanding is correct then the first time a Norn performs the action correctly they should know it for life.

Presume that all drive to agent relationships start with a zero weighting. The hunger/eat drive is randomly wired to toys. The Norn attempts to eat a toy, fails and the drive is randomly wired to gadgets. The Norn attempts to eat a gadget, fails and the drive is randomly wired to food. The Norn attempts to eat food, succeeds and the concept is reinforced. The Norn now knows that eating food reduces hunger. There is no food available and you try to get your Norn to eat fruit. The Norn refuses, because it already believes that food reduces hunger and as far as the Norn is concerned, fruit and toys are just as useless for reducing hunger. Obviously this isn't the way brains currently work, but I've got no idea why not. What additional parameters are there that prevent this?

Now in Creatures 3 this isn't so much of an issue, because Norns have three types of hunger (protein, fat and starch) and each food variety can be matched to a specific type of hunger. But how does this work in C1&2?

As well as this why do Norns sometimes forget that eating food reduces hunger? They'll often stand there trying to push or pull the food, completely neglecting to try and eat it, like they should know. I could understand this happening if the push and eat function had equal weighting to the drive, but there's no reason it should. Once the Norn has eaten food once, it should forever have a higher weight until the Norn gets something out of pushing food as well, which they shouldn't. And even if they do, the Norn has no reason to try pushing the food as it already knows that eating it is the best method.

I think I probably have enough information to start coding some stuff, but these are questions I'll have to answer before I can finish this stuff. Fortunately there's not a lot of point coding brain functions until I've made it possible for the Norn to hunt down and find food first, so I've got a bit of time.

In the mean time, does anyone have answers to these questions? Keep in mind I'm interested in any ideas, not just how the Norns are currently coded. Don't think just because you don't understand Norn brains your input couldn't be valuable.

No comments:

Post a Comment