Skip to content

Code Style Document

Valk edited this page Jul 29, 2025 · 66 revisions

If the following looks overwhelming to you, you can ignore it, I will try my best to refactor your PRs to conform to these standards.

Principles

Please familiarize yourself with these principles.

General Guidelines

Formatting

  • Indentation: 4 spaces.
  • Line Endings: LF.
  • Curly Braces: Always expand unless the expression(s) / statement(s) are short.
  • Using Directives: Above namespace.

Naming

  • PascalCase: Types, methods, properties, constants, events.
  • camelCase: Private fields, local variables, method args.
  • Private fields: Always prefix with an underscore.
  • Events: Avoid prefixing events with On as subscribers should use this instead.

Language Features

  • Private Static Functions: Use when possible.
  • var Keyword: Never use unless the type is absurdly long.
  • C# Events: Always use over Godot signals.
  • Static Events: Never use static events unless you set them to null on tree exit.
  • Explicit Private Modifiers: Always specify private.
  • File Scoped Namespaces: Always use.

Order of Code

Variables or functions that are public should be above private ones.

  1. Variables with the [Export] attribute
  2. Events
  3. Properties
  4. Fields
  5. Godot Functions
  6. Functions
  7. Private Static Functions

Clone this wiki locally