quote: Original post by bishop_pass
As for organization, I see the object data organized by action. For each object, there are a number of actions. Each action gets its own frame of data with fields defining the action, the goal that can be achieved, who might ''afford'' to use it, notice it, etc. The goals of each action chain together so the NPC can effectively plan a sequence of actions and place this plan on its agenda.
I would NOT organise by action, but rather by goal. The Active Objects querying objects around it will do so to achieve a certain goal, not to perform a certain action. In fact, often it will be so that the action was previously entirely unknown to the Active Object. Take for instance the old Sims example of the ball. The action of ball is "to play football". However, the NPC doesn''t know what football is. It''s asking around "is there anything fun I can do around here", and the ball answers "Yeah, you can play -football- with me, and that''s -fun-". What football entails is secondary (and encoded within the ball). To the NPC, what matters is that it is fun.
All the "goals" have to be defined beforehand though - at least the "low-level" goals. I''m a big fan of layering though, so you could add "rules" to goals later, such as "Relaxation = fun + energy". And then when you''re low on energy and bored, you could try to search for "relaxing" things first, before trying to satisfy the goals separately. Of course, that doesn''t change anything about the engine, it just makes it seem more "intelligent" when communicating. It''s much better when the engine tells you "you''re relaxing in front of the telly" than "you are having fun and resting in front of the telly".
The deadlock situation with "keys locked in car" is easily solved - because there is no path that leads you closer to your goal. You simply classify it as an impossible goal (note to self: obviously, it has become important to mark certain goals as "impossible" due to certain conditions).
A worse kind of deadlock is a bounce-back-and-forth deadlock. I''m trying to think of an example, but I can''t find one off the top of my head, but it would be something like:
-Try to achieve goal A, ending up in situation 1.
-Situation 1 makes goal B more important than goal A, so try to achieve goal B, ending up in situation 2.
-Situation 2 makes goal A more important than goal B, etc...
However, with my vague understanding of the agenda idea, and how much it looks like a graph ( ) you can use graph theory, avoiding getting into a loop.