Use these naming rules unless a local file or subsystem already has a stronger established pattern.
- Prefer simple names over ornamental ones.
- Prefer one-word names when the file or type already gives enough context.
- Avoid unnecessary prefixes like
kfor constants. - Avoid unnecessary namespaces for game-specific code unless there is a real collision risk.
- Use
PascalCasefor structs and classes. - Examples:
Level,Position,Window,Scene
- Use
camelCasefor fields, locals, parameters, and functions. - Examples:
playerSpawn,enemySpawns,hasBonusLife,keyGolds,setPosition
- Prefer names that read naturally as booleans.
- Examples:
hasBonusLife,isVisible,isFullscreen
- Prefer scoped constants instead of generic global constants.
- For type-specific dimensions, prefer
static constexprinside the type. - Use uppercase names for constants.
- Example:
struct Level {
static constexpr int WIDTH = 32;
static constexpr int HEIGHT = 22;
};- Access them as
Level::WIDTHandLevel::HEIGHT.
For klad1 level data, prefer:
LevelPositionidexitplayerSpawnenemySpawnshasBonusLifekeyGoldsunknowntiles
- Choose clarity first.
- Keep names short when context already makes them clear.
- Do not introduce more abstraction or ceremony than the code actually needs.