O'Reilly logo

AI Game Programming Wisdom 4 by Steve Rabin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.3Seeing in 1D: Projecting the World onto a Line

Andrew Slasinski

ExtraStanlo@gmail.com

In game AI, vision can be simulated using line-of-sight testing. Line-of-sight checks are often implemented by ray casts from an agent to a target. This has several disadvantages, however. Depending on the number of potential objects a ray can hit, the tests can be very expensive. The obvious solution is to reduce the number of ray casts, or even restrict yourself to a single one, but this technique can result in false negatives. If only a few ray casts are made from one object to another, all of them might fail to reach the target even though it is clearly visible, as shown in Figure 5.3.1.

FIGURE 5.3.1 A failed line-of-sight check to an object that should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required