CO2301 Games Development 1 Week 23 Revision Lecture AI Revision - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

CO2301 Games Development 1 Week 23 Revision Lecture AI Revision

Description:

Don't need to learn the algorithms off by heart. ... Suits genres such as FPS, but also think about games such as Viva Pinata. 18. 18 ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 28
Provided by: gjbel
Category:

less

Transcript and Presenter's Notes

Title: CO2301 Games Development 1 Week 23 Revision Lecture AI Revision


1
CO2301 - Games Development 1Week 23 - Revision
LectureAI Revision
  • Gareth Bellaby

2
Characteristics of the exam questions
  • Describe the topic, e.g. what is a game agent?,
    What is a FSM?
  • Be prepared to give an example, e.g. give an
    example of a game agent, provide an example of a
    FSM.
  • Provide an example of use. How would it be used?
    Why would it be used?

3
Prepare to draw a diagram
  • Be prepared to draw a diagram for every topic.

Attacking
No hit points
Attacks
Idle
Start
Dying
4
Pathfinding
  • What is pathfinding?
  • 7 algorithms
  • Crash and Turn
  • Breadth-first algorithm
  • Depth-first algorithm
  • Hill-climbing algorithm
  • Best-first algorithm
  • Djikstra's algorithm
  • A algorithm

5
Pathfinding
  • Don't need to learn the algorithms off by heart.
  • However, you must be aware of the fundamental
    characteristics of each of the search techniques.
  • You must be able to explain and discuss the
    algorithms.
  • Each of the search techniques can be compared to
    the others.
  • What are the relative advantages and
    disadvantages of each of the searches?

6
Pathfinding
  • Description The characteristics of the
    algorithm.
  • Is the algorithm guaranteed to find a solution?
  • If the algorithm guaranteed to find the optimal
    solution?
  • Efficiency speed, size of tree.
  • Heuristic blind or directed?
  • Cost does the algorithm employ cost?
  • Application Where would you use the algorithm?
    What are the advantages and disadvantages of the
    algorithm?

7
Pathfinding
  • Simplest algorithm is "Crash and Turn" move
    towards objective, if crash into an obstacle turn
    and move around its perimeter until you can move
    towards the objective again.
  • Simple to implement.
  • Can be effective in simple situations
  • Guaranteed to work so long as all objects are
    convex.
  • Think about using in combination with other
    methods.

8
Breadth-first algorithm
  • Expands all of the nodes, layer by layer.
  • Exhaustive search.
  • Guaranteed to find solution, if one exists.
  • Guaranteed to find the optimal solution.
  • Inefficient because every node searched. The
    problem of combinatorial explosion.
  • Does not employ a heuristic.
  • OK for small problems where size is manageable.
    Useful if you definitely want to search all of
    the nodes.

9
Depth-first algorithm
  • Only one node expanded. Single path followed.
  • Need to include backtracking, otherwise it is
    pretty useless.
  • Not guaranteed to find a solution. (But variants
    such as using a limiting wall and employing
    backtracking are guaranteed to do so).
  • Not guaranteed to find the optimal solution.
  • Overcomes combinatorial explosion because a
    smaller tree is generated.
  • Does not employ a heuristic.
  • May get lucky and, on average, faster than
    breadth-first.
  • Used for problems in which optimality not
    important.
  • Can be used in conjunction with other searches,
    e.g. for opportunistic searches.

10
Hill-climbing algorithm
  • Current node examined to find the best successor.
    Path follows best successor.
  • Better than depth and breadth.
  • Basic algorithm is not guaranteed to find a
    solution.
  • Foothills.
  • Plateaus.
  • Ridges.
  • However, it is guaranteed to find a solution if
    backtracking is used, together with the option to
    move to a worse successor if no other
    alternatives exist.
  • Not guaranteed to find optimal solution.
  • Uses a heuristic.
  • Variants include randomness, jumps.
  • Useful for climbing a hill! (Or equivalent).

11
Best-first algorithm
  • All unexpanded nodes recorded. Best overall node
    chosen.
  • Uses a heuristic.
  • Better than depth, breadth and hill-climbing.
  • Guaranteed to find a solution.
  • Not guaranteed to find the optimal solution, e.g.
    on a map with terrain costs.
  • Useful for maps with no costs or equivalent kinds
    of problems.
  • Can be employed in a game with moving obstacles.

12
Djikstra's algorithm
  • Uses cost.
  • Choose the successor node with the lowest cost.
    Cost is accumulated along each route.
  • Guaranteed to find a solution.
  • Guaranteed to find the optimal solution.
  • Very efficient for maps in which all of the costs
    can be pre-generated.
  • For a game with a large map can be inefficient
    because potentially a large number of
    alternatives may be considered.
  • Inefficient with moving obstacles since cost
    would have to be regenerated.

13
A algorithm
  • Uses cost and heuristic.
  • Choose the successor node with the lowest summed
    cost heuristic. Cost is accumulated along each
    route.
  • Guaranteed to find a solution.
  • Guaranteed to find the optimal solution.
  • An efficient algorithm.
  • A commonly used games algorithm. Compare with
    Djikstra's. If cost can be pre-generated and
    stored efficiently then Djikstra's will be the
    better choice, otherwise use A.

14
A algorithm
  • Admissability, , i.e. the heuristic never
    overestimates the distance.
  • Graceful decay of admissability. Be strict about
    admissability at the beginning of the search but
    as the search is assumed to get closer to the
    destination relax the admissability criterion.

15
Other considerations
  • Level of detail.
  • Representations grids, waypoints, regions,
    points-of-visibility.
  • Path smoothing.
  • Smoothing is implemented through the use of
    interpolation - calculating points in between our
    known points.
  • Looked at a method of generating a curve called
    the Catmull-Rom spline.
  • Generate tangents based on the position of the
    sample points.
  • Re-acquisition of waypoints.
  • Map design.

16
Game Agent
think
sense
act
memory
(optional)
17
Game Agents
  • Autonomous of semi-autonomous.
  • Perceives the world and acts upon the world.
  • Agents are situated in the world.
  • Agents interact with the world.
  • Suits genres such as FPS, but also think about
    games such as Viva Pinata.

18
Game Agents - sensing
  • Perceiving the world in a similar (or analogous)
    way to that of the player.
  • Seeing.
  • An efficient vision algorithm would only
    consider
  • objects that the agent is interested in
  • objects within the viewing distance of the agent
  • objects within the viewing angle of the agent
  • objects within the unobscured LOS of the agent
  • Hearing.
  • Similar considerations to seeing, but need to
    discuss sound propagation, ambient sound, etc.
  • Communication with other agents.

19
Finite State Machine
  • Finite State Machine is a machine which
    represents behaviour as
  • states
  • transitions between states
  • actions. The actions can occur within a state, on
    entry to a state, on exit from a state.
  • Need a start state and an end state.
  • You need to consider FSMs as a diagramatic
    technique.
  • I provided a bunch of examples. Make sure you
    understand them and write similar examples of
    your own.

20
Search Methods
  • Applying search techniques to problem solving.
  • A traditional approach to games such as Chess or
    Draughts.
  • The example I gave was the Towers of Hanoi.
  • Representation of the problem as a set of states.
  • Use lists and a tree structure (same as
    pathfinding). Use rules to generate the new node.

21
Search Methods
  • Combinatorial explosion the problem whereby
    rules in combination give rise to a large number
    of alternatives.
  • Less useful with computer games.
  • Chess is a 2-player game, with certain outcome
    and perfect information. Most computer games are
    n-player, uncertain outcome and imperfect
    information.

22
Production Systems
  • Rule-based system if ... then rules.
  • Can backward or forward chain the rules.
  • Procedural knowledge is operational, i.e. what to
    do when.
  • Allows reasoning. Deduction is the process of
    reasoning from premises to conclusions. Remember
    being able to answer the question "Is Gerald a
    Giraffe".
  • Used in games such as RTS, e.g. Age of Empires,
    Rise of Nations, etc.
  • This is an example of a routine rather than a
    game agent.
  • Semantic nets as a variant. Bird example.
    Remember the connection with OO methods.

23
Game characteristics
24
Dealing with complexity
  • Simplification.
  • Representation. Use a less detailed
    representation.
  • Level-of-detail, e.g. different sized grids for
    pathfinding, rule based system can have different
    levels.
  • Task Management (Tank Example)
  • Sub-divide the problem into tasks.
  • Prioritise tasks.
  • Assign tasks by priority to each of the actors.
  • Hierarchical Decomposition (Command Hierarchy) A
    different representation for each level of
    analysis. The higher levels in the hierarchy can
    feed down to the lower levels. Mimics levels of
    command.

25
Targeting
  • Attempting to hit a moving target. The first case
    is an infinite speed projectile.
  • Infinite speed construct a LookAt function. You
    need to be able to write down how the function is
    constructed. You need to understand
  • length of a vector
  • normalise a vector
  • dot product
  • cross product
  • the relevant axes

26
Targeting
  • The second targeting case is a finite speed
    projectile.
  • Simple leading. Set of simplifications.
  • Deriving the relative movement of the target
    using projection of a vector.
  • Be able to write down the maths.
  • Why is it done human-like behaviour.

27
Topic List
  • There's a list of words and topics I gave at the
    beginning of doing the AI.
  • Week 7 "Topics to be learnt".
  • Look at this material as well.
Write a Comment
User Comments (0)
About PowerShow.com