Map Generator Style Guidelines: Difference between revisions
m Created page with "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 crea…" |
No edit summary |
||
Line 1: | Line 1: | ||
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. | 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== | ===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 <code>CamelCase</code> 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 <code>=</code> operator. | |||
Misc: | |||
* Use comments wherever you feel it is necessary to improve the understanding of others. | |||
* External overlays should have a comment which explains what it does. |
Revision as of 17:09, 11 December 2010
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 others.
- External overlays should have a comment which explains what it does.