Map Editor

From Hero of Allacrost Wiki
Jump to: navigation, search


The Allacrost map editor is written in C++ using the Qt GUI library. Like the game itself, the editor is cross-platform and supported on Linux, OS X, and Windows.


The editor code is largely independent and stands alone from the game engine and logic. The editor does make use of the ScriptEngine, however, in order to read map files and save current map data to map files. It also includes the common utility code.

Code Deviations

Because of the heavy use of the Qt library, the editor purposefully breaks some of the conventions set out in the Code Standard. Particularly, the use of int types is permitted and several functions do not follow our CamelCase naming format. The editor code follows the Allacrost code standard whenever possible, but doesn't go to extreme lengths to adhere to this document. Most often, the standard is not followed when needing to conform to a Qt function signature or inheriting from and extending a Qt class.

The editor also avoids the usage of some of the common utility code found in Allacrost. For example, you will not find the ustring class used anywhere in the editor code. Instead, QString's are used and serve the same purpose. The editor does not use the print debugging macros like IF_PRINT_WARNING(...), as qDebug() calls are used in their place.


All source code files for the editor are contained in src/editor. Unlike many other components of the Allacrost code, the editor files do not all necessarily begin with the word "editor". The table below lists each file name (minus .h/.cpp extension) and what classes that file contains. A brief explanation of each class is also provided.

File Name Class Name Class Purpose
dialogs NewMapDialog Asks the user to select properties and tilesets for a new map file editor Editor The main window class that creates all other widgets and allows them to communicate together
map_view MapView An abstract class for representing a sprite action
map_data MapData Represents dialogues between characters on a map
tile_context TileContext A collection of TileLayer objects and properties that represents a context on the map
tile_context TileContextView The widget in the right middle area of the editor window that allows the user to add, update, and delete map contexts
tile_layer TileLayer A wrapper class around a 2D vector containing integers that implements common layer operations
tile_layer TileLayerProperties Contains a small number of properties about a tile layer, applicable across all contexts
tile_layer TileLayerView The widget in the upper right corner of the editor window that allows the user to add, update, and delete layers of tiles
tileset Tileset Represents the image and collision data loaded from a tileset definition file
tileset TilesetView The widget in the bottom right corner of the editor window that allows the user to view and select tiles from loaded tilesets
tileset_editor TilesetEditor A dialog window that allows the user to open a tileset, edit the collision properties for each quadrant, and save it back to the tileset definition file