Theory and documentation

Version history and plans





SourceForge homepage Logo

Last updated: 2004-04-28

The agent framework

    Status: Alpha
    Introduced in: 0.3
    Refactorings: 0
    Developed by: Treefinger
    Latest iteration in: 0.3
    Latest iteration by: Treefinger


The agent framework contains classes and interfaces for building agents. An agent is some sort of actor in the world, be it an adventurer, a rabbit or a talking tree. Anything goes. The framework uses a controller to submit "actions" to the world and registers "sensors" which subsequently receives information from the world.


An agent consists of two parts, a controller and a representation. The controller is the deciding part of the two. It decides which actions should be taken and when. The representation contains the "physical" body of the agent which exists in the world.

The controller can either be an AI that decides what to do, or it can be a human controlling it through some sort of interface. We have implemented a GUI for controlling the Haphazard agent and abstracted common functions to the GUIController. This includes for example notification on resize.

To be able to show controller specific information to the user, we implemented an interface HUD (Heads-up display) which can draw information on top of the normal view a user has.


An action is something that a physical representation can perform and which affects the world. For example move around, jump, wave to its friends, and so on. An action can either succeed, fail or be stopped. For example continous movement in a direction continous until stopped while wearing a jacket succeeds when the jacket has been worn. Actions which can succeed and fail usually has a critera which they strive against.

When an action terminates (succeeds, fails, stops), its controller is notified and can take an appropriate action if it has chosen to implement the callbacks provided.

An action that involves more than the "performer" is called an interaction. If an object in the world can take part of an interaction, it must implement the interface Interactable

To facilitate reuse and be nice to the memory, there is an ActionPool which reuses actions.


The sensor framework is still in its infancy. Right now it consists of an interface "sensor" which means that an object can "sense" something from a world. The abstract sensor provides some functionality that can be nice to have when developing stand alone sensors. Example on what can be a sensor is for example sight, hearing, being able to sense the closest object in any direction or knowing what a person is doing etc.