Creatures Community Chat

Thursday, September 30, 2010

The Island: Brains

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.

Sunday, September 19, 2010

The Island 2.0.(Insert arbitrary number here)

Yes that's right, this is the release of 'The Island 2.0.Arbitrary#"!

Essentially this is a hotfix (aren't hotfixes meant to be fast?) to correct the issues people were having dropping objects they'd picked up. This should now work as expected.

Your feedback would be appreciated :D

http://www.arch-dragon.com/creatures4.html <<<< Game Link

Saturday, September 18, 2010

Magic Hands 2

Bow down and worship, for I am the legendary Hand of Albia! I can move mountains at a whim!



Yeah yeah, I'll do some actual work eventually, I promise.

Friday, September 17, 2010

Magic Hands

So I'm currently trying to code the item pickup system a little better (the last release made it very difficult to drop items) and I've managed to introduce a 'feature' that allows you to pick up ALL objects within a certain radius.

I've actually managed to do this once before, but this time I got footage :D



I've got the basic logic working right so you can pick up and drop objects, however I'm running into errors where the program works so fast it detects multiple clicks from the one mouse button press. So the player picks up and drops an object instantly.

It's proving to be a little harder to fix than I had hoped, but all in all it's a minor problem. I should be able to have a new release with this little bug fixed shortly.

Wednesday, September 15, 2010

A sigh of relief...

Had my meeting today and got to show off the work I've been doing for the past month or so. Can't go into specific details on the project other than to say it's a 3D animation for a hospital, but it's been received well and everyone is happy with how things are progressing.

I'm still going to be fairly busy over the next month and a half or so, but finally I've got a little bit of breathing room to get back to my own personal projects again, which means there will be some work done on 'The Island' again.

I wont have the luxury of having time off to spend working on the new Norns like I did when I started, but at least I'll be able to dedicate a couple of hours in the evenings to it again, and maybe even a little time on weekends.

Now, where was I up to with all that coding...

Saturday, September 4, 2010

Apologies

My apologies for not having updated for a while. I've had one of those rare deadlines I get in my job and I've been pushing to get a heap of work done over the past week, so no work has been done on 'The Island'.

I have to be honest and say it may be a while before any significant updates are made; not because I don't intend to work on it, but because the work that's to be done next will be all code based and there wont be a great deal to show.

I'm at a stage now where I need to get the Norns to work. I only intend to make them good enough to interact with their world. Realism isn't one of my goals, I'll be leaving that to people who are much better equipped to deal with the problem. My intention was and still is to make a prototype game to show people this game could work in 3D and that people would be interested in playing it.

Although I haven't done any work lately, I have been speaking to a few people in the community who's brain/genetic experience vastly surpasses my own and I'm starting to get a good idea of how to code the little buggers. Still a long way to go, but at least I have some contacts now and progress should be made a little quicker.

Thanks for your patience. Unfortunately life can sometimes distract you from...well...life.