Tuesday, April 8, 2008

game construction 04-03

mailing list: cmsc23800@

First milestone: design document - get in a group - be thinking about gameplay
read chapter 3.1

Aside: Man, I wish I'd been here for the first class.

AI has to figure out where to go
then, pathfinding
these are high-level issues
"physics" of movement - position, orientation
"graphics" of movement - how is movement displayed

Aside: How could one of two roads be both longer AND straighter?

Low-level AI:
responsible for issuing commands to physics engine
avoid obstacles

State of a character:
position - vector (3) (y is up)
direction - float (angle, but a 2-vector could also be used, or even 3)

Kinematics: movements without forces
velocity - vec3 (y=0)
rotation - float

NB: It's important to make things relative to time rather than, say, frames.

Update (Dt):
pos += Dt * velocity
dir += Dt * rotation

Update` (Dt, linearAccel, angularAccel):
pos += Dt * velocity + .5 * linearAccel * Dt^2
dir += Dt * rotation + .5 * angularAccel * Dt^2
velocity += linearAccel * Dt
rotation += angularAccel * Dt

in practice, if updating happens often enough, we can leave off the second half of the first two

Aside: Dude is totally reading Dinosaur Comics in class.

NB: Want to keep graphics separate from mechanics as much as possible - graphics doesn't need to know the state of the whole world, or even necessarily the whole of the visible world.

Aside: Hm, is the Wii multiprocessor? Answer: Doesn't look like it.

Kinematic Movement: Given a state, change velocity and direction to achieve some goal.
match (state, goal)
seek : attempts to match position
set velocity = maxSpeed * normalize(target.pos - self.pos)
flee : attempt to get as far away as possible from target

Steering Behaviors:
produce accelerations
arrive: like seek, but without overshooting
define two radii
target radius
slowdawn radius
d = distance to target
if d < r(t) then done
elif d < r(s) then slowdown()
else seek()

Aside: "Catmull-Rom Spline" just sounds so ridiculous. Also, I'm starting to get huuungry.

No comments: