Tutorial: Map Generator - Algorithms & Transformations

Revision as of 16:59, 23 November 2010 by Maikel (talk | contribs) (Created page with "Explain algorithms, they can be found [http://docs.openclonk.org/en/sdk/scenario/MapCreatorS2.html#Algos here] in the map generator documentation. ==Alternative checkers board=…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Explain algorithms, they can be found here in the map generator documentation.

Alternative checkers board

An alternative solution to the exercise in the previous part of this tutorial is to use an algorithm. We need the checker algorithm, which creates an overlay consisting of alternating boxes of size ten. The problem we then still have is that we have a full checkers board, which we want to reduce to half its size. For this purpose we can use the attributes zoomX and zoomY to zoom out by a factor of two. All together results in the following code.

// Checker algorithm at work.
map ExampleChecker {
	mat=Gold; tex=gold;
	overlay {
		mat=Rock; tex=rock;		
		algo=checker;
		zoomX=50; zoomY=50;
	};
};

Convince yourself that this produces the same landscape as in the exercise. We encounter here a major advantage of algorithms, they reduce the amount of overlays needed drastically.