International Journal of Computer Games Technology

Volume 2009 (2009), Article ID 670459, 7 pages

http://dx.doi.org/10.1155/2009/670459

## Fractal Analysis of Stealthy Pathfinding Aesthetics

Computer Science Department, Marist College, Poughkeepsie, NY 12601, USA

Received 31 May 2008; Accepted 25 September 2008

Academic Editor: Kok Wai Wong

Copyright © 2009 Ron Coleman. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

This paper uses a fractal model to analyze aesthetic values of a new class of obstacle-prone or “stealthy” pathfinding which seeks to avoid detection, exposure, openness, and so forth in videogames. This study is important since in general the artificial intelligence literature has given relatively little attention to aesthetic outcomes in pathfinding. The data we report, according to the fractal model, suggests that stealthy paths are statistically significantly unique in relative aesthetic value when compared to control paths. We show furthermore that paths generated with different stealth regimes are also statistically significantly unique. These conclusions are supported by statistical analysis of model results on experimental trials involving pathfinding in randomly generated, multiroom virtual worlds.

#### 1. Introduction

Nonplayer character (NPC) agents in videogames depend on pathfinding to navigate virtual worlds autonomously. The literature on artificially intelligent pathfinding has generally focused on machine efficiency and shortest paths. While these concerns cannot be neglected, they may be of secondary or even doubtful benefit if, in videogames, they lead to movement lacking in sensori-emotional or aesthetic qualities that would otherwise appeal to player expectations of plausibility, intelligence, beauty, and so forth. Indeed, pathfinding without aesthetic considerations tends to look unrealistic and mechanical, detracting from a game’s immersive potential and frustrating players [7].

Aesthetics,
however, pose challenges. According to a modernist, Kantian view [10],
aesthetics in general and notions of beauty and matters of taste in particular
are thought to be subjective,
relative, and presumably beyond the pale of automation. Yet, game researchers and developers have
side-stepped these dilemmas, asking not what *is* beauty in pathfinding but rather what is
*knowable* about such beauty which can be captured by heuristics called
“aesthetic optimizations” [17] and “aesthetic corrections” [7].

These efforts have yielded encouraging results and drawn attention to basic issues of incorporating aesthetics in pathfinding. Unfortunately, they have depended almost entirely on anecdotal arguments rather than metrics that facilitate hypothesizing about and testing aesthetic outcomes under more quantifiable, independently verifiable regimes. These investigators have furthermore addressed only beautifying heuristics that navigate by straight lines, smooth turns, and avoiding obstacles without tracking them. Such movement, although appealing in some contexts, is not appropriate for all forms of play and types of games.

In this paper, we use fractal analysis to examine a new pathfinding aesthetic which we call “stealthy.” These paths, obstacle-prone by nature, are reminiscent of and suitable for covert movement in first-person shooter, role playing, and other types of games wherein the goal is to avoid detection, exposure, all-out encounters—concepts we define mathematically later. We use fractal analysis since, among other reasons we discuss later, this approach has been shown to reliably predict and comport with player expectations of aesthetic appeal in pathfinding [4]. What is interesting is that stealthy pathfinding has a statistically significantly unique fractal signature compared to controls which have not been treated with stealth regimes.

We develop a
simple cost heuristic to generate *stealth
effects*, that is, stealthy movement patterns. In a series of experimental
trials involving randomly generated, multiroom virtual worlds, we show that the
fractal model reliably discriminates between stealthy paths versus two types of
control paths with and
,
depending, respectively, on the stealth effect. We show furthermore that paths
with different stealth effects are unique compared to one another with . These
results confirm previous studies of fractals as a reliable metric for measuring
pathfinding aesthetic outcomes.

#### 2. Background and Related Work

The fractal dimension, originally
developed by Mandelbrot in his seminal paper [11] as we describe below, has
been used by others to assess aesthetic values in artistic masterpieces like Jackson
Pollack’s “action paintings” [8, 18] and Bach’s
*Brandenburg Concertos* [20]. Investigators working in these areas
were not specifically interested in pathfinding or even for that matter,
artificial intelligence.

The artificial intelligence literature, however, is generally silent on pathfinding aesthetics. For example, see texts like those of Bourg and Seemann [2], Millington [13], and Russell and Norvig [19] that cover various forms of automated movement but do not discuss aesthetics.

Rabin [17],
Higgins [7], and
Stout [22] have noted the need for aesthetic considerations in
pathfinding and proposed arguments and heuristics to improve aesthetic outcomes
in ways likely to appeal to player expectations of “realism,” “beauty,” and so
forth. For Botea et al. [1], the main interest is machine performance. However,
they acknowledge, if only in passing, that navigation in games is incomplete
without aesthetic concerns. These efforts, in any case, have all focused on
*how* to achieve aesthetic outcomes but not
grading, scoring, or in any way, measuring them.

For precisely this reason, Coleman [3] put forth the beauty intensity, , as a relative, nonlinear measure of aesthetic appeal in pathfinding. Thus, a path object, , is said to have more “working beauty” than a control or reference path object, , provided that . While was shown to give commonsense results in accordance with straight lines, smooth turns, and avoiding obstacles without tracking them, values of are not readily intuitive except in a strictly lattice sense. is furthermore mathematically undefined for some path objects. The implication is that is parametric; it uses explicit, internal assumptions about pathfinding and aesthetics.

Coleman [4] subsequently proposed a fractal model, , which is similar to and mildly correlated with as a relative, nonlinear measure, that is, implies that has more “fractal beauty” than a reference path object, . However, is a more reliable and intuitive estimator according, respectively, to its variance-to-mean ratio and relationship to textured sensory data. Most importantly for the present study, is nonparametric. It makes no assumptions about pathfinding or even aesthetics. Thus, tends to provide more reliable, conservative results.

In this paper, we use to study a new pathfinding regime, the stealth effect, in relation to controls. We examine paths treated with stealth regimes versus “standard” paths, that is, with no beautifying treatments and “aesthetic” paths, that is, with beautifying treatments. While Coleman [4] was completely analytical, the present effort is both analytical and generative.

#### 3. Fractal Dimension

Mandelbrot developed the fractional (or fractal) dimension as a way to analyze irregularly shaped geometric objects which are no-where differentiable (i.e., textured) and self-similar [11, 12, 14]. Mandelbrot observed furthermore that the fractal dimension, , of a surface, , is greater than its topological dimension, [11, 12], that is, . Mandelbrot suggested that fractals offered a better description of objects found in nature (e.g., coastlines).

The fractal
dimension has different interpretations that come under two general mathematical
categories: stochastic and geometric [21]. The stochastic interpretation
assumes Brownian fluctuations [20] and might be employed, for instance, in time
series analysis. In this paper, we use a geometric interpretation based on the
Hausdorff dimension [20]: is a surface, *ε*is a
yardstick or ruler, and is the number of self-similar objects or
subcomponents covered by the ruler. For fractal objects, log will be greater than by a fractional amount.

One way of interpreting the Hausdorff dimension is through the box counting dimension, that is, reticular cell counting. In this case, if the ruler is a uniform grid of square cells, then a smooth surface passes through twice as many cells if the cell length is reduced by a factor of two. A fractal object passes through more than twice as many cells if the cell length is reduced by a factor of two.

For instance, the coastline of Maine, USA , is not straight or smooth but highly textured with inlets, outcrops, and keys. Researchers using the box counting dimension have estimated its fractal dimension to be between 1.11 and 1.37 depending on where and how measurements are taken [23].

Reticular cell counting is intuitive and straightforward computationally. We use it to estimate the fractal dimension by computing the regression slope of versus log . We use a slightly modified version of FracTop [9], which reliably computes the fractal dimension using reticular cell counting, where in pixels are the default rulers. The input to FracTop is a 2D image in Portable Network Graphics (PNG) [16] format which we explain later how to generate given a virtual world.

#### 4. Fractal Model:

The fractal model we describe is from Coleman [4]. We review it here for the sake of completeness.

Let the surface, , consist of , and . is a finite state-space in Euclidean . We assume or . For analysis purposes, however, the perspective is two dimensional. For example, if the game is a first person shooter, the veiw is from above, looking down on walls, rooms, and hallways. Yet, the NPC perceives the world as a set of rigid-body obstacles, , in two or three dimensions. See Figure 1 as an example.

Let for , where and are width and length features, respectively, of , and is a state, namely, . contains the set , namely, .

also contains , a “free flying” rigid-body (i.e., the NPC), which has configurations or steps such that . These steps define a path object, , for from to where and . All other states of are “open” or unoccupied, namely, . For the worlds we generate, “tracks” an obstacle if , where .

Let be shorthand notation for the fractal dimension of for a particular world, , which includes the open states of , and . Let be the “fractal beauty” of a path, , in relation to a reference path, , as

is constrained in that , and are assumed to be the same for both and . Thus, we say has more “fractal beauty” than only if

is said to have less fractal beauty than if . If , then and are said to have the same fractal beauty.

#### 5. Stealthy Pathfinding

does not specify how to find a path. That is the role of pathfinding. In principle, therefore, any suitable pathfinding algorithm suffices. We start with the algorithm [2] as a base. Aside from being generally regarded as the “work horse” of pathfinding for games, is simple, flexible, and straightforward with well-known space and time characteristics [19]. The “standard” , for instance, the one given by Bourg and Seemann [2], does not have an aesthetic objective.

Others have sought to reduce or correct these aesthetic deficiencies through beautifying heuristics [1, 7, 17, 22], that is, if the path score subject to minimization is where is the known cost from the start configuration and is the heuristic estimate to the goal configuration. (For , we use Manhattan metric, namely, (see [9]) for further information.) By adding a penalty or surcharge to for turns or zigzags, tends to generate paths with straight lines and smooth turns. Coleman [3] goes further and also penalizes wall tracking within some radius, , that is, an NPC navigating a game world by following a wall or obstacle may appear to be using the object and not A.I. Thus, it is best to avoid such objects.

Yet in a competitive game world setting, the NPC would not necessarily traverse the middle of a hallway in a straight line or make “pleasant,” predictably smooth turns. Indeed, wall tracking is precisely what an NPC might conceivably do if it is seeking to avoid detection, dodge an opponent, or evade a trap.

Whereas the
standard is wall-neutral and “aesthetic” is wall-adverse, we define a “stealthy” as one which is obstacle-prone, that is,
rather than ignoring obstacles or penalize the NPC for tracking them, the
stealthy rewards such paths according to the following schedule
if ,
where :where *γ*is
called *stealth effect* and is the *discount*.
(Note the discount may in fact behave like a surcharge for some values of *γ*.) Equation
(5) supersedes the heuristic component of the algorithm. The nonheuristic component does not
change.

We state the following lemmas.

Lemma 1. *,
that is, there is no correlation between the stealth effect, γ,
and the heuristic cost, .*

*Proof. *By
inspection of (5), there is no dependency between the discount and .

Lemma 2. * Three
possible values of γgive distinct characteristics per the
relations below:*

*standard or obstacle-neutral search,*

*aesthetic or obstacle-adverse search,*

*stealthy or obstacle-prone search.*

*Proof. *If ,
(5) degenerates to the standard search. If ,
the discount becomes a surcharge for tracking an obstacle. If ,
the heuristic cost is discounted.

Lemma 3. * At the
limit, there is no stealth effect and converges to , that is, *

*Proof. *
See Lemma 2.

#### 6. Experimental Design

Under experimental conditions, may be regarded as “black box,” that is, we input two objects, and , and we get a result, a statistic called subject to constraints we mentioned above. The experiment, thus, does not ask whether internally the regression lines for and are statistically different (they may or may not be), what kind of regression we are using, how we measure the fractal dimension, and so forth. The is deliberately and completely blind to these questions. The only concern for experimental purposes is whether there are systematic deviations from expectation, that is, our null hypothesis, which cannot be explained by chance. We use two controls for this purpose.

Lemma 1 suggests we can generate the stealthy paths without modifying the cost heuristic directly. Indeed, per Lemma 2 we use the standard from Bourg and Seemann [2] as one of our experimental controls, in this case, pathfinding without beautifying treatment. The other experimental control, the aesthetic , is from Coleman [3].

Lemma 3 states
that paths are distinguishable only for sufficiently large, nonzero *γ*. However,
Lemma 3 does not suggest *how* to
choose *γ*.
Thus, we selected for one run and for another run as these seemed to us a reasonable
basis for experimental and illustration purposes. Note that a “run” is a series
of “trials” which we explain below.

These pathfinding algorithms, standard, aesthetic, and stealthy, are embedded, respectively, in multiroom virtual worlds, , generated by the Wells [24] random level generator. The Wells level generator takes as input a “level” which defines the width and height of the world. It also takes as input a seed which randomizes the configuration of the world in terms of rooms and interconnecting hallways as . The Wells level generator also creates and , respectively, in the first and last rooms. We use the three types of pathfinding (i.e., aesthetic, standard, and stealthy) to find a path from to in each world. Finally, for each world we compute where is a stealthy path and a reference or control path, either aesthetic or standard.

To compute , we convert the virtual world to a PNG [16] image. We generate level “10” worlds which are tiles. Each tile is pixels and each and occupies a single tile. are ovals 10 pixels in diameter and are squares 10 pixels in length. This is the input to FracTop which calculates the fractal dimension, , using reticular cell counting. Finally, we then compute according to (2).

Each random multiroom virtual world, , is an independent Bernoulli trial. A trial is successful provided that . The trial is a failure otherwise. If is the number of successes in trials and is the number of failures where , then the null hypothesis is . To conservatively estimate the -value, we use the one-tailed Binomial test, a nonparametric test [6] for trials in two runs, one for and one for .

We also analyze stealthy paths compared to each other, namely, less stealthy versus more stealthy pathfinding. In this case, a trial is successful if and a failure if . Again, we have .

#### 7. an Example

To make these ideas clearer, we go through a randomly selected trial, number 18. Namely, the Wells random seed is 18. Readers can view the results of all 100 trials of 400 images online at the author’s website [5]. Figure 2 shows the multiroom, virtual world and aesthetic pathfinding for this trial from to The symbols represent “bread crumbs” which constitute the path in the time domain.

Figure 3 shows the same random virtual world with stealthy pathfinding.

Figure 4 shows the stealthy path for . Notice that the difference between 10% and 15% is the little “jog” in the upper-left quadrant. We discuss this further in the conclusion section.

In general, one can easily see the difference between stealthy paths and the control paths. The standard path swerves from wall to wall seeming almost to wander. In a sense, the standard path is making random choices since the wall does not affect the cost heuristic. Yet in the stealthy case, the wall is sought out where possible. This movement gives a visual impression of avoiding opening spaces, that is, middle of the room or hallway. In other words, the aesthetic path is less covert compared to the standard one. The stealthy ones, however, appear more covert than both aesthetic and standard paths.

Table 1 gives a quantitative assessment, namely, the fractal dimension, , for each path, , according to the four objectives shown in Figures 2–5.

Table 2 gives as the intersection of rows and columns starting in the control or “” column gives for this trial.

We organized Table 2 for readability; namely, the lower triangle is a positive transpose of the upper triangle (not shown). The zeros along the diagonal represent , where . For instance, the aesthetic path compared to the stealthy path as the reference, .

From a purely quantitative perspective, Table 2 shows the objectives in order of decreasing fractal beauty and one can readily see that the null hypothesis, , is not supported by this single trial. Both stealthy paths’ fractal dimensions are numerically between the aesthetic path and the standard path.

In other words, the numerical relationships are somewhat different from visual impressions. We do not attempt to explain this phenomenon here. We only note that the movement patterns are visually distinct and consistent, and as we observe below, statistically significant from the model’s perspective.

#### 8. Results

The raw data consists of 400 results: 100 standard paths, 100 aesthetic paths, 100 paths for and 100 paths for The full data sets may be found online at the author’s website [5]. Figure 6 gives the histogram distribution of and for the run. The proportions of mean are and , respectively. (The notation “±” is the standard deviation.)

Figure 7 gives the statistical histogram distribution of and for the run. The proportions of mean are and , respectively.

These two charts are generally similar. They both show that stealthy paths tend to have more fractal beauty than standard ones, while aesthetic paths have more fractal beauty than stealthy ones. The distribution is somewhat more dispersed for compared to when the standard path is the control. Yet, this is precisely what Lemma 3 predicts.

Table 3 gives the results in terms of the number of successes () and failures () and the -value based on the one-tailed binomial test.

Thus, we can reject the null hypothesis and accept its logical alternative. Namely, stealthy paths are unique in terms of their aesthetic value.

Table 4 addresses the question of how less stealth () versus more stealth () affects pathfinding. The -value is based on the one-tailed binomial test.

The data in Table 4 suggests that stealth effects versus are unique among themselves. In other words, there is a measurable, statistically significant difference.

#### 9. Conclusions

We have shown that stealthy
pathfinding is a unique aesthetic objective in relation to controls which have
beautifying treatment and no such treatment. There is also a small but
nevertheless statistically significant difference between the two stealth
effects, versus .
In fact, a closer inspection of the data suggests that the “jog” in
Figure 3 is *the* difference. Future research might
seek to better understand this more clearly.

We noted that the quantitative pattern measured by the model is somewhat different from visual inspections of the virtual worlds. This discrepancy is consistent but seemingly counterintuitive. Future work might set up further experiments to explore the matter further.

We chose *γ*on the
basis of trial and error. In fact, after collecting the data for versus ,
we subsequently tried other values, for instance, versus .
We found no differences compared to versus , respectively. We speculate that the range of *γ*effectiveness is constrained by the virtual
world size. Future efforts might study *γ*more systematically in relation to parameters
which generate the virtual world.

#### Acknowledgments

The author thanks Maria Coleman for reading the initial draft and the reviewers for providing valuable commentary and feedback.

#### References

- A. Botea, M. Müller, and J. Schaeffer, “Near optimal hierarchical pathfinding,”
*Journal of Game Development*, vol. 1, no. 1, pp. 7–28, 2004. View at Google Scholar - D. M. Bourg and G. Seemann,
*AI for Game Developers*, O'Reilly, Sebastopol, Calif, USA, 2004. - R. Coleman, “Operationally aesthetic pathfinding,” in
*Proceedings of the International Conference on Artificial Intelligence (ICAI '07)*, vol. 1, pp. 159–163, CSREA Press, Las Vegas, Nev, USA, June 2007. - R. Coleman, “Fractal analysis of pathfinding aesthetics,”
*International Journal of Simulation and Modeling*, vol. 7, no. 2, pp. 71–80, 2008. View at Publisher · View at Google Scholar - R. Coleman, “Fractal analysis of stealthy pathfinding: experimental data,” May 2008, http://foxweb.marist.edu/users/ron.coleman/faspdata/.
- W. J. Conover,
*Practical Nonparametric Statistics*, John Wiley & Sons, New York, NY, USA, 2nd edition, 1980. - D. Higgins, “Pathfinding design architecture,” in
*AI Game Programming Wisdom*, S. Rabin, Ed., pp. 114–121, Charles River Media, Hingham, Mass, USA, 2002. View at Google Scholar - S. Hunter and J. Jacobus,
*Modern Art: Painting, Sculpture, Architecture*, Abrams, New York, NY, USA, 3rd edition, 1992. - H. Jelinek and D. Cornforth, “FracTop v.0.3B,” December 2006, http://seal.tst.adfa.edu.au/~s3165516/Fractop.
- I. Kant,
*The Critique of Judgment*, Oxford University Press, Oxford, UK, 1978, translated by J. C. Meredith. - B. Mandelbrot, “How long is the coast of Britain? Statistical self-similarity and fractional dimension,”
*Science*, vol. 156, no. 3775, pp. 636–638, 1967. View at Publisher · View at Google Scholar · View at PubMed - B. Mandelbrot,
*The Fractal Geometry of Nature*, W. H. Freeman, San Francisco, Calif, USA, 1982. - I. Millington,
*Artificial Intelligence for Games*, Morgan Kaufman, San Mateo, Calif, USA, 2006. - D. Oliver,
*Fractal Vision: Put Fractals to Work for You*, Sams, Carmel, Ind, USA, 1992. - M. Pinter, “Toward more realistic pathfinding,” October 2006, http://www.gamasutra.com.
- Portable Network Graphics, July 2007, http://www.libpng.org/pub/png/.
- S. Rabin, “Aesthetic optimizations,” in
*AI Game Programming Gems*, M. DeLoura, Ed., pp. 264–271, Charles River Media, Hingham, Mass, USA, 2000. View at Google Scholar - D. Rockmore, “The style of numbers behind a number of styles,”
*The Chronicle of Higher Education, Section: The Chronicle Review*, vol. 52, no. 40, p. B10, 2006. View at Google Scholar - S. Russell and P. Norvig,
*Artificial Intelligence: A Modern Approach*, Prentice Hall, Upper Saddle River, NJ, USA, 2003. - M. Schroeder,
*Fractals, Chaos, and Power Laws*, W. H. Freeman, New York, NY, USA, 1992. - P. Soille and J. G. Rivest, “On the validity of fractal dimension measurements in image analysis,”
*Journal of Visual Communication and Image Representation*, vol. 7, no. 3, pp. 217–229, 1996. View at Publisher · View at Google Scholar - B. Stout, “Smart moves: intelligent pathfinding,” September 2006, http://www.gamasutra.com.
- B. R. Tanner, E. Perfect, and J. T. Kelley, “Fractal analysis of Maine's glaciated shoreline tests established coastal classification scheme,”
*Journal of Coastal Research*, vol. 22, no. 5, pp. 1300–1304, 2006. View at Google Scholar - M. Wells,
*J2ME Game Programming*, Thompson, Boston, Mass, USA, 2004.