38
Learning & User Modeling Presentation By Brigette Swan

Learning & User Modeling Presentation By Brigette Swan

Embed Size (px)

Citation preview

Page 1: Learning & User Modeling Presentation By Brigette Swan

Learning & User Modeling

Presentation By Brigette Swan

Page 2: Learning & User Modeling Presentation By Brigette Swan

What Is Good AI?

Display of realistic behavior when reacting to the player.

Able to challengethe player both tactically and strategically.

Page 3: Learning & User Modeling Presentation By Brigette Swan

But What About…

Adaptation to the quirks and habits of a particular player over time.

At the moment, many games only implement difficulty sliders.

Page 4: Learning & User Modeling Presentation By Brigette Swan

Standards?

This is a coarse level of control at best. It forces the player to estimate his or her own abilities, which can often be incorrect.

What happens if one mode is too easy, but the next is too hard?

Page 5: Learning & User Modeling Presentation By Brigette Swan
Page 6: Learning & User Modeling Presentation By Brigette Swan

Why?

Learning algorithms are computationally expensive, enough to make game programmers run screaming.

Is there a method that is not so daunting, and yet still gives a realistic feel to player-computer interaction?

Enter….

Page 7: Learning & User Modeling Presentation By Brigette Swan

The Player Model

Something like a profile, the player model is a set of demographics on a particular individual’s skills, preferences, weaknesses, and other traits.

The model can be easily updated as the game progresses, whenever the AI interacts with the player.

Page 8: Learning & User Modeling Presentation By Brigette Swan

The Player Model

The game AI can then query the user model, allowing it to select reactions and tactics that would best challenge the player’s personal style.

The profile could be for a single play, or even be updated over multiple sessions.

Page 9: Learning & User Modeling Presentation By Brigette Swan

Model Design

The model is a collection of numerical attributes, representing the traits of the player.

Each attribute is an aspect of player behavior, which can be associated with strategies, maneuvers, or skills.

Page 10: Learning & User Modeling Presentation By Brigette Swan

Model Example

Page 11: Learning & User Modeling Presentation By Brigette Swan

Model Example This particular trait does not take into

account the player’s behavior relative to the game context.

Models can hold detail like this, but the more detailed the information, the longer the profile takes to design, and the more computationally expensive the updates become.

Page 12: Learning & User Modeling Presentation By Brigette Swan

Model Implementation

At the most basic level, the player model is a statistical record of the frequency of some subset of player actions.

Class PlayerModel {public:

enum ETrait {kUsesSmokeGrenades,kAlwaysRuns,kCanDoTrickyJumps

};void Initialize();void UpdateTrait(ETrait trait, float

observe value);float GetTrait(ETrait trait);

private:vector<float> _traitValues;

};

Page 13: Learning & User Modeling Presentation By Brigette Swan

Model Implementation

Each trait is represented by a floating-point value between 0 and 1, where 0 roughly means “the player never does this” and 1 means “the player always does this.”

Each trait is initialized to 0.5 to reflect the lack of knowledge.

Page 14: Learning & User Modeling Presentation By Brigette Swan

Model Implementation The update

method is based on the least mean squares (LMS) training rule, often used in machine learning.

float PlayerModel::UpdateTrait(ETrait trait, float observeValue) {

float currValue = _traitValues[trait];

float delta = observeValue – currValue;

float weightedDelta = kLEARNINGRATE * delta;

traitValues[trait] += weightedDelta;

}

traitValue = α · observedValue + (1- α) · traitValue

Page 15: Learning & User Modeling Presentation By Brigette Swan

UsesSmokeGrenades: FleesFromBattle: UsesTrickyJumps: UsesRangedAttacks: UsesCloseAttacks:

New Game

User Model Set To Default

0.50.50.50.50.5

0.50.50.50.550.45

0.50.50.50.620.38

Ninja Vanish!

0.540.560.50.620.38

Page 16: Learning & User Modeling Presentation By Brigette Swan

UsesSmokeGrenades: FleesFromBattle: UsesTrickyJumps: UsesRangedAttacks: UsesCloseAttacks:

1.00.560.31.00.25

+ =

Page 17: Learning & User Modeling Presentation By Brigette Swan

Model Updates

In order for the user model to be effective, the game must be able to update the profile. This requires two steps.

The game must detect when an update should be made.

The game must then tell the model to update itself.

Page 18: Learning & User Modeling Presentation By Brigette Swan

Model Updates

While the latter is easy, with the function just displayed, the former can prove a more daunting task.

The game must be able to recognize that the player has taken, or failed to take, an action, or sequence of actions, which correspond to a certain trait.

Page 19: Learning & User Modeling Presentation By Brigette Swan

Model Updates

For example, the “CanDoTrickyJumps” trait, might be triggered if the player can navigate across rooftops. Thus, the game must have a mechanism to determine that the player had made, or failed, such a jump.

This detection can be hardcoded into the jump routines.

Page 20: Learning & User Modeling Presentation By Brigette Swan

Model Updates

What about a trait like “DetectsHidingEnemies”?

In a game where enemies hide in shadows and around corners, the game must compute the visibility of every nearby enemy. This also must include the processing of scene geometry.

Page 21: Learning & User Modeling Presentation By Brigette Swan

Model Updates

The game might be able to make use of the AI as it does all these calculations for interaction, or the keep a cache of past computations to help reduce the cost of the algorithm.

A queue for player actions allows background processing as a solution.

Page 22: Learning & User Modeling Presentation By Brigette Swan

Model Updates

Once the game has detected a need for an update, a value is assigned to the action and placed into the profile.

For example, a player that successfully makes the difficult jump, as previously described, would receive an update like this.model.UpdateTrait(PlayerModel::kCanDoTrickyJumps,1.0);

Page 23: Learning & User Modeling Presentation By Brigette Swan

Alternatives?

While hard-coded trait detection routines are straightforward, it leaves the modeling code scattered throughout the source, which would make maintenance a headache and a half.

Also, modifying the structure of the player model in any way requires changing the code, and therefore, rebuilding the game.

Page 24: Learning & User Modeling Presentation By Brigette Swan

FSM Updates

Trait detection routines can also be implemented as a collection of finite state machines. Each concrete trait is associated with a single FSM which contains the entire detection algorithm.

The FSMs monitor the stream of AI and player actions, and update the model whenever necessary.

Page 25: Learning & User Modeling Presentation By Brigette Swan

FSM Updates

Page 26: Learning & User Modeling Presentation By Brigette Swan

FSM Updates

The FSM system is designed to be data-driven, and thus, can be separated from the source code and loaded into the game dynamically.

Removing the player model from the source code removes it from the build process, allowing it to be altered without a time-consuming recompilation.

Page 27: Learning & User Modeling Presentation By Brigette Swan

Hierarchy

User models can also be designed in a hierarchy, using a tree. Each leaf node represents one of the concrete traits that we have been discussing.

These nodes are clustered under particular abstract traits, which allows the AI to generalize when selecting a strategy against a player.

Page 28: Learning & User Modeling Presentation By Brigette Swan
Page 29: Learning & User Modeling Presentation By Brigette Swan

Enemy AI

Player OnePrimary Abstract Trait: MeleeAttacker

Player TwoPrimary Abstract Trait: RangedAttacker

Secondary Abstract Trait: Healer

?

Page 30: Learning & User Modeling Presentation By Brigette Swan

Hierarchy

The hierarchical model is slightly more complex to implement, but it not difficult, resembling a binary tree in execution.

This design also makes it simple to maintain a hashtable to the various leaf traits, speeding up the search for the GetTrait() process.

Page 31: Learning & User Modeling Presentation By Brigette Swan

Using The Model

The player model exists to make the AI less episodic and more aware of past interactions.

From the player’s perspective, it appears as though his enemies have gotten smarter.

Page 32: Learning & User Modeling Presentation By Brigette Swan

Using The Model

The profile can also be used by the AI to exploit weaknesses in a player, to give them more of a challenge.

In a friendly game, such demographics could be used to provide helpful advice to a novice player.

Page 33: Learning & User Modeling Presentation By Brigette Swan

In Games Today…

Rare are the games that implement user models well, when they do at all. At the moment, it is difficult to say when player modeling is being used, and when it is not.

But we have a few guesses.

Page 34: Learning & User Modeling Presentation By Brigette Swan

In Games Today…

Sports: Recording play styles of users is important in sports style games. The NFL 2k series actually experimented with player models, but according to most players, they were implemented rather poorly.

Page 35: Learning & User Modeling Presentation By Brigette Swan

In Games Today…

FPS: Adaptive enemies would be an asset to games like Splinter Cell: Pandora Tomorrow. Developers and designers always seem to have grand plans, but reviews indicate mediocre execution at best.

Page 36: Learning & User Modeling Presentation By Brigette Swan

In Games Today… RTS: While Homeworld does not implement the exact type of player

model described here, it does compensate based on the user’s skills.

Since the player keeps his units from the previous encounter, the enemy force is based on the number and type of units that the player has at the beginning of the next mission.

Page 37: Learning & User Modeling Presentation By Brigette Swan

In Games Today… Fighters: This game style does some minor profiling of its players.

In tournaments, the AI creates a single session model, allowing the opponents to learn and counter the player’s favored movement patterns. The difficulty slider is used to determine the learning rate of the AI.

Page 38: Learning & User Modeling Presentation By Brigette Swan