View
214
Download
0
Embed Size (px)
Citation preview
State of the Union
• We’ve covered the two big topics that we’ll be addressing this semester.
• Still lots of things to come, but we’ll be focusing throughout on the link between computer code and animation.
Action Selection – Why?
• Make a list of reasons that animate entities need to choose different actions
Behavioral change over time (over different time scales)
• Action
• Learning
• Development
• Learning
Drama
• Action selection
• Showcasing that action selection – staging, lighting, responses from other actors, etc.
Action Selection – How?
Once we decide what we want it to do, how do we code that?
Finite State Machine: Make a graph
Behavior-Based AI – layered behaviors – Make a tree
Action Selection – An Example
Vec3 myPos = new Vec3();
this.getPosition(myPos);
if (myPos.mag() <20)
{
SoundSystem.play(
"w:/sound/beep.wav");
}
Perceivable things
• Come up with a list of environmental things that might provoke emotional change.
Vectors
• Vec3, in particular• Similar to a point, but more active.• Represents what you have to do to one point
in order to change it into another point.• Vec3.add(a, b, c);• Vec3.sub(a, b, c);• thisVec3.mag();
Navigation
• navSys.goTo(camPos);
• Will walk emotively
• sets “action” when .goTo is called, so be careful not to replace it with some other action later.
Rules on copying code
• Cut and paste reuse is fine with me, as long as you understand what the code is doing.
• Please put comments in your code to show me that you understand.
• Black-box behavior
Some code examples:Get position of camera
• public Vec3 camPos = new Vec3();• camPos.setValue(CameraSystem.getPosition());• System.out.println(“CamPos is “+camPos);
Some code examples:Get position of other character
• Vec3 friendsPos = new Vec3();• research.World.getWorld().getCreature(
"PersonACE_01 number 0").getPosition(friendsPos);
• System.out.println("PersonACE_01 number 0's pos = " + friendsPos);
Some code examples:Get distance from me to other
character• Vec3 distanceBetweenUsVec = new Vec3();
• Vec3.sub(myPos, friendsPos, distanceBetweenUsVec);
• double distanceBetweenUsDouble = distanceBetweenUsVec.mag();
• System.out.println(“Distance between us is “ + distanceBetweenUsDouble);
Assignment 3
• Program character to have an emotional response to its environment. Attach emotional change to some perceivable phenomenon.