Contents
Evolving Pathfinding Algorithms Using Genetic Programming
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Texture Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Character Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Technical Art Director
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [6]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Time Fcuk
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Evolving Pathfinding Algorithms Using Genetic Programming
by Rick Strom
0 comments
Share RSS
 
 
June 26, 2006 Article Start Previous Page 2 of 2
 

Evolution

With our requirements stated, our language defined and our interpreter built, we are ready to start the evolutionary process.

Advertisement

In the beginning, we create a population of random programs, and by random I mean truly random. Trees are initially built by creating a root node and then randomly attaching child nodes to it, until - randomly - a terminal node is selected, at which point the branch terminates. As you would expect, these random programs aren't particularly good at anything, and early generations fail miserably at finding their goal.

Programs that actually are good at finding the goal are found by combining the best programs in the population to create child programs. The idea is that children may inherit the best parts of their parents, and thus later generations become more fit than previous generations. To do this, new generations are constructed using reproduction, crossover and mutation.

Reproduction is simply a means of ensuring that the most fit member(s) of the previous generation survive into the next. When constructing the new generation, we simply copy over one or two of the lowest scoring programs and allow them to continue to compete.

Crossover is the operation that actually takes its inspiration from biology. In crossover, we create new programs by combining parts of two programs to create two new programs. Hampton does this by swapping random subtrees of the two lowest scoring (i.e. most-fit) programs. By doing this, we are hoping that two programs which each perform well in unique circumstances can combine to form a child program that performs well in both.

 


 


Mutation, the final operator, helps to prevent our population from falling into a rut. Mutation is done by selecting a random node in the program tree, deleting it (and its subtree) and replacing it with the root node of a new random tree. This effectively introduces new genes into the pool. This is most important if we are running steady-state, which means that in each generation programs not affected by the genetic operators remain in the population. If we are not running steady-state, then the population is repopulated with random programs on each generation, flushing the population with new genes and making mutation less important.

All of these operations occur with a certain probability, which should be adjusted until good results are found. High probability of crossover, low probability of mutation and near-certain reproduction seem to be the most effective in a non-steady-state system.

Adaptation

A final consideration is adaptation. As the project has been described, we have set up a system which will evolve programs that are well suited to a particular map, when in fact we probably want programs that will perform well no matter what map we throw at them. One way to do this is to cycle the map at regular intervals, causing programs that are too specific to fail on the map change, and be dropped out of the population. Over time, we should end up with programs that perform well from one map to the next - programs that survive drastic changes in the environment, just as successful species do in the animal kingdom.

One thing to keep in mind is that the process of adaptation is probably the one that will be the most time consuming. In a system where natural selection is determining which genes in a population survive into the next generation, evolving a population that performs well against a static challenge can occur fairly rapidly. Evolving anything that can not only survive the current environment, but is ready for possibly cataclysmic changes, will demand much more time in the process.

To allow for highly adaptable programs, Hampton can generate random maps and cycle them every few generations.

Results

We've been told that evolution is an extremely slow process, with small changes occurring over hundreds of thousands of generations, but new science seems to indicate that these changes can occur much faster than we previously thought. So it might not come as much of a surprise that Hampton finds successful solution programs fairly quickly, even on very complex maps. Most-fit programs can reach their goal in as few as a hundred generations. This is stunning when you consider the minimum of information and ability we are giving our programs access to, and that our initial programs (as well as programs generated on repopulation) are completely random, nonsense jumbles of function and terminal nodes.

The real measure of success, however, is aesthetic. Our evolved programs are successful if you yourself see intelligence in their strategies. If so, then we have taken a step forward towards creating more realistic AI, and a less frustrating experience for the gamer.

 


 

 


 

 

Final Thoughts

If you plan to extend Hampton or create your own genetic programming experiments, there are a few other subjects that might be interesting to consider.

First, you might want to consider program size, and the impact large programs will have on the success of your project. By some miracle, Hampton tends not to create huge, deep trees, although there is no mechanism in place to prevent it from doing so. On the positive side, a larger program tree will have the potential to be much more complex than a shorter tree - a tree which is 100 nodes deep will naturally be capable of much more advanced decision making than a tree which is 5 nodes deep. On the other hand, however, large trees will take longer to parse, will consume more memory, and may use up all their complexity making horrible decisions. Whether or not some sort of pruning process would be beneficial or not would make an interesting study.

Another question we could ask is whether or not we should "correct" a program that is inefficient or redundant. Although a lot of genetic programming projects tend to stick rigidly to the biological model, I see no reason why a little creative hacking couldn't be applied to help the process along. It is possible that reducing redundancy and general stupidity in programs in the population before performing cross-over could result in much more rapid evolution and much more useful programs in the end. If further justification for messing with the basic idea of GP is required, we could consider whether the genotype (i.e. the makeup of the program) or the phenotype (what the program ultimately does) is more important to us.

I tend to think of ideas like genetic programming as jumping off points rather than sets of rigid rules which must be followed closely. Perhaps a combination of genetic programming, other techniques, and pure creativity can lead to a pathfinding algorithm that truly evokes awe in anyone who witnesses it. At the very least, we can hope for an algorithm which won't cause gamers to bang their heads into their desks.

 

 
Article Start Previous Page 2 of 2
 
Comments

none
 
Comment:
 


Submit Comment