Abstract

This paper investigates a new dynamic (i.e., space-time) model to measure aesthetic values in pathfinding for videogames. The results we report are important firstly because the artificial intelligence literature has given relatively little attention to aesthetic considerations in pathfinding. Secondly, those investigators who have studied aesthetics in pathfinding have relied largely on anecdotal arguments rather than metrics. Finally, in those cases where metrics have been used in the past, they show only that aesthetic paths are different. They provide no quantitative means to classify aesthetic outcomes. The model we develop here overcomes these deficiencies using rescaled range (R/S) analysis to estimate the Hurst exponent, . It measures long-range dependence (i.e., long memory) in stochastic processes and provides a novel well-defined mathematical classification for pathfinding. Indeed, the data indicates that aesthetic and control paths have statistically significantly distinct signatures. Aesthetic paths furthermore have more long memory than controls with an effect size that is large, more than three times that of an alternative approach. These conclusions will be of interest to researchers investigating games as well as other forms of entertainment, simulation, and in general nonshortest path motion planning.

1. Introduction

Pathfinding in videogames must appeal to player expectations for plausibility and naturalness, that is, what natural intelligence might conceivably do. Thus, navigation in games is not necessarily optimal in machine efficiency or shortest distance. Indeed, these goals are assumed to be secondary and possibly even undesirable. That is, if they lead to unrealistic, mechanical-looking movement lacking in sensori-emotional or aesthetic qualities, movement as such frustrates players and detracts from the gameā€™s replay appeal and immersive quality [1].

Aesthetics, however, pose special challenges. The philosopher, Immanuel Kant (1724ā€“1804), argued in The Critique of Judgment [2] that matters of beauty, taste, and so forth are subjective and relative and by implication beyond the pale of automation. The question for us, however, is not what beauty or harmony in pathfinding is but what is knowable about such ideals which game researchers and developers have identified as goals of ā€œaesthetic optimizationsā€ and ā€œaesthetic corrections.ā€ Yet these endeavors, while generally successful, derive almost entirely from anecdotes rather than metrics. Indeed, the investigators do not take the next logical step, namely, to measure the efficacy of aesthetic treatments. They do not ask to what degree beautifying regimes improve aesthetic outcomes and whether the results are consistent with player expectations.

In this paper, we study these questions using a dynamic (i.e., space-time) assessment of aesthetic values. Our model is based on rescaled range (R/S) analysis to estimate the Hurst exponent, H, which measures long-run noncyclical autocorrelation (i.e., long memory) in stationary time series [3, 4]. In the past, H has been used by many others including Mandelbrot to study dynamic phenomena, although none involving pathfinding. H offers novel insights into pathfinding, and it has distinct advantages compared to alternatives like the fractal dimension to assess ā€œsnapshotā€ aesthetic values in 2D imagery [5ā€“7]. H does not employ static imagery and furthermore provides a three-tier mathematical classification that is particularly appropriate for pathfinding: (i) H = 0.5 characterizes a Gaussian or random walk; (ii) evinces persistence or a trend; (iii) is evidence for antipersistence, namely, mean-reversion.

Model results on pathfinding trials in randomly generated multiroom levels suggest that both aesthetic and control paths are persistentā€”and common sense demands that they should be since each path follows a trend toward the goal. However, the median amount of persistence appears to be crucially dependent on the transform operator, Ī˜, which we use to transform a path to a stationary time series. Despite the caveats, agents pursuing aesthetic paths have more measurable long memory compared to controls, and for several transform methods we study the difference which is statistically significant, that is, with in the best case. Also, for the best transform operator, the effect size is large, more than two times greater than the fractal dimension approach.

A motivation for this research is generally aimed toward development of a more quantitative understanding of aesthetic values in dynamic artifacts. We study games and simple navigation for 2D or 3D games like first person shooters. The principles, however, have broader implications and may well support investigations of other dynamic behaviors that include gestures, gaits, choreographies, acrobatics, and so forth, which we posit to be inappropriate for ā€œsnapshotā€ measures of aesthetic value. We do not study or explore the implications of these concepts here. Nevertheless we believe that the model may be of interest to researchers investigating games as well as other forms of entertainment, simulation, and in general nonshortest path motion planning.

The mainstream artificial intelligence (A.I.) literature is largely silent on pathfinding aesthetics. For instance, Russell and Norvig [8] give thorough treatment of pathfinding but do not mention aesthetics. Even texts specializing in A.I. for games, like Millington [9] and Bourg and Seemann [10], do not refer to aesthetics.

Rabin [11] appears to be the first to investigate ā€œaesthetic optimizationsā€ as a primary objective of pathfinding using splines and hierarchical approaches. Higgins [1] proposes to search for aesthetic paths through ā€œaesthetic correctionsā€ as a second pass after the main path has been computed. Stout [12] and Pinter [13] offer related suggestions for creating ā€œpleasingā€ and ā€œrealisticā€ paths. Botea et al. [14] do not specifically study aesthetic pathfinding but acknowledge, at least in passing, that pathfinding without aesthetic considerations is not practical for games. The efforts of these investigators have at least two features in common. Firstly, they recognize that smoother and straighter paths are more appealing and plausible than ones that zigzag or track obstacles. Secondly, they do not grade or score paths for aesthetic value.

For this reason, we put forth the beauty intensity, ā„œ [15]. It measures the second-order derivatives (i.e., zigzags) and obstacle tracking. ā„œ formulates these into a simple nonlinear model designed to resemble the Weber-Fechner law in which human sensibilities are logarithmic in response to stimuli [16]. In every case for a path, , treated with Rabin-Higgins beautifying regimes and a reference or control path, , not subjected to such treatment, we observe .

We subsequently developed a more sensory model, [5]. It is based on the fractional or fractal dimension, , which Mandelbrot developed in his seminal paper to measure the length of coastlines and other irregularly shaped geometric objects [17]. We were basically following others who had used to study masterpieces like the ā€œaction paintingsā€ of Jackson Pollack [18]. That aesthetic paths nevertheless have higher fractal dimensions is surprising because measures surface texture differences and has no parameters related to pathfinding. In other words, unlike ā„œ, is nonparametric and consequently more robust.

Unfortunately has some limitations. Firstly, as a geometric interpretation of the fractal dimension, it operates on the spatial domain only. It completely ignores the temporal domain and thus seems inadequate to us for games and other dynamic phenomena that evolve in both space and time. Moreover, aesthetic paths have higher fractal dimensions, that is, they are ā€œrougher,ā€ not smoother or straighter as sought by aesthetic optimizations and corrections. This reversal suggests to us that texture is a useful sensory metaphor, and works well on snapshots of coastlines, brush strokes, and other static imagery [7]. However, a different method is needed for dynamic artifacts like pathfinding. Finally, G is a robust discriminatorā€”it has absolutely no assumptions about pathfinding. Yet it is not very powerful. The median is less than 0.1% of the median , and Hedges-Olkin [19] index is 0.41 which is a small-to-medium effect size [20].

H is a stochastic, rather than a geometric, interpretation of the fractal dimension. Hurst developed R/S analysis to study hydrology [21], and Mandelbrot showed that it reliably measured long-range dependence in stationary systems [4]. In other words, an effect or ā€œshockā€ does not necessarily dissipate instantaneously but decays over time as if, metaphorically speaking, the system has memory of the event. This observation was not new, of course, but Mandelbrot suggested a general way to measure it through R/S analysis, and this work aroused the interests of many others working in diverse areas [22ā€“25], although none involving pathfinding. Thus, textural and memory interpretations of H are complementary descriptions of the same phenomena.

A number of researchers have used R/S analysis to model long-range dependence in Internet network traffic; see [26] for cross references. While working in this area, Karagiannis [26, 27] developed a Java tool, Self-Similarity and Long-Range Dependence Analysis (Selfis), which we use to estimate H.

We also use the second derivative and obstacle tracking techniques developed in Coleman [15]. Unlike that case, however, we do not integrate these parameters with respect to the time. The experimental trials are the same. The opinion survey of players [28] uses the same trials, and the results are reported in [5].

Finally, we note that literature contains many references to mathematical patterns of beauty related to Aristotleā€™s Golden Ratio, Fibonacci series, and so forth [29]. There is also a growing body of related work to assess musical patterns [25]. The former is concerned principally with the spatial domain while the latter with the temporal domain. Pathfinding in necessarily incorporates both which is part of the uniqueness and opportunities of the present study.

3. Study Objectives

The main objective of this study is to identify a dynamic model, ā„µ, based on the Hurst exponent which discriminates between paths subjected to aesthetic treatment and controls without such treatment. We emphasize that we are not investigating new ways to generate aesthetic paths but rather to analyze them using a new approach. The most important characteristic of ā„µ, as far as this paper is concerned, is its effect size. That is, it is not sufficient that the model gives statistically significant results. Our ā€œbenchmarkā€ model, G, already does that except in a static manner and with a small effect size [5].

A meaningful improvement, therefore, would at the very least have a medium effect size. The effect size, however, depends on the operator, Ī˜, which transforms P into a stationary time-series, Ī¾. While the number of possible Ī˜ appears large, we are interested only in those that meet a set of criteria or have specific properties which we explain below. Thus, wherever we write H(P), we mean H(Ī˜P) = H(Ī¾), namely, the Hurst exponent of a transformed path.

4. Hurst Exponent

A stationary process is said to have long-range dependence or long memory if there is a real number Ī±āˆˆ(0,1) such that

where is a constant, and is the autocorrelation function of sample observations, , with lag . The Hurst exponent, , is related to Ī± as

wherewhich implies is persistent, that is, positively autocorrelated. If the last move was up, the next one most likely will be up. It will have a trend. Also, implies that is antipersistent or negatively autocorrelated. This is what Mandelbrot and Wallis termed the Joseph Effectā€”feast followed by famine [4]. If the last move was up, the next one most likely will be down. And, implies that has no autocorrelation. It is a random walk. The next move in no way depends on the last one.

The ā€œwalkā€ metaphor is very appropriate for pathfinding. Indeed, literature often speaks of as a ā€œpath.ā€ However, our paths, , are inherently four dimensional, and thus, we need to transform them into as we suggest later.

R/S analysis is a statistical estimate of H, namely,

where is the amplitude range over a time window, Ļ„, scaled to the standard deviation, , of the range. That is,

where

Thus, the R/S for any given Ļ„ is

The classic approach to choosing Ļ„ used by Selfis is a divide and conquer method. That is, Ī¾ must be 2n in length and . H is regression slope of versus with n-m observations of (6) on the regression line, where is the Selfis default.

5. Model:

Let the virtual world, , be a finite state space in Euclidean . We assume without loss of generality that . For instance, if the game is a 3D first-person shooter, implies that the view for analysis purposes is from above, namely, looking down the -axis toward the - plane.

Let , for , , where and are width and length features, respectively, of , and is a state, namely, . contains a set of obstacles, , namely, , . Also contains, , a ā€œfree flyingā€ rigid-body (i.e., the NPC), which has configurations or steps such that , , where is the time step. These steps define a path object, , for from (start = 0) to (goal = ), where , and . All other states of are ā€œopenā€ or unoccupied, namely, , . For the worlds we generate, ā€œtracksā€ an obstacle if , , where .

We say operationally has more beauty than if such that

where H(P) is the R/S statistic of a path , after it has been transformed to a stationary process, Ī¾, using Ī˜ which we describe in the next section. We note that (7) is meaningful under the following constraints.

C1: and have identical start configurations in .C2: and have identical goal configurations in .C3: in each case has the same obstacles, .

The intuition of (7) is that if exhibits behaviors that enhance its aesthetic appeal compared to , then compared to has a greater tendency to trend along straighter and smoother configurations without tracking.

6. Aesthetic Optimizations and Corrections

The model, ā„µ, does not specify how to generate P. The details of how P objects are generated are covered in detail in [15]. In summary, we use the algorithm from Bourg and Seemann [10] for controls. It is a ā€œstandardā€ algorithm which minimizes distance to the goal without regard for aesthetic considerations.

Paths which receive beautifying treatment also minimize distance to the goal. In fact, aesthetic and control heuristics are identical in this respect. The aesthetic optimization, however, minimizes distance as a second-order effect. That is, after the distance for each possible next step has been calculated, weighted values for the second derivative and wall tracking are linearly combined with the distance as a cost penalty. It is important to note that the calculation of the cost penalty is independent of the distance calculation (see Figure 1).

The general idea of aesthetic optimization is due to Rabin [11] but we implement it as a first pass. Following the first pass, after the main aesthetic path has been calculated from start to goal configurations, we use ā€œaesthetic corrections,ā€ an idea from Higgins [1]. This second pass examines the entire path in a global analysis and removes residual zigzagging which got through the first pass.

7. Transform Operator:

The operator transforms a path object, , into a stationary time series, . Ideally Ī˜ will meet the following criteria and/or have the following desirable properties.

(1)Independence of the treatment parameters. That is, Ī˜ cannot use path curvature or obstacle tracking as inputs since these are precisely the parameters that drive aesthetic and control searches. We can know that this criterion has been met by inspection of Ī˜.(2)Stationarity. This is not a ā€œnice to haveā€ but in fact a requirement for analysis. Nearly all research reports in literature assume stationarity without necessarily establishing it. In our view, the novel application of analysis to pathfinding obliges us to confirm its validity consistent with making as few assumptions as possible. We can test this criterion through stationarity analysis tools such as the Kolomgorov-Smirnov test [30], the application of which we describe later.(3)No reversals. In this case, H(Ī˜P) will indicate that aesthetic paths which are smoother and straighter also have more long memory. Conversely, for controls which have no aesthetic treatments, H(Ī˜P) will indicate that they are either antipersistent or Gaussian (i.e., a random walk). We can know that this criterion has been met by direct analysis of statistical results.(4)Simplicity. We mean to suggest that Ī˜ has a closed form, relatively few terms, a formulation that is straightforward to implement in a conventional programming language, and so forth. Ultimately, however, these are only guidelines, and whether they (and possibly others) have been met will be left for the reader to decide.
7.1. Formulation

Given these criteria, we arrived at the following general formulation:

That is, Ī˜ is a convolution of the Dirac delta function, Ī“ [31], and is one at for and vanishes elsewhere. is a function that converts P to time-dependent scalar values. For the purposes of this paper, has the following form:

The variable, , is a uniform random deviate with dynamic range . The variable, , is a random Gaussian deviate with and , where . In other words, is biased in the positive direction. The variable, , is a distance metric which we describe below.

The physics metaphor is which acts as a spring with a damper, (r2d). That is, (r2d) is a positive offset for r1. The damper causes āˆ‡ to have more or less long memory depending on the magnitude of d. Properly ā€œtunedā€ given the constants, and , āˆ‡ will tend to have a smaller dynamic range for aesthetic paths compared to controls, reflecting the greater long memory in aesthetic paths.

The variable, d, is distance from the current configuration, (, ), to some target location, (, ). If the target is a fixed location independent of the virtual world layout, for example, the center of the world, for a given world will tend to vary randomly since the worlds are randomly generated. Sometimes the control path will be on the ā€œinside trackā€; at other times the aesthetic path will be on the ā€œinside track.ā€ (By ā€œinside trackā€ we mean shorter distance to the goal.) In other words, there will be no discernable pattern for discriminating control versus aesthetic paths. If, however, the target is the goal configuration, then will not vary randomly. In fact, empirical data we show later confirms

since control paths tend to be on the ā€œinside track.ā€ This suggests that the dampening of will tend to be greater for aesthetic paths, and āˆ‡ will tend toward greater stochastic memory.

7.2. Discussion

We ask if (9) meets the criteria given above. At this point we can answer positively regarding criterion 1: Yes.

The reason for this conclusion we gave earlier is the following: while distance is an objective of the heuristic search, it is not a treatment parameter. In fact, the identical distance function is applied in both control and aesthetic searches. The only difference, as we mentioned earlier, is the beautifying treatment which is independent of the distance function. Namely, the beauty regime asks if (a) the path has a nonzero second derivative and/or (b) the path is tracking. If either one or both are true, the cost is updated regardless of its distance component.

This may lead to a step which is further from the goal as is often the case for aesthetic paths; however, from a statistical point of view the mean difference between the control and aesthetic path length is not statistically significant [15]. The implication, then, is that the difference in distance to the goal at any given step is not statistically significant. We test this assertion and report in the ā€œResultsā€ section that in fact this claim is supported by the data.

If there is no significant difference, why then should this work? We posit that since (9) is nonlinear with respect to d, āˆ‡ is sensitive to initial conditions. In other words, a small difference makes a difference.

7.3. Parameter Selection

We learned through manual trial and error that (9) is sensitive to initial conditions, that is, c1 and c2. We similarly learned that the Manhattan or taxicab metric works best for d [17], namely,

where , and . That is, compared for instance to the Euclidean and checkers metrics which we also examined but will not refer to further, when d is the Manhattan metric with and , ā„µ is statistically significant with a large effect size. Furthermore, except in a few cases, Ī¾ is stationary (criteria 2), and generally there are no reversals (criteria 3).

While it is possible that other combinations of the parameters in āˆ‡ will yield equally good or even better results, we run tests on out-of-sample trials to verify that (9) is not overfit with the selected parameters.

7.4. Augmenting Ī¾

We generally cannot use directly as given in (8). Recall that analysis uses ā€œdivide and conquer.ā€ This means that Selfis truncates the data to the nearest floor if P is not exactly length. Since our rarely meet this criterion, Selfis arbitrarily throws away potentially meaningful sample points. To control this problem, we randomly sample P(x, z, t) and extend to the nearest ceiling if the length is not .

For instance, in Trial 56 the control has length 103, and the aesthetic has length 108. At 23 randomly selected configurations in the control, we reinvoke (8) which makes . We carry out a similar process on the aesthetic path. The process flow is shown in the Figure 2.

8. Experimental Design

Under experimental conditions, (7) may be regarded as a ā€œblack box.ā€ Namely, we input to objects, and , and observe the output statistic, ā„µ. The experimental design does not ask what type of regression is employed, whether it is statistically significant, how many input points we use, and so forth. It is blind to these questions. Our only interest is whether there are systematic deviations in ā„µ which cannot be explained by chance.

We use the multiroom virtual worlds from Coleman [5] which are generated with the Wells random level generator [32]. It takes an integer seed and returns a randomized world, , which contains , , and . This is one trial; in fact, the seed is the trial number. Figure 3 shows a sample, Trial 56.

Let be the path subjected to beautifying treatment, and let be the reference or controlā€”just as we mentioned earlier. A preliminary analysis using the Kolmogorov-Smirnov (K-S) test [30] indicates that H(P0) and H(P1) are not consistent with the normal distribution. For this reason and in the interests of conservatism, we invoke the one-tailed Binomial test which is nonparametric [30] to assess the statistical significance of difference between H(P0) and H(P1). In this case, each experimental trial is a Bernoulli trial which is a ā€œsuccessā€ if the null hypothesis, , is true and a ā€œfailureā€ otherwise for . If the number of successes is , and the number of failures is f, then the null hypothesis is , where . The complete set of trials in opinion survey form can be found on the authorā€™s website [28].

To determine whether a path is persistent (or a random walk), the null hypothesis is , where is a failure if testing for antipersistence and is a failure if testing for persistence.

To estimate the effect size robustly, we use the Hedges-Olkin index [19]:

where is the fraction of H scores in one population greater than the median of the other, and Ī¦-1 is the inverse normal distribution. We use Cohenā€™s interpretation of effect sizes [20].

To test for stationarity, we use the K-S test as follows. We divide of a given trial for the control and the aesthetic path exactly in half. Then we run the K-S test on each half. If for both control and aesthetic paths, we conclude that the is stationary. Otherwise, is nonstationary for either control, aesthetic, or both, and we remove that trial from further statistical analysis.

9. Example

To make these ideas clearer, we go through an example, trial 30 from the study. The control and aesthetic paths are shown in their multiroom virtual worlds in Figure 4.

In general, one can see that the aesthetic path is straighter and smoother than the control path. Indeed, players rated it as more realistic, beautiful, and intelligent compared to the control [5, 28].

The charts in Figure 5 shows for Trial 56 using the dot product transformation function.

H indicates that the control tends to revert to its mean , and the aesthetic tends to trend . The dynamic range is to 7.75 (total: 17.01) for the control and to (total: ) for the aesthetic path.

10. Results

In this section we give a summary of the experimental results. The full datasets, including charts as well as the opinion survey, are available for download from the authorā€™s website [28, 33].

Figure 6 show the distributions of H(P0) and H(P1).

The distribution for ā„µ is in Figure 7.

The K-S test indicates that these data are not consistent with a Gaussian distribution . For these reasons, all results, except where noted otherwise, are reported based on nonparametric methods beginning with Table 1 for trials 1ā€“100. (Recall that these trials are the ones in the opinion survey [5, 28] as well as the ones used to assess G, the ā€œbenchmarkā€ model.)

We observe that aesthetic paths clearly exhibit more memory than controls, and the median mean distance is greater by slightly more than about one step. However, an analysis of (using the Studentā€™s t-test [30], since the data is normal) indicates that control and aesthetic paths are not statistically significantly different with .

Table 2 gives results for the out-of-sample trials (101ā€“200) and clearly (8) represents a generalization since the statistics are approximately the same.

Tables 3 and 4 give the null hypotheses, values, and effect sizes for trials 1ā€“100 and trials 101ā€“200, respectively. Again, these data suggest that (8) is not overfit.

An analysis using the K-S test indicates that all trials (1ā€“100) have stationary statistics except trials 69 and 88 of the control paths and trial 63 of the aesthetic paths. If, however, we remove these three trials, the statistics for the remaining 97 trials do not change appreciably as Table 5 suggests.

11. Conclusions

The data suggests clearly that the model discriminates between control and aesthetic paths. Specifically, the hypothesis tests in Tables 3 and 4 indicate that (1) aesthetic paths have statistically significant more memory than controls with a large effect size; (2) aesthetic paths are statistically significantly persistent with a medium-to-large effect size; (3) control paths are statistically significantly antipersistent with a large effect size. Removing even those trials which are nonstationary (Table 5) does not appreciably affect the statistical significance or effect sizes. We conclude that these results tend to strongly confirm the model as being a robust and effective discriminator of aesthetic versus control pathfinding.

Furthermore, the model is not reversed; that is, aesthetic paths have more memory, and controls have less memory. The model furthermore is general (i.e., it is not overfit) and has features of simplicity we suggested as guidelines. By these criteria, ā„µ is a distinct improvement over the ā€œsnapshotā€ method of G.

Since we carried out tuning of (9) manually, we believe that automated methods using, for instance, genetic programs, might be a fruitful avenue for future research. Since furthermore aesthetic search has also been manually tuned (see [15]), there is also the possibility to use automated means for aesthetic optimizations and corrections as additional opportunities for further study.

Finally, we suggested at the outset some motivations for this research that include, in general, assessing dynamic aesthetic values for nonshortest path motion planning. The model may well facilitate the study of these ideas and concepts as future work.

Acknowledgments

The author thanks Maria Coleman, Alan Labouseur, and Eitel Lauria for reading drafts and the reviewers for providing excellent feedback which simplified and improved the paper.