Archive for the 'code' Category

Real-time Action Planing with Preconditions and Effects (GameCoderMag-2012)

I wrote an article for the March issue of the Game Coder Magazine:

Abstract: In this article I will be covering an artificial intelligence (AI) technique for decision making that can be used in various parts of game development to account for “thinking before acting”. The technique is called Classical Planning in academic AI research, and is one of the most basic approaches for deliberating about the effects of actions and the way the properties of a given domain change under these effects. Variants of this technique have been used successfully in game development under the name Goal Oriented Action Planning (GOAP), each time focusing on a different aspect of this technique, adopting it for the particular needs of the game.

You can get the article here.

More information: In the article I go over a simple example inspired from real-time strategy games. I focus on the behavior of a peasant that can be instructed to bring food or handle other resources, and extend the character’s functionality so that they can take more advanced commands which may need a series of actions to be realized. Using this example I go over one of the simplest forms of planning, that is propositional STRIPS planning, and present an implementation using Python.

The following screenshots are code listings included in the article, which show how the planning algorithm can help the peasant find ways to realize the given commands. 

The self-contained Python code can be found here: PyPlan. The file goap.py contains all the necessary classes and methods for implementing planning, and example.py includes a simple example based on the peasant scenario that is explained in detail in the article.

Bibtex:

@article{vassos12gamecoderplanning,
author = {Vassos, Stavros},
citeulike-article-id = {11193150},
citeulike-linkout-0 = {http://stavros.lostre.org/files/Vassos12ActionPlanning.pdf},
journal = {GameCoder Magazine},
keywords = {goap, planning, strips, video\_games},
month = mar,
number = {3},
pages = {20–27},
title = {Real-time Action Planing with Preconditions and Effects},
url = {http://stavros.lostre.org/files/Vassos12ActionPlanning.pdf},
year = {2012}
}