Feb22010

# Feb22010 - UC Santa Cruz Computer Science Game Design CMPS...

This preview shows pages 1–12. Sign up to view the full content.

Computer Science – Game Design UC Santa Cruz Click to edit Master subtitle style 11/10/10 CMPS 20: Game Design Experience 2D Movement Pathfinding

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Computer Science – Game Design UC Santa Cruz 11/10/10 Path Following at Constant In previous lecture showed path following Used Lerp and CatmullRom interpolation methods built into Vector2 class These methods take an amount A number between 0 and 1 indicating the percentage distance between the start and end points (a “weight”) Problem A given amount can result in different perceived speeds, depending on the length of the line Solution Given a desired speed in terms of units per clock tick Compute per-tick change in amount as follows
Computer Science – Game Design UC Santa Cruz 11/10/10 Pathfinding In many games, computer controlled opponents need to move from one place to another in the game world If the start and end points are known in advance, and never change, Can simply define a fixed path Computed before the game begins Use path following techniques from previous lecture Most platformers do this

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Computer Science – Game Design UC Santa Cruz 11/10/10 Pathfinding Representations Waypoints Navigation Meshes
Computer Science – Game Design UC Santa Cruz 11/10/10 All Pairs Shortest Path Assume a labeled directed graph Nodes are pathnodes in your map Labels are the distances between connecting nodes (or other specific cost information) G=(V, E) in which each arc v w has a non-negative cost C[v,w]. Find, for each ordered pair (v,w) the

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Computer Science – Game Design UC Santa Cruz 11/10/10 All Pairs Shortest Path Floyd’s Algorithm Assume the vertices in V are numbered 1,. ..,n . Use an n X n matrix in which to compute the lengths of the shortest paths.
Computer Science – Game Design UC Santa Cruz 11/10/10 All Pairs Shortest Path Floyd’s Algorithm Set A[i,j] = C[i,j] for all i not equal to j . If there is no arc from i to j , then assume C[i,j] = ∞. Each diagonal element is set to 0.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Computer Science – Game Design UC Santa Cruz 11/10/10 All Pairs Shortest Path Floyd’s Algorithm Make n iterations over the matrix On the kth iteration, A[i,j] will have for its value the smallest length of any path from i to j that doesn’t pass through a vertex numbered higher than k.
Computer Science – Game Design UC Santa Cruz 11/10/10 All Pairs Shortest Path Floyd’s Algorithm On the kth iteration, use the following formula to compute A Ak-1[i,j] A[i,j] = min { Ak-1[i,k] + Ak-1[k,j]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Computer Science – Game Design UC Santa Cruz 11/10/10 All Pairs Shortest Path Floyd’s Algorithm On the kth iteration, use the following formula to compute A Ak-1[i,j] A[i,j] = min { Ak-1[i,k] + Ak-1[k,j] The cost of going from i to j without going through k or any higher node
Computer Science – Game Design UC Santa Cruz 11/10/10 All Pairs Shortest Path Floyd’s Algorithm On the

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/10/2010 for the course CMPS 101 taught by Professor Tantalo,p during the Fall '08 term at UCSC.

### Page1 / 46

Feb22010 - UC Santa Cruz Computer Science Game Design CMPS...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online