Skip to content

Coding conventions

Project-wide style rules. Most are enforced by review; a few are project rules used by coding agents (see Glossary — project rules).

Naming

Standard Unreal prefixes:

Kind Prefix Example
Actor A ARune, ARuneCalculator
UObject (non-actor) U URuneDataAsset, URuneEffectComponent
Struct (USTRUCT) F FSentence, FEffectRecord
Interface I / U (the C++ class is I*, the reflection class is U*) IInteractableInterface / UInteractableInterface
Enum E EWordType, EClockState
Template T TArray, TSubclassOf

Booleans: bSomething (lowercase b, then PascalCase). Method names PascalCase. Member fields PascalCase, no Hungarian, no leading underscore.

Categories on UPROPERTY and UFUNCTION group fields in the editor — pick a meaningful one. Category = "Misc" is a smell.

Logging

Project logging rules (AGENTS.md / convention_check):

  • One line per event, no multi-line state dumps.
  • Prefix with the owning class for grep-ability: UE_LOG(LogTemp, Log, TEXT("RuneCalculator: activated %s"), *Sentence.ToString()).
  • Use Log or Verbose for routine status. Reserve Warning for actual problems and Error for failures.
  • Use GetActorNameOrLabel() for actor names — returns the World Outliner label set by designers, not the internal object name.
  • No emojis, no Unicode decoration, no ASCII art banners (========, >>>, etc.).

To see verbose logs in Play In Editor (PIE): Log LogTemp Verbose in the console.

Comments

  • No comments that restate what the code already says.
  • No // Forward declarations labels above forward-declare blocks.
  • No section divider banners. UE category metadata and natural code grouping are enough.
  • Doc comments for non-obvious behavior, constraints, and extension points. Strip them from trivial getters and self-explanatory members.

File and folder conventions

  • One class per .h / .cpp pair. Small helper structs can share the header of their primary class.
  • Match the file name to the class name (without prefix): Rune.h declares ARune, RuneSlot.h declares ARuneSlot.
  • Headers under Source/Rephrased_Demo/RuneSystem/ are folder-aware; include them with their full relative path: #include "RuneSystem/Components/RuneEffectComponent.h".

Constructor rules

  • Constructors set defaults and create subobjects. Nothing else.
  • Anything that needs the world (GetWorld, spawning actors, querying subsystems) goes in BeginPlay.

Tick

  • Off by default. Turn it on only when you actually need per-frame work.
  • Prefer FTimerHandle + SetTimer for one-shot or periodic logic.
  • Never tick a component that doesn't need to (PrimaryComponentTick.bCanEverTick = false in the constructor).

Editor categories

A few rules of thumb for editor visibility:

  • Designer-tunable: EditAnywhere, BlueprintReadWrite.
  • Engineer-only knob, not for designers: EditDefaultsOnly, BlueprintReadOnly.
  • Runtime state read-only: BlueprintReadOnly (no EditAnywhere).
  • Internal, not exposed in editor: just UPROPERTY() with no editor specifier.

Documentation

  • The TDD is the source of truth higher-ups read. Don't update it casually mid-cycle.
  • The wiki is where engineers expand sections. New systems get a wiki page when they ship.
  • Don't write documentation files that look templated, narrate the code line by line, or use enthusiastic AI-style language.

When in doubt

Match the surrounding code. If the file uses UPROPERTY() raw pointers, do that; if it uses TObjectPtr, do that. Consistency inside a file beats consistency across the codebase.

Change history

  • 2026-08-13 — Gabriel Li — Logging rules cite AGENTS.md / convention_check (no .mdc files in repo).
  • 2026-05-23 — Gabriel Li — Removed Memory/GC section; expanded PIE in logging note.
  • 2026-05-08 — Gabriel Li — Added baseline change history section for weekly wiki maintenance.