If you have played Dark Ritual enough, you may have realised that it consists of static and random levels which are delivered alternately. This tool allows you to create new static levels or edit the existing ones that come with the game. Defining a level is accomplished in four easy steps:
Once done, you can save the map and recompile the game and start playing. So let’s get going! In addition to downloading the level editor itself, you should also download the Dark Ritual source code.
Typically, you will want to add levels to the existing game’s collection. This can be done by selecting the Load option from the File menu.
Navigate to the Dark Ritual source code you downloaded earlier and locate the Maps.h file under the /src/maps directory. Highlight the file and click Open.
Once you have loaded the file, you can browse the existing maps under the Maps menu. The map currently being viewed (and edited) is denoted by having a tick beside it. Maps are played in the order they appear in the list and you will notice that you can move a map up or down in the list using the Move menu options.
Additional maps can be added to the collection by clicking the Add Map option from the Maps menu. This will reveal the Add a New Map dialogue as shown below.
Maps must be given a unique name that is also a valid C++ variable name, ie. it must start with a character or underscore and can only contain characters, numbers and underscores. Maps are limited to a width and height of 40 but really this is not really a limitation as that is a huge map! The Timer setting denotes the amount of time a player has to complete the level with any left-over time rewarded as points. The timer range is between 0 and 255 – the default value of 200 is typically enough for most medium complexity maps.
Once the map is defined, you can add tiles and maps using the tools at your disposal. Note that in addition to the tools on the menu, you can right click on elements of the map to reveal a context menu that allows you to interact with the tile or sprite below it. Furthermore, a handy list of the most recently used tiles and sprites is available to speed up the development process.
It is important to note that the maps are not validated! You will need to adhere to the following guidelines.
Maps should:
A number of the tiles require a brief description:
Altar
or Random
to provide some variation in the map so it is advised to place a number of the Random
chests about. Also note that the player only needs six altar pieces to win so use them sparingly.A number of the tiles can interact with each other. These combinations include Lever/Spear Door
, Lever/Exploding Barrel
, Press Plate/Door
and Worm Hole/Worm Hole
.
A simple example of a switch
and spear door
is shown below. You may have noticed in the Tiles list that there are two columns named IsSender
and IsReceiver
which denotes whether the tile is something a player interacts with (the sender) or its state is altered by the action (the receiver).
In the image below, the highlight Spear Door
tile is a receiver of an action. A few lines below that you can see that the Worm Hole
is marked as both a sender and a receiver as two worm holes can be configured to provide bidirectional travel.
The actions between tiles are defined on the Connections tab. The connection defines a link from the sender to the receiver and is simply created by highlighting the corresponding tiles in this order. As you add connections, they are validated in the right-hand side list. Adding a connection between unrelated tiles or even from receiver to sender (ie backwards) will result in an invalid connection.
Worm Holes
can be configured as uni- or bi-directional by adding a single or multiple connections. Note in the example below that two connections have been added with the start X/Y and end X/Y reversed.
The final step to creating a level is to define the player’s starting position. This can be achieved by selecting the Player Start tab and then clicking on the position within the map. Once the starting position has been selected, it will be highlighted by a blue square.
Once you have completed your map design, you can save the changes by selecting Save from the File menu. You are now ready to recompile the game with the new maps in place for testing .. I am going to assume you know how to compile a Pokitto progam using FemtoIDE or your favourite toolset. If not contact me and I will help you!