A Simple Way To Give a Bot Motivations, Decision Making, Better Autonomy
July 21, 2013
Recently, I got to thinking...there must be a better way to program autonomous behavior (than my previous attempts).
I thought about people, people have various motivations, why shouldn't bots? When people get hungry, they eat. When they get curious, they look around. When sleepy, they sleep. Surely bots have needs and priorities that should influence their behavior.
To try out the concept, I started with 5 motives. Remember, these are not the actions themselves merely the motivation at a given point in time of the bot to do a particular action.
2. Scan Motive
3. Explore Motive
4. Listen to Music Motive - my bot currently likes music and so starts playing immediately on startup, not because I told it to, but because that's what it likes to do.
5. Talking Motive (Does the bot talk about everything its doing or just the important stuff?...I think this feature will really help to not annoy me with repetitive jibber jabber!)
I realize this is all basic stuff, but I had to test the concept before I pile on a ton of motives.
So I wrote a simple service "MotiveSvc" that holds an array of "Motives". Each motive represents something the bot might like (or dislike) doing. Each motive has a start value, a goal value, and a movement rate. Ten times a second, the service interates through each motive and "moves" its value towards its "goal value", up or down, at its movement rate.
Whenever the bot is not otherwise busy, it asks the service "What do I want to do?" and the service responds with the highest priority (value) motive. The motive is then called and the motive executes some task or series of tasks.
When any task or set of tasks is complete, the service is given a chance to readjust priorities based on new information found.
Examples: If your bot just did a 180 degree video scan and found some thing or someone interesting, it might be more motivated to look in that direction, drive over to it, shoot it, etc. ...When x happens, bump up motivation of y by 25%.
In my case, I then do a similar readjustment of emotional states based on new info. Emotions are similar to Motives in that there is a set of them competing for emotional dominance, but thats another blog.
Behavior Adjustment - Swapping Personalities
The idea here is to adjust the settings (the start values, goal values, and movement rates, and feedback changes) until you get a single personality that you like, or make multiple sets of values and load the one you want at a given time. My bot has a database onboard, so I intend to create and name multiple personalities that I can load at any time. An SD card or some other persistence mechanism could be used. Then I can make one that is talkative to help in debugging, and another that likes to shoot things.
Results So Far
So far, I like it a lot. With just a few motives, the bot seems a LOT more life-like, autonomous. I find myself watching the bot "do its thing" more while hitting far less buttons on my remote control. It will take a lot more work to get all the motives I'll ultimately want, tweak the settings and feedbacks so the resultant behavior makes sense. All in all though, I think it is a much more promising way to build autonomous behavior than my previous approaches, which were more procedural or cause and effect type behavior. Having said that, there is still a place for both of those patterns as well. I think Motives are a good layer to put "on top" of the the other two.
If anybody is reading this far...Does the concept of Motives seem interesting or fruitful in your experience? Any other ideas/solutions that people have tried or seem more appropriate?
Other Random Food for Thought
What type of behavior could result if you made a bot like "Money", "Praise", or other concepts? Could motives be made to be alterable by the bot itself in response to rewards/punishments in the environment? Let's say a bot likes money but hates moving around due to battey consumption. If people gave it money when it moved around and performed (Street Performer Bot), might the bot decide to like moving around when in the presence of people in order to get money?
Anybody got any crazy (non-sexual) motivations they might like to see in a bot?