Yeah, I know I promised I would say more about the brain next, but I lied. Really, I should talk about organs, first. There’s nothing particularly exciting about them, but I realized that I can’t meaningfully talk about thinking unless I first explain the many kinds of inputs and outputs that the creatures have available to think about. As I said last time, all that any brain can do is trigger muscles and secrete chemicals, but chemicals to do what, exactly? And what do I mean when I say that phantasians have muscles?
Essentially, everything that happens inside our creatures happens in an organ. These organs are not quite like our own spleen and liver – they’re more like systems – but I had to call them something and ‘organs’ seemed to make sense. They are located at various places in the creature’s body (i.e. they’re attached to specific bones in the head, thorax or abdomen). All the organs are connected to a common bloodstream, where the chemicals are kept, and they connect to this (and hence to each other) via chemoreceptors and emitters. But the majority of their inputs and outputs pass through bundles of much faster nerve fibers, ending up somewhere in the brain.
Here they are, in no particular order:
Body
This is hardly an organ in the conventional sense, but the Body is what contains all of the creature’s muscles, and handles some of its growth processes.
The muscles come in antagonistic pairs, just as our biceps are paired with our triceps to bend and straighten our elbow. In the current creatures there are 34 of these pairs. One of the useful qualities of antagonistic pairs is that both muscles can go taut, making the joint stiffer, or both can go limp, allowing the joint to bend under its own weight or yield to external forces. As a result, the angle of the joint doesn’t necessarily match the behavior of the muscles, and so the body (just like ours) also generates nerve signals from proprioceptors, which measure the actual joint angles and transmit this information to the brain.
It’s important to understand that Phantasia is a completely physics-based simulation, so muscles are very important. Unlike NPCs in a conventional game, these creatures are not animated. Keyframe animation is what normally puts an NPC exactly where the programmer intended it to be, in exactly the right pose, and this usually pays no attention whatsoever to the floor and walls the NPC appears to be touching. The NPC would behave in exactly the same way, even if we took the floor away from under it. But here, everything has to be up to the creatures themselves, and they have to react to their environment. It’s like the difference between a cartoon, which looks the same every time you watch it, and real life.
The creatures walk by actually pressing their limbs against the ground in sequence and trying to keep their balance as the reaction forces (hopefully) propel them forward. When they fail to get this right, they fall over, not because they were programmed to fall over, but because they made a mistake. Admittedly, they don’t walk very well, compared to a beautifully hand-crafted animation, but the fact that they can walk at all is actually quite an achievement, given how unrealistic current physics engines are. I’ve seen a few programmers successfully model physics-based walking, but if you look closely, they often drag the body along a fixed path using ‘the hand of God’ and hope that the legs will stay suitably stuck to the ground. That’s not good enough for real autonomy. Tom Astle bravely tried to make his Wobbledogs walk using physics, and he had some success, but they tended to fly around all over the place in a crazy fashion, so in the end he very wisely made a feature out of it. I don’t blame him at all – it’s a really hard thing to do in real time, especially when there’s a lot of other stuff going on!
Genome
This too is not really an organ. In natural creatures almost every cell contains genes, but phantasians aren’t made from cells, so we need an ‘organ’ in which to hold and process their genetics. A womb, of sorts, except that males have one too. This is where the creature is physically constructed from its genes, and where conception and parts of pregnancy take place in females. Every time you reload a creature from disk, it will first be built genetically, as if it was brand new, and then the parts that have changed over time through experience get readjusted accordingly.
Most of the code in this organ acts as a language interpreter, helping to turn human-readable genes into virtual structures. I originally made the genes out of something much more like the ‘ACTG’ (adenine, cytosine, thymine and guanine) code used by DNA, so that you would be able to take part in the equivalent of the Human Genome Project and try to decipher what everything does. But it was so hard to make sense of what was going on myself, that I eventually decided to rewrite the genes as text, in a way that I could easily understand and edit. I can always convert them back into codons when I make a gene analyzer machine, but you’ve seen the text now, so that’s a bit of a spoiler! It’s still not simple to work out what the 800 or so individual genes actually do, though, nor how they work together to produce functional systems, so I think interested people will find that there’s plenty for them to investigate, even without having to decode the DNA one codon at a time. People are still investigating Creatures after thirty years, and this time there’s so much more to discover. I guess in principle I already know the answers to these questions, but it’s so complex that much of it is a mystery by now, even to me! I’m getting old – my memory is fading by the day…
Balance
This organ works rather like our inner ear. It tracks the creature’s speed, acceleration, center of gravity, rate of turn, compass direction, angle of pitch and roll, and so on. Unlike our own inner ear, it also keeps track of which feet seem to be touching the ground at any moment, which can be important for balance. Quite a lot of computation goes on in here, so that the brain has all the information it needs.
I admit I also cheat a little – this organ generates some extra forces that try to stop the creature from becoming too unstable, rather like adding training wheels to a tricycle. They still don’t always do what they’re meant to do, which is why the creatures tend to spin around crazily sometimes, but I’ll work on that. I do as little cheating as I can get away with, but the physics engine was designed for making explosions and knocking over barrels, not handling a self-propelled creature made from 34 pairs of muscles! Over the years, NVIDIA’s PhysX engine and its integration into Unity have both got much better, which is just as well, because it took me years to get them to walk at all. Now, they walk reasonably well, and can trot very nicely and even gallop, up to a point. They’ll get even better when I have some time to tweak their genes.
Guidance
The guidance organ is somewhat related to the balance organ, but it’s more concerned with figuring out where the creatures are horizontally, in relation to their local surroundings. Again, I had to cheat a bit, but even so, I was determined that the creatures would never simply be told where they are, in absolute XY terms. They only know where they are in local terms, rather like recognizing where we are in a hotel room, without necessarily knowing which city the hotel is in. The creatures’ brains can work out most of this information entirely by themselves, based on which way they think their eyes, head and body are facing from moment to moment as they catch sight of things, but given the sloppiness of their body joints and the lack of computer power, I found that they needed a little help, so that they can build up a sufficiently accurate map of where they’ve seen nearby obstacles and pathways.
Where they are located in global terms, on the other hand, is learned essentially from landmarks, along the lines of “I know by now that I can get to the river from this hilltop if I head east through those woods”, which doesn’t require any help from the guidance organ at all. It just needs learnable patterns of ‘landmarks’, which come from the eye.
Eye
This is not actually the creature’s eyes, exactly; it’s more like a large chunk of their primary visual system, and it’s pretty complex.
Phantasians don’t see raw ‘pixel’ data, because that would be quite impossible in a home computer running several creatures and an entire village in real time. What they actually see when they look at an object is just a simple pattern of visual cues – basically a description of how it looks, as in “it’s a tall, rounded, fleshy, spiky thing”. I need to come up with a better descriptive scheme for this eventually, but my goal was to make entities look distinct and different, and yet hope that objects with similar functions would look sufficiently similar to each other, so that when creatures have learned to recognize one object, they have some hope of guessing how another, somewhat similar one might behave. Much more on this later, because some of it (functional versus perceptual categorization) was the subject of my son Chris’s PhD thesis, and is still an active research topic for me.
But the main thing that the Eye organ deals with is visual attention. This is an enormously important aspect of natural intelligence and conscious experience, and yet it’s odd how little attention (!) artificial intelligence researchers tend to give it. Phantasians pay attention to individual objects in their local environment, depending on which one seems the most salient at any moment. Some of this activity happens bottom-up: fast moving objects are more salient than static ones; objects with knobs on them are more interesting than merely decorative ones; and so on. The rest happens top-down: creatures pay more attention to things that look similar to the object they’re actively seeking; or they’re more likely to glance in a certain direction when they’ve heard a sudden noise and worked out where to look. Sometimes they don’t pay attention to objects at all, but to points in space on the way towards where they last remember seeing that object (rather like, when we’re on our way to the bathroom, we might look at the doorway of the room we’re in, or a chair that we mustn’t bump into).
All of this information competes for the brain’s attention. A set of ‘daemons’ (which I named in honor of an old idea called Pandemonium) constantly evaluate visible objects in terms of some specific feature, and eventually the creature’s attention gets drawn to one of the objects with the highest overall salience. There’s a specific timing to this, related to visual saccades (little darting movements of the eyes) and this same timing drives other things too, deep in the brain. It’s all very complex, and it still needs quite a bit of tweaking, to be honest, but basically, every time a new object wins the vote of the daemons, the brain gets sent a nerve signal telling it where this object is on the retina. How this then plays out in terms of actual eye, head and body movements, will be the subject of the next lesson!
There are actually two kinds of attention: the object that the creature is currently looking at, and the object the creature is currently thinking about. They can only look at objects that are in view, obviously, and if this object seems important or relevant, it may also become the one they start thinking about. However, the creature can be casually (or perhaps curiously or nervously) glancing around at nearby objects to keep track of the general situation, while actually thinking about something entirely different. Possibly something that’s a long way away, based on where they last remember seeing it. Again, the significance of all this will become clear as we learn more about the brain.
Gut
The gut is what you might expect it to be: a pot of chemicals and receptors having to do with digestion. The actual chemicals hang out in the bloodstream, which is essentially an organ in its own right, but one that is accessible to all the other organs. The gut itself mostly contains various chemoreceptors and emitters. Perhaps the most obvious functions of the gut involve the production and excretion of urine and ‘poop’, as the creature converts food substances into energy, as well as powering the body’s muscles as they use up that energy.
Lungs
Creatures breathe in and out, and their breathing rate (as well as their heart rate) depends on how much energy they’re using up from moment to moment. This is all that the lungs do, right now, although soon they’ll be able to tell whether the creature is foolishly trying to breathe underwater, etc.
Ear
Guess what this does! Mostly the ear is concerned with establishing the direction of a sound, relative to the head. It also measures loudness, as well as a few basic hints about what kind of sound it is. It used to detect ‘spoken’ words, as well, but this needs a lot more thinking about at some point.
Skin
The skin is an organ because we need somewhere to detect touch and pain, and work out approximately which direction it came from, so that the brain can turn towards or away from it. The ‘nerve endings’ in the skin habituate, like ours do, so that an initial collision will have a strong effect, but repeated collisions over a short period have less and less effect.
If you put a leash around a creature’s neck, the tension on this tells the skin which way the collar is being pulled, and hence the creature will instinctively turn and/or move in response.
The other thing the skin can do is change color – creatures might turn a little blue with cold, red when they’re overheated, green when they’re sick, etc. Related things, like shivering, are carried out in the brain and communicated to the body.
Mouth
Rather like the Eye, which isn’t really an eye, the Mouth isn’t exactly a mouth either – but it’s the organ that causes things to happen in the creature’s world. The mouth bites things, pokes at things, grabs them, and makes noises. If they’re dragons, this will also be where the flames come from, of course.
If a creature decides to bite something, the bite doesn’t actually happen until the mouth gets close to the object that’s being thought about. Exactly how close it can get is quite a tricky problem, when everything is swaying around all over the place, and the objects have different sizes and vertical positions. I figure reasonably close is good enough, even if it can look a bit silly, but I’ll try to improve on that eventually. To be honest, it’s a good thing that most natural creatures largely interact with the world using their mouth, since this is conveniently right between their eyes, whereas hand-eye coordination, like humans use, makes for a much, much harder problem! All the phantasians have to do is keep pointing their head at the thing they want to interact with, and eventually they’ll (probably) hit it. It’s still not straightforward, because if they don’t slow down at just the right time they’re likely to overshoot. But creatures that have hands and literally manipulate their world will have to wait for later, as will creatures that swim or fly, because at least alpacas largely move in 2D!
Brain
The brain is an organ too, just like any other. It has chemoreceptors and emitters, neurochemicals, nerves, and all the rest. But it’s vastly more complicated than the other organs, and its innards are further divided into many maps, which are themselves divided into layers and columns.
And that’s what we’ll talk about next. I promise!
P.S. Expect a new software build this week (all being well). The new UI has been a pain, partly because of the usual tug-of-war between Unity subsystems that happens as the development landscape inevitably continues to evolve. There are two different input systems and three very different UI output systems in Unity (for drawing buttons, checkboxes, labels, etc.): One of the output systems is pretty ancient and obsolete, but it was all I had available years ago for making gene editors and stuff, so those will have to be rewritten at some point; the second is middle-aged, and most of the time doesn’t drive me completely insane, but it doesn’t support certain lighting features needed by the modern render engines, and unfortunately they’re not substantially developing it any more, so it never will; the third one is the new, quite complex system that I used for the more recent sliding menus, which is great but it won’t support user interfaces that operate in world space for months yet (Unity 6.2). Since I really wanted to use world space, to make an immersive, non-WIMP UI that solves a bunch of other constraints, I’ve had to go for the middle option, but it means I have to fudge some of the lighting issues, and one day I may have to rewrite it all. Nothing in Unity is ever easy…
About the muscles, I assume that explains the clumped meatballs. Because the brain sends zero signals to those muscles? Remind me on my dog, she sometimes runs or sniffs in her dreams. I would say it is 1-10% of the normal signal strength. Once I held some meat in front of her snout and she stopped muscle contractions resembling walking and started muscle contractions resembling eating.
Genome, that means every time we close our game, all creatures are killed and when we reload, new ones are created? We got a working teleporter ethical dilema! (Reminds me of this nice sci fy story https://youtu.be/iE0lZNkDnQs?si=QnRUU6GcnFfuyj91 )
And we get Letter based DNA down the line? Nice that means we can hide text in there for others to discover them, when they edit the creatures we edited.
Does balance work for the whole body or only the head bone? I assume the whole body, because the boolies never moved their head, when they tried to climb out of the river (witch made them fall over and stuck in the water)
Guidance – THANKS – the XY from the game causes to much problems. For example someone hooked an AI to Pokémon games and gave it XY coordinates to walk. That lead the AI to be compleatly confused, when exit and entry of an area where on the same map. And it was stuck in a cave for hours because of that….. Also once the ‘fans’ found out it did not see but gets XY feed, a lot if the ‘magic’ was lost and replaced with disappointment.
About the Eye, do moving objects get more attention as well? We players instinctively wave around stuff to get attention. Even with static NPCs who can’t interact at all. And if you need potential lists of descriptors for objects, this will be easy and fun for us. Learned to describe objects very well in the early days of AI art, when the program barely understood what what I meant.
Can the lungs also absorb chemicals? Smoke, smoke bombs, nicotine, THC etc? Or is that included in the Nose for computation reasons?
Skin, when I trow a stone at the creature, does it also feel where the impact occured? Once stones are added to the game …
Mouth, can dragons also produce poison instead or acid or whatever? And can it come out of the other end as well? Always funny in TV, when a sick dragon produces fire at the wrong end (would also enable stunks)
And can the creatures bite eatch other? And I defendly know how convenient the biting is, my birds always try to interact with everything with their mouth. Scratching only appears in my mammals. But biting is still their first attempt.