Dynamic Map Generator

Revision as of 16:41, 9 August 2014 by Newton (talk | contribs) (Dynamic Map Generator)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Dynamic Map Generator

OpenClonk has a dynamic map generator that can be used to generate maps that look different everytime but still have specified recurring patterns, like lava lakes, mountains, or sky islands. The documentation is available in the C4Script reference here. Mape is used to edit and display both Landscape.txts and Map.c.


Screenshot of Mape

Mape is a tool that shows a live preview of the generated mape as the Landscape.txt code is being typed. The tool is available from the Development Snapshots page for all major platforms. Its source code lives in the OpenClonk git repository.

The tool is meant both for beginners and experts alike. Beginners can easily play around with all the possibilities and immediately see their effect on the generated map. Experts can easily tweak the map to their liking without having to restart the engine for every change they make.

The mape window has four panels. The upper right part is the largest one which is where the Landscape.txt code can be edited. The panel to the left of it shows the file system tree. This is where one can select the Material.ocg file to be loaded. This specifies the materials and textures available to the map generator. The loaded materials and textures can be seen at the bottom panel once loaded which provides an easy view to what materials and textures are available. Finally in the lower right corner there is a preview of the generated map which updates as one types. The status bar contains error messages from the Landscape generator in case the Landscape.txt code is not correct.

Tips and Tricks

  • The options allow to specify the width and height of the generated mape. To avoid any surprises, especially when specifying parameters with pixels instead of percentages, this should always be set to the same size as the OpenClonk map that one plans to create.
  • In the options there is also the possibility to use a fixed seed for the random number generator. This allows to always create the same map when using the same Landscape.txt code, even if it contains randomness. This can come handy when trying to get a part of the map right and one does not want the rest of the map to change with every keystroke.
  • If the random seed is not fixed, the map preview can be clicked on to generate another version of the map using the same Landscape.txt code but the randomness is re-evaluated.
  • For big maps, rendering the map can take a while, up to a few seconds. This considerably slows down the feedback one gets for changing little things here and there. In this case, one can comment out the parts of the map that one does not work on right now and concentrate only on one specific feature or aspect of it, and then put it all together in the end.
  • For overlays that use algo=script, the Script.c file that contains the script function that is being evaluated by the algorithm needs to be in the same directory as the Landscape.txt file. Therefore the Landscape.txt file must be saved at least once before algo=script can be used, so that mape knows where to look for the Script.c file. The landscape preview does not update automatically when the Script.c file is changed, but a simple click on it re-generates it.

Bug Reports and Feature Requests

Bug Reports and Feature Requests can be reported in the bug tracker. There is a category for mape.