Coding convention - nikoladimitroff/GiftOfTheSanctum GitHub Wiki
Coding convention
Discipline makes perfect so please abide the following convention
Getting started
Remember to install your git hooks in order to automate most of the process.
Code
- Adhere to Google's naming convention (except for filenames!, see next bullet)
- Use snake_case for all filenames. (i.e. my_fireball_image.png)
- Limit your lines to 80 characters.
- Use 4 spaces (not tabs) for indentation.
- Never commit trailing spaces.
- All game-specific code must be inside the
sanctum
namespace. - Prefer code that runs inside the main game loop as opposed to async callbacks. This is rule's only exception is content loading.
- Prefer composition over inheritance.
- Prefer not to include 3rd party libraries if you have the chance.
Commits
- Each and every git commit must begin with one of the following tags and and
short explanation of the work done:
- [Feature]
- [Enhancement]
- [Fix]
- [Content]
- [Refactor]
- [Tools]
- If your commit matches more than 1 category, include all of them.
- If no category fits your commit either add the category here or use a wildstar (
*
). - The commit message must be a complete English sentence.
- For bigger commits, write a detailed description using bullets (see example).
These are valid messages:
[Fix] Doing that thing no longer causes that other thing to break.
* Fixed typos in the docs of PlayerManager
[Feature] Implemented a pooling system.
* Removed code that was colliding with the pooling system.
* Added a static global "Pool" object that lets you create and release objects.
* Added the following configuration settings:
- MaxObjectsPerPool - limits the maximum number of currently active objects of the same time
- OptimizeForSpeed - causes the system to use more memory in order to achieve better CPU performance.
Architectural notes
The game is heavily data-driven so try to stick with that. Prefer dumb data objects and smart managers over smart data objects and dumb (if any) managers.