Map Generator Style Guidelines

Since many developers are involved in the project, it is necessary to define some style guidelines for map generator code. Please adhere to these style guidelines if you are creating landscapes, so that other developers can read your code more easily. You will notice that clearly written code allows you to change specific things more easily and that you'll be able to learn from that code.

Example

Here is a detailed example of a well styled Landscape.txt file.

/*--
	Scenario title
	Author: John Doe

	Short description of the landscape.
--*/

// Short comment on what this template does.
overlay Template {
	algo=rndchecker; a=8;
	zoomX=-50; zoomY=-50;
	turbulence=100; loosebounds=1;
};

map Landscape {
	overlay {
		mat=Earth; tex=earth;
		algo=sin;
		zoomX=60; zoomY=35;
		ox=25; oy=35;
		Template { mat=Gold; tex=gold; };
		Template { mat=Rock; tex=rock; };
	};
};

Guidelines

Naming conventions:

  • Use
    CamelCase
    for names of overlays and maps.
  • Try to use meaningful and self explanatory names.

Indents, braces and spaces:

  • Code is indented with one tab.
  • The opening brace is on the same line as the overlay or map.
  • The closing brace is on its own line on the same level as the overlay.
  • There is no whitespace around the
    =
    operator.

Misc:

  • Use comments wherever you feel it is necessary to improve the understanding of your code.
  • Templates should have a comment which explains what they do.