Lecture 7&8 Flashcards
What are steering behaviours?
Make AIs move semi naturally around an environment. No pathing or anything, just reacting to local information
What is the seek steering behaviour?
Steers character towards a specified position
Aligns the velocity of the character with the direction to the target
What is the flee steering behaviour?
Same as seek, but away from target
What is the arrival steering behaviour?
Same as seek, but decelerating as it reaches the target
What is the wander steering behaviour?
Random steering
Two imaginary circles in front of agent
Big circle is wandering strength
Little circle is wandering rate
Changes destination to random point on big circle within little circle every N frames
What is the pursuit steering behaviour?
Same as seek but with a moving target.
Try to predict where target will be
What is the evade steering behaviour?
Same as flee, but with moving target.
Try to maximise distance from predicted target position
What needs to be constructed to do path finding?
Graph of nodes (points) that represent the environment
What are the dis/advantages of hexagonal grids over rectangular grids?
Hexagonal - more natural movement, but harder to implement
HOw does dijkstra’s algorithm work?
Keep track of distance travelled so far
Expand the next node that will increase the cost by the least
How does A* work?
Dijkstra + heuristic for cost to reach end
What is an admissible heuristic?
One that never overestimates the cost
What is the difference between Manhattan, Euclidean and Chebyshev distance?
Manhattan - counts diagonals as 2
Euclidean - absolute distance
Chebyshev - counts diagonals as 1
In 4 way connectivity, manhattan distance is
A) Admissible
b) not admissible
what about 8 way?
4 way admissible
8 way not admissible
The lower h(n), the
more
less
nodes A* will expand
More
What is a navmesh?
models traversable areas of a map using triangles usually
Pros/cons of navmeshes
pros: Shorter more natural paths, can ignore static and dynamic obstacles, requires less nodes, pathing isnot zigzag
cons: Not as efficient as grid/wp, procedural generation doesnt work too well, time consuming to make manually
What are areas in unity navmeshes?
SOme places like snow or mud can be assigned a higher cost of traversal
What must be added to an object to do pathfinding in unity?
Navmesh agent
how can an obstacle be added in unity
Add a NavMesh Obstacle component to an object
What methods does PlayerPrefs have?
float GetFloat(string key, float devVal=0.0f) / SetFloat(string key, float val)
int GetInt(string key, int defVal = 0) / SetInt(string key, int val)
string GetString(string key, string defVal = “”) / SetString(string key, string val)
bool HasKey(string key), void DeleteKey(string key), void DeleteAll()
void Save()
How to make a gameobject not be destroyed when loading a new scene?
public static void DontDestroyONLoad(Object target)
What is the difference between flexible and hard-coded FSMs?
Flexible - classes and interfaces as components
Hard-coded - all logic part of the code itself
What is an avatar?
Asset created by unity when a 3d humanoid is imported. binds model to the animator