World Definition HowTo


The goal of this howto is to illustrate how to edit the world of the cyphesis server.

World files

Worlds are defined as python script files. These script files are under the rulesets/$(GAME) directory under cyphesis source, and are installed under $(PREFIX)/share/cyphesis/rulesets/$(GAME)/etc/cyphesis/$(GAME). The current game is mason, and the current world file is


The methods that modify the world use a common pattern:

def test_settler(mapeditor):


They receive as a parameter a mapeditor, which is passed to the constructor of editor. This is because we will call methods of this map editor to actually affect the world.


In Atlas and Cyphesis, 1 unit is 1 meter. The terrain is defined in a Mercator map with a grid unit of 64 meters. That means that we will define the base points of the terrain on a scale of 64 meters. The point (1,1) in the Mercator grid is point (64,64) in cyphesis.

The Mercator grid is defined as follows:


    points = { }

    points['0x0'] = [0, 0, 12.8]
    points['1x0'] = [1, 0, 23.1]
    points['0x1'] = [0, 1, 14.2]
    points['1x1'] = [1, 1, 19.7]

    m.set(, terrain={'points' : points}, name="moraf")

Here we are setting a python map of triplets. The key of the map is the grid coordinate, and the value is a list of coordinates: x, y and z (height). This way it's easier to index.

Note that m is used to retrieve the world and to set the terrain of the world.


Creating static things is as easy as simply adding them to the world. Here we see how to add a tree:


This line adds a fir tree to the center of the map.


Creatures have artificial intelligence, which is represented by knowledge and goals. Knowledges are pieces of information that the entities know about. For example, this is the knowledge of a dog:


The components of a knowledge are name, predicate and value. There are many different types of knowledge that will be covered on a different HowTo.

Goals are the objectives of the creature. Here are the dog goals:

           (il.patrol,"patrol(['d1', 'd2', 'd3', 'd4'])")]

Here, the forage goal means that the dog will eat ham if he sees it. The hunt goal means he will hunt squirrels, as all good dogs should. The patrol goal means that it will travel those points (defined in its knowledge), mostly looking for ham to eat and squirrels to hunt.

Knowledges and goals can be defined out of the methods (as they are just python variables).

To add the entities to the world, we do:

    dog = m.make('toby',type='dog',xyz=(5,5,town_height))

Here we are creating a dog and assigning it some knowledge and some goals. Also we set priorities for the goals, the dog will prefer hunting squirrels over everything else. After this, now the dog will act autonomously within the world.

//TODO: a page with the list of goals explaining them, what are the requirements in the arguments of m.make?

Authors: Miguel Guzmán
Last Updated: 2005-12-06