Map Generator Style Guidelines: Difference between revisions
No edit summary |
|||
Line 37: | Line 37: | ||
Misc: | Misc: | ||
* Use comments wherever you feel it is necessary to improve the understanding of | * Use comments wherever you feel it is necessary to improve the understanding of your code. | ||
* External overlays should have a comment which explains what | * External overlays should have a comment which explains what they do. |
Revision as of 18:16, 12 January 2011
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 the overlay does. overlay External { algo=rndchecker; a=8; zoomX=-50; zoomY=-50; turbulence=100; loosebounds=1; }; map Landscape { };
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.
- External overlays should have a comment which explains what they do.