Pyke

I think I can start out with a sort of Maslow's hierarchy of needs, an abstract calculus for figuring out roughly what a creature's concerns are at any given point in time and weighing them accordingly.

I don't have a good approach in mind for how to do this yet. I suppose that each creature has an awareness of their context, and this awareness informs their motivations. They have some varying ability to delay gratification, so they don't abandon something that's 99% done to go eat a snack at the first pang of hunger, then start over.

This gets very complicated, though, when we think of all of the possible circumstances that might occur in a creature's context, and all of the different ways these might be weighted.

One way of handling this generically might be a sort of multilevel priority queue. Briefly, we could loop through the hierarchical levels (Physiological, Safety, Social, Esteem, etc) and see which messages exist and their priority levels. These priority levels might be similar to e.g. RFC 5424 levels (debug, info, notice, warning, error, critical, alert, emergency).

These priority levels should then be weighted relative to one another across the hierarchical levels, creating a table. This can vary by species, so that self-actualization is far less important than social needs for certain species, and possibly might vary per individual as well. That can allow re-sorting the "pyramid" model.

As an actor moves through the world, they receive updates from their context. They incorporate this, through the subjective filter of their weighting, into an internal reflection of the state of the world, with the most significant weighted messages having precedence. If we say they're at a certain level, that means that they've had no messages more significant than that level any time recently. (Everyone is always at at least INFO; let's just think of DEBUG and TRACE as unconscious.)

For instance, let's say that a goblin is walking through the woods.

So, to calculate, we might have a table like the following for goblins:

| Priority | Physiological | Safety | Social | Personal | Higher | |--|--|--|--|--|--| | Debug | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | | Info | 0.08 | 0.05 | 0.05 | 0.03 | 0.02 | | Notice | 0.2 | 0.18 | 0.17 | 0.15 | 0.1 | | Warning | 0.4 | 0.3 | 0.2 | 0.18 | 0.12 | | Error | 0.8 | 0.7 | 0.55 | 0.4 | 0.14 | | Critical | 0.9 | 0.75 | 0.6 | 0.5 | 0.16 | | Alert | 0.95 | 0.8 | 0.7 | 0.6 | 0.18 | | Emergency | 1.0 | 0.9 | 0.8 | 0.7 | 0.2 |

(This is just a rough idea, it would obviously need to be tuned considerably.)

So our goblin is at NOTICE/NOTICE/INFO/INFO/NOTICE overall, which are weighted 0.2, 0.18, 0.05, 0.03, 0.1.

This means he'd act to bring his Physiological state to the desired state. So he grabs an apple and eats it. Then he's at 0.08/0.18/0.05/0.03/0.1.

So he might then do something to bring his Safety state to the desired state. He sniffs around for signs of bugbears.

If he smells some, this is likely to arouse his feelings of personal immediate danger, raising it to WARNING, and his feelings of safety, raising it to WARNING as well. He would then behave differently: move more stealthily. He might head back to his village to confer. This might change the behavior of other goblins; they might travel only in groups of 2-3 or even 6-8, to increase their feelings of safety.

If not, then Safety should get improved as well, to Info. At this point, his Higher motivations kick in, and perhaps he inspects his goats for signs of poor health.

So, implementing this practically, we can view the psychological state of the goblin as a 64-bit bitfield, with the most significant bit being PHYSIOLOGICAL EMERGENCY and the least significant bit being TRANSCENDENT TRACE (I might need to work on these naems). Each of these has a float assigned, stored within the individual and derived from a species-level prototype, modified slightly by chance, and possibly modified by past experience.

Each turn, the bitfield is iterated and the floats corresponding to the set bits are compared.

Some more thinking:

More thoughts:

  1. Each entity springs into existence as a tabula rasa.
  2. Sensory events are emitted by the world and things in it.
  3. Each entity has a perceptual filter that passes, blocks, or transforms sensory events.
  4. Each entity has a perceptual receiver that calculates an actual representation of the world state based on the received sensory events. [Note: this sounds a lot like functional reactive programming. I might need to dedicate some time to working on that specifically.]
  5. Each entity has a desired representation of the world state as well.
  6. The entity has a dissonance system that compares the actual and desired representations of the world state and creates events corresponding to these differences. [More FRP.]
  7. These discrepancies form the Goal Set.
  8. The entity will formulate an Action Set to resolve the discrepancy. This is normally derived directly from the entity's species or something like that, but the entity can modify this. If he has the "cowardly" trait, or if both of his arms have been severed, being aggressive might not make any sense.
  9. The planner will review the Action Set and Goal Set and formulate a course of Actions to take to achieve the Goal state.