vendredi 19 août 2011

Does the past exist yet?

Two weeks ago, I finished a first prototype of a key/door puzzles generator using some quantum physics paradigm to drive the states of keys and doors at observation time. This proved me that it was possible to synthesize (JIT) a big part of a game world while keeping it interesting and procedurally generated.

Now, I would like to extend this idea beyond simple key/door puzzles.  To achieve that, i need to add NPC and behaviors to the mix.  The big change is that NPC behaviors imply causality, that is to say: cause and effects.  Here is a causality example in the context of my crime investigation prototype: the murderer NPC wants to steal evidences on the crime scene (cause) but he is spotted by the player that just happen to be also there. The murderer flees (effect).  This simple example shows how the player can use causality reasoning to get clues on the murder and to use them progress in his investigation.  In this example, the NPC that arrives on the crime scene, and that all of a sudden flees, instantaneously becomes suspect for the player.

If we try to implement this example, we will quickly run into a big problem:  
if the murderer NPC have a standard goal oriented IA, how big are the chances that he would arrive on the crime scene to steal evidences when the player just happen to be also there ?  The chances for this coincidence are actually very low.  However, those story-pushing coincidences happen all the time in non interactive stories such as TV series and movies.
 
In regard to this problem, it’s important to define two notions:

1.       “Player Centricity” is the fact that the interesting events (the murderer fleeing the crime scene) happen when the player is there to observe them and to interact with them.  This is what happens all the time in non-interactive stories and this is what we would like to implement.

2.       “Agent Centricity” is the fact that the NPC AI acts in accordance to their own needs and goals (agency) and not in accordance to what would be the best for the player experience. In our example, chances are high that the murderer NPC would be doing something else when the player decides to quickly visit the crime scene.

Player Centricity is achieved in games by scripting. The “Call of Duty” series being one of the best example of this principle.  Unfortunately, this has to be implemented in a linear way to insure NPC behavior causality chain coherence.

In less scripted games, Agent Centricity allows NPC AI to have coherent “cause and effect” chains in a nonlinear way.  But then, the problem is that very interesting things are done by NPC AIs but are never noticed by any players because those events are not happening while the player is watching. This is one of the most frustrating issues for squad based combat AI developers ;-)

For DramaticGames, what I would like to implement, is a mix of both Player Centricity and Agent Centricity.  Here is how it could work:

  1. Each NPC has a special AI that generates all the simplified plausible behaviors that they can potentially have at the current moment, while they are not observed. This Potentiality-AI generates a “potentiality tree” quite similar to traditional AI goal trees.  The main difference is that all the “plausible” behavior’s branches stay active at the same time.  In our example, that means that our murderer NPC potentially does many things at the same time to vindicate oneself when he is not observed by the player.  For instance: hide, corrupt or frighten witnesses, steal evidences on the crime scene, etc…  All that, "happening" in parallel (thanks to Quantum states superposition).

  2. The DramaManager AI changes the probabilities of some potential NPC’s behaviors in accordance to the player context and to predefined dramatic rules.  In our example, the DramaManager strongly increase the probability of the murderer potential behavior that consist of stealing evidences on the crime scene when the player arrives there.

  3. When the player interact with the story world, the entity he interact with “collapse” (in the Quantum Physics way of thinking).  In our example, when the player arrive on the crime scene, the system looks at all NPC potential behaviors that involve the crime scene and “collapse” them as being the current NPC behavior or not.  The criterions to collapse a behavior depend of a statistical selection process (random driven) integrating the probability weights set by the DramaManager AI.

  4.  If a behavior collapsed as being the current one for an NPC, the NPC Potentiality-AI is temporarily mutated into a classical Reactive-AI.  This allows the NPC to interact in a regular way with the player that now observes him.  During the AI mutation, the collapsed potentiality branch is expanded as the current goal branch of the standard Reactive-AI. 

    On a side note, the mutation of potential past behaviors into a real present behavior inspired the title of this post:  ”Does the past exist yet?”.  Indeed, the described mechanism maintains all the plausible NPC simplified pasts and “chooses” one at observation time to expand it, thus defining the NPC in present time.  If we integrate the fact that the DramManager AI biased the weights of the past behavior possibilities to insure the present behavior it preferred, then this can be seen as an approximation of retro-causality.

  5. Finally, each NPC that are in Reactive-AI mode will be mutated back in Potentiality-AI mode after a given time of non-observation by the player.   So, the system must be capable to do bidirectional translations between simplified Potentiality-AI and expanded Reactive-AI.


I think that the superposition of unseen NPC behaviors creates a kind of “behavioral and causality backstage”. This allows us to implement a DramaManager that is “free” to bias NPC behaviors in the back of the player.  This allows us to mix and statistically arbitrate Player Centricity with Agent Centricity.

This seems to be an interesting paradigm to test. However, things can rapidly grow in complexity, especially when the potential behaviors involve NPC to NPC interactions and relationships.  But the good news is that now, we have a lead to reconcile player autonomy and experience intensity…

Aucun commentaire:

Enregistrer un commentaire