Introduction
After discussing the simpliest feeling associated with a goal, the enjoy feeling and its counterpart, the fear feeling, and the way the are added to calculate the global "step enjoy" feeling after a agent change of state -or step- we are now going to start dealing with the enjoy modulators.We will start with the "mood feelings", the simpliest and more evident form of enjoy changers, and then turn into the most strange ones, the gain and loose enjoy modulators.
Mood feelings
Imagine you are the agent, you are walking on the forest, at a given speed, experiencing the enjoy feeling of "I enjoy speeding" represented by the distance walked. But today your energy is quite low, and moving on consumes the very last pieces of energy in you. Obviously, you are not enjoying it very much.
Now you are plenty of energy, but you have a health problem with your knees, or a small peeble in your shoes, and this makes the walk much less enjoyable.
By considering that your health indicator, from 1 to 0, when gets lower, makes all the enjoy feelings lees enjoyable in this same factor, we can use it in our formula as being a coeficient that multiplies the global step enjoy feeling, making it higher when you are ok, and a little less when you are feeling sick.
If you add the energy as another factor that contributes to make the walk less enjoyable, then we end up withh a formula, based on the global enjoy feeling or "StepEnjoy" discused in the last post, like this:
StepScore = StepEnjoy * (product of all mood factors)
That in the case of a kart like the ones in the videos:
StepEnjoy = Sqrt(Raced² + (Energy*dt)² + (Health*dt)²)
And then:
StepScore = Sqrt(Raced² + (Energy*dt)² + (Health*dt)²) * (Energy * Health)
High feelings
In the two examples above, both moods had factors lower than 1, meaning it reprented something that can make your walk worst than usual, but as always, there is another side: if you have a mood with a factor higher than 1, it would mean you are modelling a "high feeling".Imagine you want your two agents to try to walk together. The most efficient way to do it is by adding a mood feeling that use the distance between them to compute a factor that is higher than one when they are near, and lower than 1 when they are apart.
TogheterFactor = 10 / (1+distance)
It will score higher than one when you are nearer than 9 units, making it more enjoyable than not walking near, so they will naturally tend to walk together. Adding one was just to avoid zero divisions, dirty minds!
So you can add a new goal, the "together" goal, and model it as having enjoy feeling of zero and a mood factor of 10/(1+distance) and make the agent to love wlaking together.
Using a goal with zero enjoy feeling is not the best option, in this case we used it just to show how to build a goal that only affects the mood, but in my implementation, enjoy feeling is distance*dt and the mood factor is 10/(1+distance).
Example
Those kind of feelings are new to the emotional engine, so there are not previous posts about it or videos, but I have filmed one that shows mood feelings in action. You will notice how sutile some of the movements are when compared to the examples using goal-less inteligence or even the video showing one enjoy feeling (the distance raced example).The agents in the video also bost some of the newer "loose feelings" to avoid near crashes, but for the most of the time, the enjoy feelings and the mood factors do all the work.
Great blog you have here
ReplyDelete