Appear smarter by moving in the right circles (or vector fields)

Simon’s ant

You don’t have to be smart in order to appear smart. An illustration of the previous is the now famous ant-on-the-beach parable as presented by well-known AI pioneer Herbert Simon in his book The Sciences of the Artificial. As an illustration of how complex behavior can arise from simple rules applied to nonsimple data, Simon asks us to consider the path taken by an ant on a sandy beach. Simon writes:

“Viewed as a geometric figure, the ant’s path is irregular, complex, and hard to describe. But its complexity is really a complexity in the surface of the beach, not the complexity in the ant.”

Simon’s ant-on-a-beach example is highly relevant to games, where we are very used to faking the appearance of smart computer-controlled opponents. However, increasingly often smarter opponents are created by writing more and more complex AI routines for the opponents and we sometimes forget to what extent we can obtain emergence of complex behavior merely from the interaction of a simple AI with a complicated environment — just like an ant on a beach.

An excellent example of how an object can exhibit complex behavior from interacting with the environment is the use of vector fields to control the movement of an AI car in a racing game. Although this particular AI approach is probably mostly forgotten today, it was a not uncommon approach in the circa 1980-era of racing games.

One of the early racing games sporting vector field-based AI was Atari’s Sprint 2 racing game from 1976. Here is a screenshot (scaled up from the original resolution of 256×256):

Sprint 2

The AI for Sprint 2 is described in quite some detail in — the now expired — U.S. Patent 4,148,485 (“Driving games method for automatically controlled cars,” Lyle Rains, Atari, September 19, 1977). Pertinent to my example here is one of the drawings from the patent which describes the vector field layout for the Sprint 2 track I just showed:

Vector field

(BTW, how neat is it that I was able to find a screenshot of the very track — of a 31(!) year old game — for which they presented the vector field in the patent application? The internet is amazing!)

The actual Sprint 2 cars themselves have very little AI; they mostly just orient themselves to the vectors of the vector field that they travel across. Still, that’s all that is needed to convincingly navigate the track. Note specifically how vectors have been added to the vector field to avoid the oil spills, so the cars themselves do not need to have such smarts. OK, sure, the Sprint 2 cars are no match for the car simulations of, say, Gran Turismo 4, but that’s not the point.

Of course, this is not to say we don’t use tagged environments in modern games. We do, for a lot of things. For example, in God of War (both GoW and GoW II) we tag surfaces in the collision geometry with flags specifying where there is a ladder, where you switch into a balance animation (for narrow catwalks), where there are climbable surfaces, or where you need to perform what we call a Heart of Darkness-jump, to name a few.

For games of a more strategic nature we can mark the environment such that characters automatically crouch for cover behind rocks and other convenient environmental obstacles (by placing a volume around the rock, or marking the collision geometry immediately surrounding the rock). We can also tag locations as being good ambush spots, etc.

In some cases it is worth spending the extra time on having systems that can derive the mark-up information automatically or by having more complicated AI that can detect e.g. cover on the fly through collision queries, but in many cases the simplest solution is the best: just mark the environment appropriately and even the most simplistic computer opponents will exhibit a complex behavior.

Just like an ant on a beach.

2 thoughts on “Appear smarter by moving in the right circles (or vector fields)”

Leave a Reply