It's been a long time since I posted anything. It's like at some point life got in the way and when the dust settled I forgot I had a livejounral or something like that...
The project web site is up (actually has been for a while) at
http://rpg.animemayhem.com and I have 7 of the 8 main characters done in the
character section. I've been on and off doing things for various parts of the game varying from modelling the characters and world, to planning the major AI system. Much progress made but still lots to go. I've commissioned character art and various character referencing material (for me to do 3D modelling and personality studies for each character) but otherwise I'm still a lone soul on this journey so it's very slow going.
The plan for the AI is starting to take shape and looks like the following:
A knowledge base stores facts about the world in the form of symbols. The current incarnation of symbol may be seen on the development section on the
project page. Symbols closer to the top are more general while ones deeper in are more specific. Each symbol may have a logical expression that asserts its application in terms of the world environment (so a 'darkness' symbol might be an expression asserting the light level of the actor's current environment is below some threshold). The provides a language for an AI agent (actor) to interact with the world.
The main part of the AI agent consists of a
Markov Decision Process (MDP). MDPs are used in robotics to teach robots to perform tasks. Similarly the MDP of an agent does pretty much the same thing in that the agent learns to perform actions within the world.
What actions? Good question and this is where goals come in. An agent will have some set of goals at any time and is working to realize them. All possible goals are enumerated in the knowledge base. Not all goals are suitable to all agents in the world (the Knowledge Base list is an exhaustive list of goals for all agents). Goals available to an agent would depend on location in the world, timing and other environmental variables. Also an agent's persona might exclude otherwise possible goals (killing someone may be a possible goal but would contravene certain character archetypes [the so-called good alignments in other RPG nomenclatures]). An agent may break a main goal into many sub goals and work them progressively.
An MDP works by having an overseeing trainer indicate a reward feedback so this is where consequences of an agents actions are evaluated. The first consideration is persona and actions contrary to the agent's persona result in appropriately negative feedback. Actions suitable to persona (ie: In Character) have higher reward. Next consideration are active goals and sub goals. Actions that proceed to one or more goals or subgoals yield higher reward than actions that are neutral, contrary or interfere with goals. An action that accomplishes more goals is more rewarding than one that accomplishes fewer. The worse an action is in terms of overall goals the more negative the feedback. Persona is weighted so that a major out-of-character action is bad no matter how many goals would be achieved.
For the oversight process to judge character it needs to understand correlation between an action (or sequences of actions, over any amount of time) and aspects of persona. It's easy to see that the input for this comes from a highly variant and noisy world full of many, many varied actions and time frames are also quite varied so significant actions and time frames need to be identified. This can be thought of as a classification problem in which case a beast called a
Support Vector Machine (SVM for short) may be used to pick out the significant events (including actions) in an otherwise noisy signal of all the world's events and actions. This SVM is usable by both the actor and overseer to understand what is going on in the world in terms of significant events and actions. It lets the overseer determine an agents actions compared against the agent's persona. It lets an agent observe another character (either a player or another agent or itself) and estimate a best-guess persona based on observed actions/events.
The final wrinkle are emotion vectors. An agent's emotion vector is considered by the overseer against its actions. An agent currently 'sad' should not be doing actions like 'happy dance'. The emotional part has rules for how emotion changes based on significant observed actions translate to emotion change of the agent's vector. The emotion evaluator also uses the aforementioned SVM to identify significant events/actions relevant to an agent's current and future emotion vector (and also couples this to persona so that 'good' characters feel bad when 'bad' things happen, vice versa, and everything in-between).
So that's the schematic of the AI system. One other challenge I may take on is to have a director. A director in this case is more along the lines of a movie director, if you consider the game's world to be a stage. So this director would be looking at everything going on in the world and find the best parts to tell a story with. Similar to agents, the director uses a SVM to identify significant actions/events (or sequences of actions/events over arbitrary time) and is rewarded (the director is a MDP) higher when the stories "cut" are better. I could use crowd sourcing to provide part of the reward for that one.