Adaptive AI Engine for RTS Games

Discussing the theory and practice

2apl Language : A Fast Overview

Posted by merothehero on November 6, 2009

2apl is a agent oriented prolog-like language which helps the programming of the interaction between different BDI ( Belief-Desire-Intention ) agents in a multi-agent system.

The Whole System is specified through a (.mas) file , the code related to each agent is put in (.2apl) files . Agents could inherit from others.

A 2APL agent may have beliefs and goals which change during the agent’s execution.

Basic Actions an agent may do

Belief Update Action

A belief update action updates the belief base of an agent when executed.

Communication Action

A communication action passes a message to another agent

External Action

An external action is supposed to change the external environment in which the agents operate.

Abstract Action (similar to a procedure)

An abstract action is an abstraction mechanism allowing the encapsulation of a plan by a single action.

Belief and Goal Test Actions

A belief test action is to test whether a belief expression is derivable from an agent’s belief base, tests whether the agent has a certain belief.

Goal Dynamics Actions

The adopt goal and drop goal actions are used to adopt and drop a goal to and from the agent’s goal base, respectively.


In order to reach its goals, a 2APL agent adopts plans. A plan consists of basic actions composed by process operators.

Reasoning rules

The 2APL programming language provides constructs to implement practical reasoning rules that can be used to implement the generation of plans.

Planning Goal Rules (PG rules)

A planning goal rule specifies that an agent should generate a plan if it has certain goals and beliefs.

Procedural Rules (PC rules)

Procedural rules generate plans as a response to 1) the reception of messages sent by other agents, 2) events generated by the external environment, and 3) the execution of abstract actions.

Plan Repair Rules (PR rules)

The execution of an agent’s action might fail. To repair such actions 2APL provides so-called plan repair rules.

The Deliberation cycle

The beliefs, goals, plans and reasoning rules form the mental states of the 2APL agent. What the agent should do with these mental attitudes is defined by means of the deliberation cycle. The deliberation cycle states which step the agent should perform next, e.g. execute an action or apply a reasoning rule. The deliberation cycle can thus be viewed as the interpreter of the agent program, as it determines which deliberation steps should be performed in which order. 2APL provides the deliberation cycle as illustrated in this figure :


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: