Posted by Michael on June 28th, 2006, in Development
Originally we had planned to re-use the Action List system that we had developed for 8 but reading Elizabeth Gordon’s article about behaviours as lists of rules has made us reconsider.
Objects offer opportunities to an actor. Each opportunity consists of a sequence of actions required to achieve the goal of the opportunity. For example the opportunity “Drink” translates to “go to the table, pick up the glass, drink, put down the glass, sigh”. We will call such a sequence a behaviour.
The behaviour -or action sequence- could be stored with the object. Or the object could refer to a generic behaviour stored indepedently -so that the behaviour could be shared by multiple objects.
The original idea was to simply store a behaviour as a list of actions. This list would be copied to an actor’s Action List when the opportunity is chosen as a goal. Then the actor would do each action on the list and remove it when it’s done. When the Action List is empty, the actor does idle behaviour until a new goal is selected.
This is a slight simplification for the sake of argument. In reality, a new goals can be chosen at any time, possibly interrupting and replacing the current sequence.
Miss Gordon’s idea could be applied to Drama Princess as follows.
Rather than a simple list of actions, the actions would be arranged in an if-then-else series with the final goal at the top of the list and the first thing to do at the bottom. And rather than copying this sequence, the actor would simply remember the location of the behaviour and read it directly from there.
Rather than a simple action, each line of the list would include a condition for this action to happen. So in our previous example, the behaviour would read like “if you have put down the glass then sigh, else if you have drunk then put down the glass, else if you have a glass in your hand then drink, else if you’re close to the table then pick up the glass, else if you can see the table then walk to the table, else give up or refuse.”
The conditions could be more complex, like “if you’re close to the table and the class is not dirty” or “if you can see the table and it’s not too far”, etcetera. For Drama Princess, it will be important that these conditions can be described in an objective way. “Too far” might be different for each character so we cannot hard-code a number of meters in the condition.
Rather than keeping track of when an action has been completed in order to proceed to the next line in the Action List, the actor would simply call the complete behaviour all the time and automatically move up the list when an action is complete (i.e. when a condition evaluates as true). The end-to-start order means that the actor wouldn’t even try to walk to the table if it already has a glass in its hand, e.g.
Such a system simplifies Drama Princess in two ways.
- It removes the requirement of copying the action sequence. In fact it removes the requirement of an actor having an Action List altogether.
- And it removes seperate checking for subgoals achievement since this is built into the format of the list of rules.
8 Comments »
Posted by Michael on June 28th, 2006, in Books
The most recent part in the series.
I immediately jumped into the Architecture section and found 2 gems already. Sergio Garces’ “Flexible Object-Composition Architecture” is a more or less exact description of the method we’ve been using for Quest3D programming since a few years already (introduced to us by Ronald Jones). So it’s reassuring to read an expert’s opinion on this.
And Elizabeth Gordon’s description of behaviours as ordered lists of rules in “A Goal-Based, Multitasking Agent Architecture” is very inspiring.
“A behavior is a list of rules for achieving a goal, where each rule consists of a condition and then one or more actions to be executed if the condition is satisfied. The rules are evaluated in order from top to bottom during each game loop, and the first rule that matches is executed. The ordering of the rules should be such that the first step in the behavior is at the bottom, the second step is just above that, and so on, with the topmost rule checking whether the goal has been successfully achieved. When read from bottom to top, the rules shold thus form a complete plan. It should be clear that this structure is essentially a function containing only an if-then statement. (…) A behavior encoded in this way gives game characters important flexibility: if an action fails, the character will simply try again. If the chaacter can no longer perform the action, it will drop down to an earlier step in the plan, and if a step can be skipped, the character will skip it automatically.”
Beautiful… Elegant… Let’s steal it! 👿
1 Comment »
Posted by Michael on June 24th, 2006, in Development
Sometimes you may want an NPC to perform a certain task in the game. You could try to tweak the character’s personality so that it would be naturally inclined to do these tasks. But it’s probably a better idea to just tell it to do something.
You don’t want the character to be fully scripted, of course. After it has performed its task, the character can go back to autonomously choosing opportunities from the environment. Until the conditions for performing the task appear again.
This basically means that a character can be switched between autonomous and controlled states. The controlled state is when the character performs tasks for the game. One of these tasks might be allowing the player to control the character as an avatar, perhaps. Or scripted behaviours which can be simple (go to a certain location) or complex (follow a character while hiding behind trees and run away when a monster comes near).
The latter might approach certain forms of game AI, so you might end up switching between one type of AI and another. 😕
2 Comments »
Posted by Michael on June 23rd, 2006, in Development
Every actor has a basic set of motions that it can use to perform the actions to achieve a goal. But to interact with objects, it is the object itself that offers the motions to the actor. Such a set of motions is stored seperately so that different objects with similar interaction possibilities can share them.
An actor has a dedicated “motion container” in which the motions specific to the object it is interacting with are loaded. Every time a new object is chosen, new motions are loaded into this container, thus unloading the previous ones and keeping memory usage low (and the actor stupid 😉 ).
No Comments »
Posted by Michael on June 21st, 2006, in Development
One of the interesting things that came out of the Drama Princess Symposium was the fact that it was perfectly acceptable for an autonomous character to be stupid, as long as it was believable. One of the things that made The Sims less believable was the fact that all Sims play the same animation to achieve the same goal. The fact that they had an enormous amount of opportunities to choose as their goal (=intelligent) did not make up for this.
We have already defined opportunities as things that are offered by the environment. The idea is that this will lead to surprising behaviour. Instead of equipping the actor with a “pickup and throw” behaviour that it can apply to many different objects, you will never see a Drama Princess actor pick up and throw something until it finds a ball. The same is true for other characters. Drama Princess characters offer unique ways to the actors of interacting with them.
One thing that can aid this is to use our conditions to help the actor make a decision. There could be an opportunity that says “show you love me” and there could be several conditions like “if you’re younger then me, do this” and “if you’re my lover, do that” and “if you’re a dog do this other thing”. If the conditions are not there, the variation would depend on the actor: each actor may express “show you love me” in their own way(s).
But to get back to the opening paragraph, it would seem like a large number of opportunities to choose from an object as a goal, is not as important as a multitude of ways of achieving this goal. Some of this variety could be moved to the opportunities list where an object could advertise both “run to me and pick me up” and “summersault, fall, land next to me and pick me up”. But it seems like it would be advantageous to just have one opportunity “come to me and pick me up” and to let the actor pick one of several of his own ways in which to do this. If only because a shorter list of opportunities will require less processing when making the decision.
For the sake of variety, which way to “come” and which way to “pick up”, should be chosen randomly by the actor. But since certain ways of moving express emotions, we should take into account the actor’s intimacy level with the pertaining object when making the choice. If they dislike the object deeply, they shouldn’t be summersaulting towards it.
So rather than inventing a large number of interactions, it seems like it would be aid believability more to create a large number of animations to perform the same interaction.
This means that a ball would only advertise, e.g. “kick me”, “throw me” and “pick me up” and that an actor would have several ways of kicking, throwing and picking up. As a basis, all actors could share the same animations for this. But if time and budget permit, unique animations could be added for each character.
No Comments »
Posted by Michael on June 20th, 2006, in Development
This is an updated and elaborated version of Decision filters. It deals with the way in which the global list of opportunities advertised by all objects is reduced to a single goal by an actor. This time, rather than ordering the list, we simply remove the items we don’t want until a single opportunity remains.
Notes about implimentation are in monotype
.
Objective list of opportunities
Every object has a list of opportunities with corresponding intimacy values. All opportunities of all objects in a scene are collected in an global, objective list. All actors in the scene consult this list.
The opportunities list is an array with a row for every opportunity and columns for object ID, intimacy, condition, etc. This list can be created at runtime, or saved with the scene. This list is static and only changes if the scene changes.
Personal list of opportunities
Every actor makes a list of the same size and order where it can keep its personal notes about the opportunities. This is where the dynamic fascination for each opportunity is stored.
Objective list of objects
There is a global list of all objects in the scene. This includes environments, inanimate items and actors. This is where all data about each object is stored. This list can be consulted by every actor when they need to know something about an object.
The global list of objects is an aray with a row for each object and a column for category, state, position, etc, a column for the the level of intimacy of the relationship with each actor and a column for each actor's attitude about this relationship. The latter are personal to an actor but shared by both members of the relationship, which is why the are stored in an objective list. To simplify the array, intimacy and attitude could be stored in a single (vector) column.
The "state" column keeps track of an object's availability. This includes whether or not another actor is interacting with it. The latter serves as a parameter every time relationships are evaluated due to seperation: once in a while all relationships move a bit towards indifference except the ones that are currently involved in an interaction.
Selection filters
Once in a while, an actor goes through the whole list and removes the opportunities that don’t interest it. This happens through a series of filters. After each filter, the number of desirable opportunities is reduced.
Basically, the actor keeps a list of numbers: row numbers of the opportunities list. With each filter it removes the numbers of rows that it doesn't want to choose.
Selection parameters are relative to the available opportunities. If they would be absolute, there would be a chance that no goal remains after the filtering process.
Where possible the filters are ordered for optimal performance: filters that are processor-intensive should be executed as late in the chain as possible (i.e. with as small a number of opportunities as possible).
Running the different filters can be spread out over several frames to optimize performance.
- Filter of Availability
Removes the opportunities of objects that are not available.
E.g. because they are being used by another actor.
- Filter of Distance
Removes the opportunities of objects that are too far away.
This depends on their type: characters can be further away than objects.
Type is deduced from the category property of an object.
- Filter of Condition
Remove the opportunities of which the condition cannot be satisified.
E.g. passionate kissing if the actor is a young child and the object an adult.
- Filter of Intimacy
Removes the opportunities that match the relationship the least.
Based on the intimacy level of the opportunity modified by the actor's fascination for this opportunity.
- Filter of Fondness
Removes the opportunities of objects that the actor likes least.
Based on the intimacy level of the relationship modified by the actor's attitude.
- Filter of Goal
Selects a single opportunity and makes it the actor’s goal.
Random selection out of the remaining opportunies.
Every filter (except for the first and the third) uses a little bit of randomness to allow for unexpected choices.
I’m unsure about the order of the filters of Intimacy and Fondness. Should the actor select objects first, or opportunities?
3 Comments »
Posted by Michael on June 20th, 2006, in Development
Attention span is a property of an actor. It reduces every time the actor interacts with the same object as previously and is reset to maximum when the actor switches objects.
Actors will prefer to interact with objects that they like. Attention span prevents obsession with a single object and forces the character to interact with another object once in a while.
There’s a problem with this. If attention span is reset to maximum when the actor picks a new object, it will go back to the previous object whenever it needs to make a new decision. Because it likes that object so much.
So you’d see a girl playing with a ball in different ways, then picking up a stick and throwing it away, after which she will play with the ball again.
Of course we always have a chance of break-up which would make the girl lose her fondness for the ball and thus allow her to choose to interact with another object. But break-up should remain relatively rare for dramatic reasons.
If attention span were to work for objects in a similar way as fascination works for opportunities, we would see attention span for a specific object drop as you keep interacting with it. When you’re done interacting, attention span would rise back to maximum slowly.
This sounds like attitude to me. Currently, attitude keeps track of whether the actor prefers to make a relationship better or worse. It’s a boolean value (good or bad) and it’s connected to the relationship with an object. We could expand attitude so that it can express how much you like to make the relationship better or worse.
Here’s how that would work:
The normal level of attitude is the maximum. When you interact with an object, your attitude about this object decreases. All of this in absolute terms while good or bad are signified by plus or minus and do not change in this operation. Attitude modifies your intimacy with an object temporarily. In other words: you get bored, even with objects that you like. While you’re interacting with another object, the attitude about the previous one slowly improves.
We will have to find a careful balance between attitude and decrease of intimacy through seperation. The latter lasts a lot longer and should thus be invoked less frequently.
1 Comment »
Posted by Michael on June 19th, 2006, in Development
This is a summary of my earlier musings about hostility and intimacy.It leads to the introduction of attitude which allows an actor to choose actions that make relationships better or worse.
Each item in the gameworld has a list of opportunities. Those are interactions that an actor can do with them. Each opportunity has an intimacy value associated with it. This intimacy value expresses the intimacy of the relationship that is desired to perform this interaction.
Items can be environments, inanimate things and actors.
An object is an item that advertises its list of opportunities to all actors.
Each actor has a relationship with each object which is expressed in a level of intimacy. This level can be positive (friendship), negative (hostility) or neutral (indifference).
About each relationship, every actor has an attitude. This attitude is the way in which the actor plans to continue its relationship: towards more or less intimacy.
Relationships, including their intimacy and attitude, are shared by both members of the relationship. For reasons of simplicity, asymmetrical relationships do not exist in the world of Drama Princess.
Each actor also has a degree of enthusiasm. Very enthusiastic actors will choose opportunities with intimacy level that are far removed from the intimacy of the relationship. If the attitude about the relationship is positive, the actor will choose an opportunity of a much higher intimacy level. And vice versa. A less enthusiastic actor will be more careful and choose opportunities that are only slightly higher or lower than the intimacy level.
Every interaction impacts the level of intimacy of the relationship. Choosing an opportunity with a lower intimacy level than the relationship will decrease the relationship. And vice versa.
The bigger the difference between the enthusiasm values of the actors, the bigger the chance of a break-up. At least in good relationships. In bad relationships, there is no chance for a break-up. The relationship will simply get worse as actors keep interacting with each other.
Seperation of an actor from an object will cause its relationship with this object to slowly evolve towards neutral. I.e. a bad relationship will get better, a good one worse.
Shock is an external event that can cause a break-up, disregarding the level of relationship.
A break-up resets the relationship to neutral intimacy. When the relationship is more or less neutral, the attitude can keep changing. Only when the relationship has started to develop in a certain direction, will the attitude be fixed in that direction.
1 Comment »
Posted by Michael on June 19th, 2006, in Books
Auriea read this book. It was interesting enough but is very dated by now. We remember sharing many of the same dreams back in the nineties. The future was quite different then.
3 Comments »
Posted by Michael on June 19th, 2006, in Development
Every item in the game world that can be interacted with (i.e. every “object”) broadcasts a list of opportunities to all actors. The actors can then choose to do one of these interactions.
Sometimes, however, the object might only want the interaction to take place in certain situations. E.g. the interaction may only work if the actor is sitting down. Or if the actor is a young child. Or if it is raining.
For this reason, every opportunity has a condition that needs to be fulfilled before the character can choose it as a goal.
In general most opportunities will be available for most actors. So the condition should be optional, to minimize processing time.
The condition should have an open format that suits any situation.
No Comments »