Generic selectors
Exact matches only
Search in title
Search in content
Search in project

Creating an Atavism Plugin

Developers working with the AGIS code may decide to create a new Atavism Plugin if they want to implement a new system that is not provided by default (for example a custom weather system or maybe a stock exchange system). The steps below cover how a new plugin can be added to Atavism.

Note: The * symbol before the words Plugin or Client represent a name (any name) of a plugin.


Step 1: Creating the * file

The core file for a plugin is the * file which should exist in the atavism.agis.plugins package. The first step is to create a new * file (replacing the * with the name of your plugin). This can be done in Eclipse by right clicking on the atavism.agis.plugins, choosing New → File and naming the file * (replacing the * with the name of your plugin).

The Plugin class needs to extend the EnginePlugin class (or a child of EnginePlugin) and should call SetPluginType(string) in the constructor, along with passing the Plugin name to the parent constructor. The example below from the ArenaPlugin class shows the basic structure needed for setting up a Plugin class.

  public class ArenaPlugin extends EnginePlugin {
      public ArenaPlugin() {
      public String getName() {
          return ARENA_PLUGIN_NAME;
      public static String ARENA_PLUGIN_NAME = "Arena";
      protected static final Logger log = new Logger("Arena");
      public void onActivate() {

Step 2: Creating the * file

While not required, each Plugin uses has an accompanying * file where the messages/message types and other functions for the Plugin can be added. The Client file is generally located in atavism.agis.plugins package beside the core * file.

The Client class doesn’t inherit from or extend any other classes and doesn’t have any required functions or variables, however, any messages for your Plugin will be added to this class.


Step 3: Adding the Load Plugin code

For a plugin to load on server startup it must be declared and registered in a couple locations.

A python script for the plugin should be created in the config/world folder on the server and contain the registerPlugin() function, such as:

  from atavism.agis import *
  from atavism.agis.core import *
  from atavism.agis.objects import *
  from atavism.agis.util import *
  from atavism.server.math import *
  from import *
  from atavism.server.objects import *
  from atavism.server.engine import *
  from atavism.server.util import *
  from atavism.server.plugins import *

This plugin file can then contain other code to allow setting properties etc. in your plugin if wanted. Take a look at the other * files in the config/world folder to get some examples.

The new plugin python script now needs to be added to the file (located in the bin folder), along with adding the Plugin name to the list of plugins in that file.

Scroll down to roughly line 250 and find the line that starts with:


Go to the end of the string and add (without the quotation marks):

  " -p YourPluginName,1"

Now you need to decide if you can add the plugin to one of the existing server processes, or if you need to make a new server process.

Loading a Plugin in an existing process

A new plugin can be loaded by an existing server process by adding the plugin’s python script to the list of scripts it loads on startup. This can be a bit tricky, but a bit below the PLUGIN_TYPES line each process is defined in the following format (combat process example):

  if [ $verbose -gt 0 ]; then
      echo -en "Starting combat server: \t"
  java \
      $JAVA_FLAGS \
      -Datavism.loggername=combat \
      atavism.server.engine.Engine \
      -i "${AO_BIN}"/ \
      -i "${AO_COMMON_CONFIG}"/ \
      -i "${AO_WORLD_CONFIG}"/ \
      -t "${AO_COMMON_CONFIG}"/typenumbers.txt \
      "${AO_COMMON_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
      "${AO_COMMON_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
      "${AO_COMMON_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
      "${AO_COMMON_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
      "${AO_COMMON_CONFIG}"/ \
      "${AO_WORLD_CONFIG}"/ \
  write_pid combat $!

The new python script filename needs to be added to the list of python scripts for the process the plugin should belong to.