AUTHOR: Targa
Here I will attempt to detail for you the basics of AI's vision parameters in Thief 2. It is worthy to note that in the
vast majority of cases, the default vision parameters are just fine. Over-customization of AI's vision will most likely
negatively impact gameplay, not to mention causing you, the builder, lots of headaches and much time spent on testing.
That being said, there are times when it is desirable and beneficial to adjust the default vision. A simple example of
this would be if you built a "lookout tower" for a bow guard, but he's so high off the ground that he doesn't notice
anyone passing by below. Modifying the basic vision parameters we can expand his FOV (Field of View) to encompass the
street below. It's important to note that the player will have no idea (at least at first) that a particular AI has
something different about its vision. Thus, for example, if you wanted to give the illusion that a guard is half-asleep
and not really paying attention (by reducing his vision), the player will have no idea that the guard has reduced vision,
and will be more likely to seek another way past him than to "test" his ability to see the player. Caveats aside, I'll
delve into the heart of the matter...
First, we need to know how to override the default vision parameters in Thief 2. Create an AI in Dromed. With the AI
selected, click on the "properties" box at the bottom of Dromed. Click the ADD button on the box that pops up. Then select
AI > AI Core > Vision Description. A tall vertical box will appear, with many settings in it. If the box is taller than
your screen and you can't see the OK button at the bottom, you can press the Esc key to exit. If this is the case, you
will have to resize your desktop. If you're using Dromed's 1024x768 mode, your desktop needs to be at least 1280x1024 to
properly see the menu. If you had to escape and resize, then you'll need to go back and select Add> AI > Ai Core > Vision
Description again. From now on, when you select "Properties" of that particular AI, you will find "Vision Description" in
the AI > AI Core tree. It loads initially with all the default Thief 2 values for a standard guard. So now you're looking
at this Vision Description box, wondering what it all means...
The first thing you see at the top is "Z offset" with a current value of 3.00. This tells the game that the AI's vision
originates from it's head area. So unless your AI has eyes in it's stomach or something, you should leave this value alone.
Understanding Vision Cones
Before you do anything, you need to understand the way the AI sees things in the game. I have illustrated the basics in
the following picture:
My web site doesn't allow "hot-linking" to pictures, so click HERE (http://www.targa.150m.com/vcones.jpg) to pop up a
new window with the picture.
The top-left image shows you that the "cone" is actually pyramid-shaped. The "Cone x: Angle" in our Dromed menu is
referring to the horizontal angle (width). The "Cone x: Z angle" is referring to the vertical angle (height). Remember: An
AI's vision is centered on coordinates 0,0 for him/her (ie: For both Angle and Z Angle, the center line is straight out in
front of the AI. Thus, an Angle of 90 degrees would give the AI vision 45 degrees to the right, and 45 degrees to the left
of center). It is also imperative to note that the apex of the pyramid cone is very small. Why is it imperative, you ask?
Simple: Look at the picture above (the top-left portion) and you can see that the closer you get to the AI's eyeball, the
smaller its FOV is. Thus, if you make an AI's Angle too small, it won't be able to see players when they are close by and
off-center of the AI's line-of-sight. In Dromed, look at the default values of Cone 1 and Cone 3. You can see that they
have both Angle and Z Angle values of 170 degrees, though the Range is only 5 feet. Within 5 feet, the AI can see anything
85 degrees above and 85 degrees below their line-of-sight. Eliminating a potential blind spot created by narrow pyramid
apexes. You'll notice that an AI defaults to having 9 active Vision Cones. The cones vary in size, range, and acuity,
giving the AI a reasonable facsimile of "real" vision.
Definitions:
Angle: Horizontal width, in degrees, of the Vision Cone.
Z Angle: Vertical height, in degrees, of the Vision Cone.
Range: Distance, in feet, that the Vision Cone extends from the AI.
Acuity: Defines how well the AI sees things within the specified Vision Cone (ie: clearly or vaguely).
Flags:
-Active: Toggles the Cone on/off.
-No Alert x: (Explained in detail below)
-Peripheral: Specifies whether the Vision Cone is Primary or Peripheral (modifies AI React).
-Omni: Specifies whether the AI will React to "player in Cone" even if player is not in front of the AI.
-Night Vision: Specifies whether or not this Cone is fully functional at night. (AI can "see in the dark")
-Behind: Specifies whether to place the Vision Cone on the back of the AI's head, literally giving them "eyes in the back
of their head". You can see why this isn't used in the defaults. AI's will actually speak to you while facing the opposite
direction!
Adjusting Cone Angles
Rule number 1: Keep it realistic! To change the cone angle and/or z angle, simply type in a number, in degrees, for the
horizontal or vertical (Z) size of the cone (0-360). It's important to note here that once an AI sees Garrett and goes
into either "search" or "attack" modes, the AI changes its line-of-sight, which will now be centered on the player rather
than where it was looking when idle. For example: You place a guard in a slightly elevated position such as a platform,
and narrow his Vision Cones' Z Angle so a player can sneak by in front/below the guard. The stealthy player can sneak by
without a problem. However, if the player is seen before he gets close, and the guard goes into "alert mode", he will
change his line-of-sight, keeping his eye on the player. Thus, any attempt to sneak by in front/below the guard at this
point would be futile, since he essentially can "bend his neck" when alerted.
Modifying Range
To change the Range, simply type in the distance, in feet, that you want this Cone to extend. When considering modifying
the values for Range, it's important to note that Range is dynamic. Again, things change when an AI goes into Alert Mode.
For example: Keeping this simple - assuming the AI only has one Primary Vision Cone that extends to 40 feet - The AI will
not be able to see the player outside the 40 foot range, even if the player is in broad daylight, however, once the player
is seen and the AI goes into Alert Mode, locking its vision on the player, it may be able to follow the player's movements
out to 45 or 50 feet. Dynamics are one way Thief 2 attempts to make the game more realistic. It would be unrealistic to be
seen, then step 41 feet away from the AI and suddenly be invisible to the AI.
Modifying Acuity
Webster's Dictionary gives us two definitions; one for Visual Acuity: "the relative ability of the visual organ to resolve
detail that is usually expressed as the reciprocal of the minimum angular separation in minutes of two lines just
resolvable as separate and that forms in the average human eye an angle of one minute." Did you understand that? :o) And
plain old Acuity: "keenness of perception." Acuity in Thief 2 is a combination of these two definitions which may be
stated as: The relative ability to resolve detail in shadows and a keenness of visual perception. When modifying an AI's
Acuity, you'll find that you'll need to make the AI practically blind to get them not to see very well in lighted
conditions, but can make significant adjustments to what they can perceive in shadowy conditions. That's because Thief 2
AI weren't designed to have poor eyesight under normal (brightly lit) conditions. Take a look at the default values in
Dromed. You'll notice (quite logically) that the Vision Cones with the longest Range have the lowest Acuity. Simply put:
It's easier to make out details of something close by in comparison to something far away. You'll also notice that the
very short "close range" Vision Cones have an extraordinarily high Acuity setting of 1500. These Vision Cones only extend
5 feet from the AI, and the high Acuity allows the AI to see and battle Garrett in hand-to-hand combat even in pitch black
conditions. You'll notice the drastic difference in Acuity settings from these Cones to the longer-distance cones. Acuity
will also help an AI re-acquire visual contact with a player who has gone out of the AI's field of vision and re-entered
it while the AI is still in Alert Mode or Search Mode. In general, if you have poor lighting, you can adjust the Acuity to
below 100 to cause the AI to react with "Hello? Is someone there?" rather than Alerting, and adjust it to somewhere below
150 to cause an AI to lose sight of Garrett in partial darkness. There are just too many variables in lighting conditions,
AI placement, level design, etc. to give exact values, so if you want to tweak Acuity, you'll have to do your own testing.
Note: If Acuity is set too high on Vision Cones that cover great distances (more than 20 feet or so), the AI will never
return to idle mode from search mode, as long as the player is nearby (even if completely hidden).
Toggling Flags
Active: Self-explanatory.
No Alert x: It's easier to think of these in terms of "alert" rather than "no alert", IMO. These are a bit
counter-intuitive, so don't jump to conclusions just yet. Alert 0 toggles whether the AI goes into Alert Mode upon seeing
a player or other hostile. If you have No Alert 0 checked, the AI will ignore you completely if it sees you, regardless of
other settings. You must have No Alert 0 unchecked in at least one Cone for the AI to React to a player. Why then, you ask,
does the default Cone 1 have No Alert 0 checked? To understand this, simply look at the default Cone 3. It has the
identical Angles, Range, and Acuity, and No Alert 0 is unchecked there. The only difference between the two (other than
Alerts) is the Night Vision flag. Cone 2 will also send the AI into Alert Mode, though the Cone Angles are a bit
different. In short, the default settings have "overlapping cones" that work together to form the AI's visual perception.
Take a look at the default settings for Cone 5. It's only 1 foot larger than Cones 1, 2, and 3, but the horizontal Angle
is 320 degrees. This would effectively give the AI "eyes in the back of its head", if not for the fact that the No Alert 0
and Omni flags are checked. Thus, intruding on this Cone from behind the AI would NOT allow the AI to Alert, but would
allow the AI to Alert on the player if the AI was already in a higher alert mode.
Simple example: Cone 1, Range 50, No Alert 0 and No Alert 1 checked. Cone 2, Range 20, No alert 2 and No alert 3 checked.
Approaching This AI in broad daylight within the Range of 50 feet will not allow a Level 0 alert. Once you enter Cone 2's
20 foot range, the AI will enter Alert Modes 0 and 1. Run away...the AI will now go into Alert 2 and 3, and as long as
you're within the 50 foot Cone 1, (now extended even further by the AI "locking on" to you), the AI will continue to hunt
you down. Hide in a shadowy area and eventually the AI will "reset" its state. Its important to note here that when an AI
"gives up" and returns to its post, it is still in alert mode even though it appears to be idling. It takes a couple of
minutes for the alert state to return to normal.
Alert modes should be viewed as 4 pieces to a puzzle, or 4 consecutive scripts. At some point, they all need to be active
in order to get predictable results from your AI encounters. They have a few vagaries, and I suggest playing with them on
your own. For instance: If an AI only has the capability of Alert 0, it will only alert and attack/chase you once. After
giving up, you can walk right in front of it and it will ignore you. If an AI has Alert 0 and 1, or 0, 1, and 2, it can
spot you multiple times, but if you hide and cause it to go from Alert into Search Mode, you can again walk right in front
of it without causing another Alert. Alert Mode 3 is what I call "search-and-destroy" mode or "hand-to-hand combat" mode.
With this unchecked, an AI will re-acquire the player easily from Search Mode, entering back into Alert Mode, and
re-attacking. The best I can say for Alert/No Alert flags is to make sure you have a balanced and functional set or Cones
and Flags.
Peripheral and Omni: The Peripheral and Omni Flags will both modify an AI's reaction to a player who is visible within the
so-flagged cone. An "Active" cone without either of these Flags is assumed by the game engine to be a "Primary"
Vision Cone, and the AI will react accordingly. If tagged with Peripheral or Omni, the game engine inhibits the AI's alert
status to a certain degree. In essence, creating "gray areas" which trigger low-level alerts such as "I thought I saw
something". Omni and Peripheral Cones should always have at least No Alert 0 checked. Otherwise the AI can go into full
Alert Mode when these cones are violated.
Night Vision: This is just what it sounds like. The function of this Flag can be explained by the following question:
"Can the AI utilize the full capabilities of this Cone in the dark?". You'll notice that the default settings only have
Night Vision on the first two Cones, both which only have a range of 5 feet. This is because the Night Vision Flag gives
the AI the capability to see as if it was broad daylight within the defined Cone. Enabling this Flag for longer-distance
cones would not only be unrealistic, it would effectively prevent the player from being able to take refuge in the shadows.
The Night Vision Flags on the 5 foot cones are there to allow the AI to engage in hand-to-hand combat in the dark.
Otherwise players could always elude pursuit as long as a shadow is handy. It would be unrealistic to have a guard chase
you into a dark corner, then have him say "Hey, where'd he go?" when there is no ther place the player could possibly be
but right in front of the guard.
Behind: This Flag literally tells the game that the Vision Cone is behind the AI. You can see that this isn't used in the
defaults, and I'm sure you can understand why. An AI with this Flag on a Cone would literally engage in conversation
and/or Alert while facing the opposite direction as the player! "Eyes in the back of your head" is the best way to
describe this Flag. I have no idea why this was even created.
Final Comments
As I mentioned at the beginning of this document, the default vision parameters are just fine in the vast majority of
cases. If you're going to tweak an AI's vision, you will of necessity be forced to do alot of play-testing to get it
"just right". My recommendation is to only modify an AI's vision under specific necessary circumstances (such as mentioned
earlier regarding a "tower bowman" watching the street below).
Have fun!
Targa
This tutorial may also be found on my home page ( http://www.targa.150m.com/index.html ) with some other Thief 2 junk. ;o)