eme version 0.2a - seme version 0.2
seme (Simple eme) is a map editor based on eme. You don't need to write code to use it: the map format can be defined graphically and the code to load the map in your game can be automatically generated. On the other hand seme is less versatile than a hand made plugin. seme allows you to have map properties and layers of the following types: image, number, boolean, string, color. It cannot handle composite (i.e. properties that contains properties) nor list (currently). The layers must not have holes, which means that you need a "void" tile (for example a transparent image) to fake empty tiles and that more memory will be used. Last the file format is simple, which means that you usually want to compress it (or it would take much place).
To create a new format use "Map Format->New".
The following dialog will appear.
After clicking on the "Tiles" button of the map format dialog, the following dialog appears.
There are some examples and the resulting map. The rectangle sprites are 32x32 pixels and the diamond sprites are 48x23 pixels.
Map Shape=Rectangle, Tile Shape=Rectangle, Tile Width=32, Tile Height=32, Oddness=none, Tile DX=32, Tile DY=32.
Map Shape=Rectangle, Tile Shape=Diamond, Tile Width=48, Tile Height=24, Oddness=left, Tile DX=48, Tile DY=12.
Map Shape=Rectangle, Tile Shape=Diamond, Tile Width=48, Tile Height=24, Oddness=right, Tile DX=48, Tile DY=12.
Map Shape=Diamond, Tile Shape=Rectangle, Tile Width=32, Tile Height=32, Oddness=none, Tile DX=64, Tile DY=32.
Map Shape=Diamond, Tile Shape=Diamond, Tile Width=48, Tile Height=24, Oddness=none, Tile DX=48, Tile DY=24.
Typically:
Map Shape=Rectangle, Tile Shape=Rectangle, Tile Width=w, Tile Height=H, Oddness=left or right, Tile DX=w, Tile DY=h.
If, in the map format dialog, you click on "Add" or double click on a map property, the following dialog appears.
You can name the property (by entering a string in the "Name" field). If you want to use the automatic code generation, remember that all characters not allowed in a C identifier will be replaced by an underscore.
Then, you can choose the map property type by clicking on one of the list items ("Color", "Boolean", "Number", "Datafile object", "String").
For datafile objects and strings, you will need to enter an additional data. Click on the "Data" button.
If, in the map format dialog, you click on "Add" or double click on a layer, the following dialog appears.
You can name the layer (by entering a string in the "Name" field). If you want to use the automatic code generation, remember that all characters not allowed in a C identifier will be replaced by an underscore.
The "Full" and "Sparse" check-boxes are currently not implemented. They may be used, in the future, to allow creating layers with holes (sparse layers) in addition to layers without holes (full layers).
Then, you can choose the layer type by clicking on one of the list items ("Color", "Boolean", "Number", "Datafile object", "String").
For datafile objects and strings, you will need to enter an additional data. Click on the "Data" button.
To export C code for loading your map, in the menu, choose "Map Format->Save C code". The file selection popup will ask you a file name, you can put any extension, it'll be replaced by .c and .h. The file name will be appended to all the defines, typedefs and functions.
Note that strings are UTF-8 strings and are saved in this encoding, so currently your game must use UTF-8 strings.
..._SEME_MAJIK and ..._SEME_VERSION are used to check the map files.
..._MAP contains the map data.
..._MAP { int width, height; ... ..._TILE **tiles; }
width and height are the map size in number of tiles. tiles is a 2d array of tiles. The ellipsis are replaced by the map properties fields. These fields name are the names you gave to the map properties, processed to suppress illegal characters (space, comma, accented characters, etc.).
Example: You created a map format with two map properties: the map description (a string) with name "Description" and a boolean "Is underground". You saved the C file with the name "loader.c", the header file will contain:
typedef struct { int width, height; char *Description; /* String */ int Is_underground; /* Boolean */ LOADER_TILE **tiles; } LOADER_MAP;
The ..._TILE structure contains the various tile data. The fields name are taken from the layers name and processed in the same way as the map property names.
..._load_map loads a map, it returns a pointer to the map structure, or NULL if there has been an error.
..._MAP *..._load_map(const char *fname);
..._destroy_map destroys a map loaded with ..._load_map.
void ..._destroy_map(..._MAP *map);