Table of Contents
- Code formatting
Uncrustify code formatter
A C# compatible Uncrustify configuration is being investigated, however at the moment no such support is available.
Curly brackets should always be on a new line
Curly brackets are always required, even for single-expression statements.
General naming rules
- Use meaningful variable and type names never use inappropriate language like crap, shit
- All names and comments should be in American English.
- Avoid non common abbreviations.
- Do not write “2” and “4” as replacement for "to" and "for".
Name of a namespace should be in PascalCase.
Always use namespaces to indicate a larger subsystem of the engine, to avoid cluttering the root CryEngine namespace.
Name of a class should be in PascalCase, without any prefixes.
Name of an interface should be in PascalCase, prefixed with 'I'.
Name of an enum should be descriptive and written in PascalCase. Enums and their values should not utilize prefixes.
Name of a function should be in PascalCase.
Always use Properties for simple get / set functionality.
Name of a field should always be prefixed with _ and a camelCase name. Wherever public fields are required, use Properties with automatically generated backing fields.
Name of a property should always use PascalCase without a prefix.
Whenever a property requires fields, opt for backing fields where possible.
Static class members
Use class members instead of separate managers for finding and manipulating instances.
Every method and property that's either public or protected must have a summary. Summaries are in XML style and always positioned on the line before the object they describe.
The source file should always have the same name as the main type that resides inside it. Split out separate classes into multiple files.
- Define members in the following order:
- Static Methods
Our libraries can never contain unsafe code.
Use the correct loop for the proper context, for example simply iterating data in a container always use foreach.