Tuesday 11 March 2014

Introducing "motivations"

The intelligence at level 5 is quite nice, almost perfect, or may be perfect, but there is something we can't control: the goals.

We never knows what the AI will decide to do to solve the puzzle we present to it, nor we know witch goal, if any, will it follow.

This is quite nice to have something like this, it could react to unespected scenarios as if it were used to them, but it would also be lovely to be able to "drive" the curse of action towards some more mundane goals: domesticate the intelligence and make it follow our likings.

Redefining goals will make this AI suitable for optimizing -in any sense- any system you could define and simulate, in a "intelligent way". Anything. Amazing.



And how do we get that?

Back when we defined in pseu-code the level 5 intelligence, there were a line 1.3.3) where I asked you to keep a sumatory of all small distances runned in every tick, so once you reach a future, you have the "raced distance" calculated.

This "raced distance", when introduced to the intelligence back in the post about entropy and energy, gave the kart a great bust in velocity: compared, it was like having speed in the veins!

This method to score futures with the sqared distance raced was neutral as it appears on the entropy definition, but using "distance raced" as the way to measure it all, it was not really on the formulas, not this way.

What I mean is that, in general, after a small time simulation, your kart has passed from a situation or state "A" to a new state "B", and all we need to make the AI work, is provide it with a formula to measure how much have we earned when moving from "A" to "B".

Using the euclidean distance between position "A" and position "B" was a natural election, given I was thinking on racing karts, but any other function Score(A, B) could have done, as far as the resulting score is always a non negative number (this is important, no negative thinking is allowed) like it happends for a distance.

So this is the ultimate point in the algortihm we can twist to make the kart, or witchever you simulate, to follow our orders, orders that need to have the form of a function Score(A, B) as mentioned.

Let see first what can be achieved with this method:



In this video you see 3 karts, white one is the usual one, his only "goal" in life is to run as far as possible, it uses score = raced distance, as in AI level 5 or 6.

New things start with yellow kart. This ones has two "goals" in life, running far as the white one, plus another one, represented with a green line, that score how many degrees has traveled the kart counter clock wise, and add this to the future's score. Remember, always positive, so if the kart drive back, clock wise, it will not socre negative, just will not score at all.

The efect is that yellow kart has a natural tendency to rotate around a central point, so tends to drive in spiral to the central point, as if it were pulled into a wirpool. This tendency is mixed with the racing one, so it tends to run faster and around the central point.

And orange one, this one is fantastic! I added 100 drops of "score", so when the orange kart passes over one drop, all its points are added to this future's score. Just this. And look how it brakes before a drop not to pass by, take it, then goes for another, it is like a bee or an ant loking for food.

In future tests, I would like to simulate more behaviours by introducing new kind of "goals", for instance, orange kart could get extra score for taking the collected drops to a central storage!

And at last, I have managed to comment on the blog about what I am working on now: goals! This video above is from todays' version of the software, so it is hot.

I left for other post all the physics behind this way to manipulate the AI, because we are still using plain entropy, no matter how adapted to our need it is, there are restrictions that made us remember that it is all about is entropy.

So now that you are up to date, I can tell you a little on what I am planning to play with next days, and please, any ideas about how to continue from here will be much wellcomed!

So, this new "goals" are in my mind now. First thing, I need to make a "stack" of goals, so I can mix a bunch of them in a single intelligence without much effort, I already have been thinking about the kind of goals I will need, may be there is 3 or 4 main types, and the rules of stacking are clear from months ago, so I need to code it and think about an scentario to test it properly.

Next thing I am working on is "Team intelligence", make all the karts to think as one and behave in the best way for the group as a whole. May be this will end up being "team goals" that accumulate some way with the own player's goals... some of this is in the actual code, but it is not usable this far.

It would be nice to emulate a terrarium with different creatures and make them figth for survival... add it a little evolutive algortihm and you have an way to incubate more capable intelligences. Use a real scenario and the algortihm could find a better tool and clever ways to use them on this scenario, starting with the actual tool used for this purpouse.

But all this is just future, so I will now focus on stacking goals together and play with it (hey, it must be the decission that opens more possible futures on how to evolve the AI, isn't it?)!

3 comments:

  1. Orange kart is hipnotic... I wish I had wait until it eats all the drops!

    ReplyDelete
  2. Fantastic! I see so many ways to adjust behaviour based on scoring. Truly fascinating. So many ideas.... Shouldn't have read this at night. How will I sleep now!

    ReplyDelete
    Replies
    1. Wait to see next video... I will post it today, and now the goal of retrieving drops is shared with all the karts, so they fight to get the drops!

      Really amazing, it surpased all my expectations!

      Delete