Title: Ray Tracing Vision for Video Game Characters
1Ray Tracing Vision for Video Game Characters
- Alex JerezThesis Defense2004
2Overview
- Introduction
- Key Elements
- Ray Tracing vs Checking Distance
- A. I.
- Research Results
- Conclusions and Future Work
3Introduction
- Although video games have become more and more
lifelike there are parts of the video game that
are still hard to simulate. Character vision is
an example of one of these simulations. - A player sees the world from either a third
person or first person perspective, but this
simulates little about how our vision works.
4- Characters tend to have a set of rules to follow,
called a knowledge base, that allows them to
perform certain operations but they are generally
not able to learn from their environment and the
objects surrounding them. - This thesis then focuses on the later idea and
tries to answer the following questions
5- What happens when a character has no knowledge of
the environment in which it is placed but that it
is given a set of basic rules by which it can
learn to interact with objects and other
characters? - What if characters and elements are independent
from each other until the moment that they become
aware of each other existence? - How well can a character behave when faced with
an environment that is similar to one from where
he has gotten previous experience?
6- The purpose of this thesis is then to create a
character that behaves not based on given
knowledge of all the elements in the world.
Placing the character in a grid with cells then
we want our character to move from point A to
point B while trying not to be caught.
7- The characters behavior is based on what it is
surrounded at certain time during its journey. - The discovery of a new objects using its own
vision
8Key Elements
- Spatial Data structure Quadtree
- Objects and Characters
- Physical Animation and Key Framing
- Ray Tracing
- A.I
9Quadtree
- Easy way to find the location of a point
10Objects
- All objects and characters are meshes so that we
can have more control over the vertices. - There are three different kinds of objects
Spheres, Boxes, and Cylinders. - There is a main character and enemy characters
trying to prevent the main character from
reaching his goal.
11Animation
- Objects are animated using physics for rigid
bodies.
12Animation
- Characters are animated by borrowing the key
framing technique from 2D animation.
Frame 0
Frame 5 Frame 10
time
13Collisions
a)
Distance
b)
a) Case in which the distance between two objects
is greater than the sum of both radius. In this
case there is no collision. b) Collision occurs
in this case since the distance is not greater
than the sum of the radiuses. The direction
vectors are calculated and the objects will
bounce each in their own direction.
14Ray Tracing Camera Model
- Models the way in which light rays react with
surfaces to produce color. - We are not interested on finding the color of
surfaces, we are interested in finding which
objects can be seen by the character. - Ray tracing is computationally expensive, for
this project we are using just a small number of
samples to have an idea of what the character is
looking at.
15Checking the distance to all the objects
16Checking the field of vision of the character
17Camera model
18- Low number of samples
- Medium number of samples
- High number of samples
19- With this camera model we can recognize which
objects are in the field of vision of the
character.
Look at Map
20How can we use this information?
- The character can scan cells and decide which
ones are safe to move to. - If the character finds objects on his path he can
decide whether to push them out of the way or use
them to stall other characters. - The character can recognize whether he is in a
safe place where no characters are around him or
if he is in danger he will move to close to them.
21A.I.
- All the information required for a character to
react is stored in what is called the Knowledge
Base. This database contains all the required
data structures to allow the character to make
decisions. - The simplest way to move from point A to point B
is a straight line, but this idea assumes that
there is nothing in the path of the character.
22Searching Techniques
- Characters use 3 different types of searching
techniques - Bread First Search (BFS)
- Hill Climbing (HC)
- A Star Search (A)
23BFS
- When a BFS is assigned to the character, he will
search the cells using an expanding circle
method.
24- Search tree created using BFS
25HC
- Instead of searching the cells level by level, we
are going to search for those cells which have a
better chance of letting our character reach its
goal. We use a state function to decide. - The state function is constructed using
- distance from the current cell to the goal cell
- a penalty if there are any enemies in the cell.
26(No Transcript)
27 28A Search
- So far the character does not keep track of how
much he has had to walk or what probability
certain cell has to contain enemies. - We can exploit this information and store it into
the characters knowledge base so that it can be
used again when the character is placed again in
a similar scenario.
29- When the character sweeps the cells around the
one where he is standing at, he will use the same
function as the HC function to calculate the
state value of the cell, but in addition the
character will also add the distance traveled so
far, and a probability of the cell containing
enemies. - The first time the character is placed within a
scenario he stores the additional information.
When he is placed in a similar environment the
character can use this information to make better
decisions.
30a)
b)
c)
a) Original HC algorithm solution b) Distance
walked so far each time the characters moves
from cell to cell. c) Probability of finding
enemies in the cell. For each character found in
a cell the probability goes .25 higher
31- What happens the next time the character is faced
with a similar scenario?
32Decision Trees
- A decision tree is defined as a structure that
takes as input an object or situation described
by a set of properties, and outputs a yes/no
decision. Decision trees therefore represent
Boolean functions or functions with a large range
of outputs
33Decision Tree for an Enemy Character
34Decision Tree for the main Character
35 36Conclusions
- What happens when a character has no knowledge of
the environment in which it is placed but that it
is given a set of basic rules by which it can
learn to interact with objects and other
characters? - Implementation generates on characters the
element of surprise - The vision seemed to generate a very accurate
approximation of the many objects in the
characters field of vision. - The character reaction with objects is also
fluent and the characters set of rules to deal
with them seem to be everything needed for the
character to solve the spatial problems. - The only problem with using ray tracing is that
the rays shot from the eye might miss some
objects in the world depending on the samples
that we are taking.
37- What if characters and elements are independent
from each other until the moment that they become
aware of each other existence? - Computationally objects are not independent of
each other. - Instead, we achieve this independency by letting
the characters use a discovery method based on
placing the character at some point and then make
decisions depending on what it sees around him. - This system seems to allow character to choose
helpful cells preventing him from moving to what
looks as a crowded cell - Enemies using a BFS decision trees were best fit
to guard cells.
38- The Hill Climbing and A algorithms did not work
too well with the enemies but worked great with
the main character. - The best combination for which the system seem to
have the better balance is to assign a BFS to the
enemies and the A to the main character. The HC
search produced a good behavior but it was a
little bit too static for a system that is always
moving.
39- How well can a character behave when faced with
an environment that is similar to one from where
he has gotten previous experience? - The system showed that the A search was the
search method that will yield more information
that can be used in similar environments. - The BFS has no useful information especially
because it is a sequential search. - The HC search has some useful information but it
is still using the number of characters found
using the look() function and this dependency
makes one system different from the other even if
they are started exactly the same. - The A system with the saved probabilities works
better for a similar environment since it is not
dependent only in how many enemies can be seen
but also in the probability of finding enemies on
that cell.
40Future Work
- Extend the ability for the characters to move in
a more complex environment with hills and
valleys. - The character animation can be studied further by
adding more variable values to the character,
such as stamina and noise made while walking. - The optimization of the searching algorithms can
be studied further by finding better evaluation
functions when computing the state value of a
cell. (character speed, distance needed to walk
and the history of characters seen so far)
41Acknowledgments
- Dr. James C. Miller
- Dr. Christos Nikolopoulos
- Dr. Jian Liu
42Bibliography
- 1 Herman, Leonard, Jer Horwitz, Steven Kent
and Skyler Miller. The - History of Video Games. Gamespot. 2002. www.gamespot.com
- 2 Wedge vs. Needle. Emulators Unlimited. 2001.
-
- 3 A History of Video Games. Geek Comix. 2002.
-
- 4 Bells, Mary. Computer and Video Game History
About.com 2000 - a090198.htm
- 5 Pokorny, Cornel K., and Curtis F. Gerald.
Computer Graphics The - Principles Behind the Art and Science. Franklin,
Beedle Associates. 1989. - 6 Ferraris, Jonathan. Quadtrees. Game
Developers. 2004 - /features/quadtrees
43- 7 Hunter, William. The History of Video Games
From Pong to - Pac-man. Design Boom. 2000.
- ng.html
- 8 Hill, F.S. Jr. Computer Graphics Using
Opengl. Second Edition - Prantice Hill 2001.
- 9 Witkin, Andrew and David Baraff. Physically
Based Modeling. - Online Siggraph 2001. Course Notes
- pbm2001/
- 10 Moment of Inertia. Wolfram Research. 2004.
-
- 11 Dopertchouk, Oleg. Simple Bounding-Sphere
Collision Detection. - Game Developers. 2001.
- s/article1234.asp
- 12 Kelly, Doug. Character Animation in Depth.
The Coriolis Group Inc. - 1998. (p.p. 616)
- 13 Watt, Alan. 3D Computer Graphics. Third
Edition. - Addison-Wesley Publishing Company. 2000.
44- 14 Nikolopoulos, Chris. Expert Systems
Introduction to First and - Second Generation and Hybrid Knowledge Based
Systems. Marcel Dekker Inc. 1997 - 15 Ellis Horowits, Sartaj Sahni, Sanguthervar
Rajasekaran. Computer - Algorithms C. Computer Science Press.
1998. - 16 Cormen, Thomas, Charles Leiserson, and
Ronald Rivest. - Introduction to Algorithms. The MIT
Press. 2000. - 17 Luger, George. Artificial Intelligence
Structures and Strategies - for Complex Problem-Solving. Third
Edition. Addison-Wesley. - Publishing Company..1997.
- 18 Russell, Stuart and Peter Norvig. Artificial
Intelligence A Modern - Approach. Prentice Hall. 1995.
- Other Consulted Bibliography.
- Foley, James, Andries van Dam, Steven Feiner,
John Hughes. - Computer Graphics Principles and Practice.
Second Edition. Addison-Westly Publishing
Company. 1997. - Woo, Mason, Jackied Neider, Tom Davis, and Dave
Shreiner. - Opengl Programming. Third Edition. Addison-Westly
Publishing Company. 1997. - Hawkins, Kevin, Dave Astle, and Andre LaMothe.
OpenGL Game Programming. The Premier Press. 2004. - Shirley, P and Peter Shirley. Fundamentals of
Computer Graphics. A.K. Peters Ltd. 2002.