Automating the Design of Virtual Worlds Using Rational Agents
Download
Report
Transcript Automating the Design of Virtual Worlds Using Rational Agents
DESC9180
Designing Virtual Worlds
Week 9
Interactivity II – Agent Models for Dynamic Virtual
Worlds
6pm – 9pm
Tuesday, September 18th, 2007
Kathryn Merrick and Owen Macindoe
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Lecture Overview
What is an agent?
The role of agents in virtual worlds
Designing agents for dynamic virtual
worlds
Demonstrations and examples
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
What is an Agent?
A software process that:
Monitors its environment using sensors
Reasons about sensor data using some
characteristic
reasoning process
Acts in its
environment
using effectors
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Other Properties of an Agent (I)
Reflexive: Pre-programmed responses
to the state of the virtual environment
Reactive: Reasoning within a fixed set
of goals
Reflective: Hypothesises about
possible goals
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Other Properties of an Agent (I)
DESC9180 Designing Virtual Worlds
Behavioural complexity
Autonomous:
Includes reasoning
processes to
create new goals
Proactive:
Anticipate the
needs or intentions
of others
reactive,
reflective
agents
scripted
behaviours
autonomous,
proactive
agents
reflexive
agents
Implementation complexity
University of Sydney, September 2007
The Role of Agents in Virtual
Worlds (I)
Agents provide a structured approach
to implementing dynamic virtual worlds
Believable characters
Incredible objects
A single agent program may be
applicable in many scenarios
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
The Role of Agents in Virtual
Worlds (II)
Enemies or opposition
Partners
Support characters
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Designing Agents for Dynamic
Virtual Worlds
sensors
Current state of
the virtual world
or some part of it
state
reasoning
AGENT
action
effectors
A change to the
virtual world
DESC9180 Designing Virtual Worlds
Agents
generally
monitor and
act in only a
small part of
the world
There may
be multiple
agents
University of Sydney, September 2007
A LSL Approach to Agents
default
{
state_entry()
{
state sensation;
}
}
state sensation
{
state_entry()
{
// Gather information
// about the world…
state reasoning;
}
}
DESC9180 Designing Virtual Worlds
Sensation
Reasoning
Activation
state reasoning
{
state_entry()
{
// Process information
// about the world…
state reasoning;
}
}
state activation
{
state_entry()
{
// Perform an action…
state sensation;
}
}
University of Sydney, September 2007
Monitoring the Virtual World
Agents generally monitor only a small part of
the world:
Monitor properties that are necessary for deciding
how to act
What to monitor?
Self
Other objects or scripts
Avatars or chat
Virtual land
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Self-Monitoring Objects
llGet… functions are useful for this:
Shape and location properties
Physics properties
Meta-data
Ownership and permissions
Script properties
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Monitoring Other Objects and
Avatars
Monitoring other objects:
llSensor (see last week’s lecture)
llDetected… functions
Monitoring avatars
llSensor for generic properties
llListen for chat
touch_start for avatar touches
collision for collisions
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Monitoring the Virtual Land
llGet... And llGround… functions for:
Time and sun position
Parcel and region flags
Camera position
Properties of the ground
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Reasoning: Artificial Intelligence
for Virtual Worlds
Artificial Intelligence (AI) techniques
used in virtual worlds lag behind the
current state of the art in AI research:
AI techniques are complex
Behaviour may be unpredictable
But some techniques have been used
with great success…
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Rule-Based Systems
Define a set of rules about states of
the virtual world
Rules have the form:
If <condition> then <action>
Simple to implement for a single agent
A lot of work when there are multiple
agents requiring different rules
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Flocking
A special example of
rule-based reasoning
Used to control groups
crowds or animals
Three rules governing:
Separation
Alignment
Cohesion
DESC9180 Designing Virtual Worlds
Craig Reynold’s
flocking rules for boids
University of Sydney, September 2007
State Machines
Divide the reasoning process into
internal states
Each state defines rules about:
How to act while in that state
When to transition to a different internal
state
One of the most popular control
strategies for dynamic virtual worlds
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
AI Implant
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Fuzzy Logic
A way for agents draw a conclusion
based on facts that may be vague,
ambiguous, inaccurate, incomplete
Classical rules
DESC9180 Designing Virtual Worlds
Fuzzy logic
University of Sydney, September 2007
Fuzzy Rules
Fuzzy logic can be used to create a
rule-base with rules of the form:
If <X is A> then <Y is B>
Eg: if number of avatars is large then
overcrowding is likely
Can be used in rule based approaches
and state machines
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Supervised Learning
Agents gradually modify their internal
structure in response to examples
Examples of desirable behaviour
provided by human controlled avatars
Learning agents can adapt
Learning can be slow or inaccurate
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
How a Supervised Learner Works
Many variants of supervised learning exist
Agent monitors:
Agent stores:
State of virtual world
Actions performed by avatars
State-action pair
Weight indicating confidence
State 1
Action1
0.3
State 2
Action 5
0.9
State 3
Unknown
State 4
Action 3
Agent acts autonomously when a
recognised state is encountered
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
0.8
Reinforcement Learning
Learning by trial and error
Agents modify their internal structure in
response to reward or punishment
from:
Human controlled avatars
Internal function
Learning agents can develop better
policies than programmed agents
Learning can take a long time
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
How a Reinforcement Learner
Works
Many variants exist
Action is initially random trial and error
Agent monitors:
State 1
Action1
0.9
Agent stores:
State of virtual world
Reward or punishment
State 2
Action 2
0.5
Action 1
0.3
Action 2
0.8
State-action pair
Cumulative reward or punishment
Agent acts by choosing action with
highest reward (or lowest punishment)
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Evolutionary Algorithms
A society of characters evolve
individuals with advantageous
characteristics
Karl Sims’ evolved
virtual creatures
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Acting in the Virtual World
Individual agents generally act in or change
only a small part of the world
Multiple agents may control larger regions of
the virtual environment
How to act?
Changes to self
Avatars
Changes to other objects
Environment eg: chat
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Self-Changing Objects
llSet… functions are useful for this:
Shape and location properties
Physics properties
Meta-data
Ownership and permissions
Script properties
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Changing Avatars
You can’t put scripts in avatars…
But you can:
Apply an animation to an avatar
Attach scripted objects to an avatar to
control:
Avatar location
Other avatar attachments
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Changing Other Objects
You can’t directly change an object
from a script inside a different
object…
But you can:
Send messages to an object telling it
how to change itself (remember the
light switch example from last week)
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Tutorial:
Advanced LSL techniques
Download the agent framework LSL script:
http://www.it.usyd.edu.au/~kkas0686/desc9180
readings/Agent%20Framework.txt
Copy a sheep from the
truck in Furness (236, 10, 55)
Write your own agent
scripts to create some
intelligent sheep
(see tutorial sheet)
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007
Next Week (s)
Next week (25/9) is the mid semester break
No lecture or tutorial
The following week (2/10) will be our paper
review session
Please send me your slides in advance so I can
have them installed, ready for class
DESC9180 Designing Virtual Worlds
University of Sydney, September 2007