Haaru Map Extension

From LSWiki

Jump to: navigation, search



The map extension can make short work of creating a new area. Below I will go through what I've learned about the map extension while trying to create my first area. Everything should be taken with a grain of salt, but all in all I think most of what I'll say is pretty accurate. I'm sure there's a lot I'm missing though. If you know something that will help other developers create better areas, please add it. This is a work in progress.

Extension Setup

The first thing you'll need to do is create your project directory structure. This is easily done by using the perform project setup command. After you create your project directory structure you'll want to create your daemon control and set it to use the map extension. This file should be created in <project>/dmn/ and named control.c.

Here is an example of a control.c file:

#include <Army_Ant_Colony.h>
#include <daemon.h>

inherit "/std/daemon";
inherit "/mod/daemon/broker";
inherit "/mod/daemon/control";

void configure() {

    // Set the definition files the daemon should use
    // when using the map extension.
        Army_Ant_Colony_Definition("map_*") : 0,
        Army_Ant_Colony_Definition("map_*") : 0,

    // Add the map extension and set it up.
    add_extension(LS_Extension("map"), (:
        // Set the base room to use.
        // Set the prefix the map extension should use when generating rooms.
        // This instance will generate rooms in the folloing format 'map_x_y_z'.  eg: map_0_-2_1
        // This setting actually happens to be the same as the default.
        // Set the map configuration file.  This is the file where you actually draw the ascii map.
        // Set the maps directionality level.  Basically how many directions you want to map to use.
        // See /lib/map.h for all defined directionalities.

Reverse Engineering the Army_Ant_Colony.h

I see this skipped in almost every developer example/publication I've looked through, and it's fairly critical to proper function/development, and really understanding some of what is going on by reference here. To be clear, I'm not a dev on LS and I can't actually see this, so this is based on what I expect should be in this file.

#ifndef _Army_Ant_Colony_Included
  #define _Army_Ant_Colony_Included
  #define Army_Ant_Colony               "/d/Almeria/Cimbra/Army_Ant_Colony/"
  #define Army_Ant_Colony_Daemon(x)     (Army_Ant_Colony + "dmn/" + x)
  #define Army_Ant_Colony_Definition(x) (Army_Ant_Colony + "def/" + x)
  #define Army_Ant_Colony_Data(x)       (Army_Ant_Colony + "dat/" + x)
  #define Army_Ant_Colony_Room(x)       (Army_Ant_Colony + "rms/" + x)
  #define Army_Ant_Colony_Misc(x)       (Army_Ant_Colony + "etc/" + x)

Creating your definitions

The next thing you'll probably want to do is create your definitions. Your definitions rely mostly on the file /std/def/map_feature. I would recommend reading it. There are currently only two map feature types.

  • Map_Feature_Type_Area
  • Map_Feature_Type_Overlay


The area type is probably best described as a sort of base room type. Say a tunnel, room, wall, etc. If everything unique about the area is removed what would be left. Below are some areas that I used in my project.


Here are the contents of the map_area_tunnel.c file.

#include <Army_Ant_Colony.h>
#include <room.h>

inherit Army_Ant_Colony_Definition("Map_Area_Base");

void configure() {
    // The name of the map feature.  This should match the name of your file after the "map_area_" prefix.
    set_map_feature_summary("a tunnel");

    // Here you can specify what will be displayed for this room when using the map tool.  VERY HANDY!

    // Here you specify the UNIQUE character associated to this map area.  This is used when you actually create your map.
        "This is a tunnel made from {{yellow}sand} and {{brown}mud}.  The walls have large gash marks "
        "in them where it seems as though something or someone has dug its way through the "

    // What adjacent rooms will display in their description of what is next to them.
    set_map_feature_adjacency("%t is a tunnel.");
        ({ "marks" }) :
            "The marks are clearly made from the ants that inhabit this colony.  "
            "The size of the gashes are a clear reminder of how dangerous these creatures are.",
    // Set how the room is accessed. 

    // Here I specified that to access this room type from above or below you would have to tunnel.
    // This allows me to have tunnels on every Z axis with out interfering with each other.
        Direction_Up	: Map_Access_Tunnel,
        Direction_Down	: Map_Access_Tunnel,

    // Here I specified that in order for anyone exiting this room going up or down, they will have to tunnel.
    // By default the access is determined by the room you're going to, but this function allows you to override that.
        Direction_Up	: Map_Access_Tunnel,
        Direction_Down	: Map_Access_Tunnel,

    // Here I specify that in this rooms description, I don't want to see what is above or below me.
    // This is so people don't see a tunnel above or below this tunnel, since there's supposed to be earth
    // between them.  You can of course accomplish all this with an actual whole Z axis between tunnels, but
    // that would require twice as many Z axises.

I would recommend looking in /lib/map.h for the different types of Map_Access_* that are available. Also good is /lib/terrains.h to see what types of terrains are available to use. Look at other area definition files for more examples of different types of terrains. I learned a lot from looking at the Hanoma, Liathyr, and River Tethys areas.


Here is where the detail goes into your map. You can use overlays to place descriptions, abstract items, content, etc into rooms.

Here is an example of an overlay I used for adding mushroom patches to some of the rooms.

#include <Army_Ant_Colony.h>
#include <room.h>

inherit Army_Ant_Colony_Definition("Map_Overlay_Base");

void configure() {
    set_map_feature_name("mushroom patch");

...to be continued.

Personal tools