Repository navigation
Contribution Guide
Thanks for working on Fanalor. The rules below are the ones main is held to. The full naming and layout note is docs/CONVENTIONS.md. The engine's design decisions live in docs/ARCHITECTURE.md.
Branch off main. Do not commit directly to main.
| Prefix | Use |
|---|---|
feature/<topic> |
New behaviour |
fix/<topic> |
A bug |
refactor/<topic> |
A restructure that does not change behaviour |
docs/<topic> |
Documentation only |
Open a pull request into main.
Conventional Commits. The scope is the crate without the fanalor- prefix. The subject is imperative, has no trailing period, and is at most 50 characters. A body is for the why, when the diff does not show it.
feat(render): add render pipeline and WGSL shader loading
fix(core): skip redraw while the window is minimised
docs(architecture): record wgpu 30 API differences
Types in use: feat, fix, docs, refactor, perf, test, chore.
Naming follows RFC 430 and the Rust API Guidelines.
| Item | Case | Example |
|---|---|---|
| Package | kebab-case | fanalor-render |
Directory under crates/
|
the same string | crates/fanalor-render/ |
| Module, file, function, field | snake_case | gpu_context.rs |
| Type, trait, enum variant | UpperCamelCase | GpuContext |
| Constant | SCREAMING_SNAKE_CASE | MAX_FRAMES_IN_FLIGHT |
| Shader | snake_case .wgsl
|
flat_color.wgsl |
Acronyms are one word: GpuContext, not GPUContext. The package fanalor-render is imported as fanalor_render. Do not rename the package to match the import. Crate names do not carry a -rs or rust- suffix.
- The workspace root stays a virtual manifest. No
src/at the root. - Every third-party version lives in the root
[workspace.dependencies]. Members usedep.workspace = true. -
winitonly infanalor-core.wgpuonly infanalor-render.cpalandsymphoniaonly infanalor-audio.tungsteniteonly infanalor-net. - No third-party ECS, scene-graph, or engine-framework crate. The egui wgpu backend in
fanalor-renderis ours because the published one is pinned to an older wgpu. - One concept per file. Split a module into a directory around 300 lines or when a second concept appears. Prefer
foo.rsplusfoo/overfoo/mod.rs. - Public items have a
///doc comment. Crates set#![warn(missing_docs)], and clippy denies warnings, so a missing comment fails the build. - No
unwrap()outside tests.expect("why this cannot fail")when the invariant is real. - Log through the
logcrate. See Logging. - Handle the empty, resized, and despawned cases in the same change. Do not fail silently.
- The engine is 2D. Do not add a depth buffer, a 3D transform, or an unused axis "for later". Sorting is
sort_orderand sorting layers.
GPU, editor UI, and audio code should be checked against the vendored crate sources or current docs before it is written. wgpu 30, winit 0.30, egui 0.35, cpal 0.18, and symphonia 0.6 do not match older tutorials. Lasting findings go into docs/ARCHITECTURE.md.
cargo fmt --all
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspaceScope clippy and tests to the crates you touched while iterating. Run the workspace before the PR if the change is on a shared surface. A warning that is genuinely a false positive gets an #[allow(...)] on that item with a comment, not a crate-wide allow.
If the change is on a hot path, compare benchmarks. See Testing Guide.
cargo xtask bench --runs 3 --compare target/bench/base.jsonIf the change is user-facing, update the matching chapter under docs/guide/ and run cargo xtask guide. The guide's <!-- ci --> blocks are the commands CI will run.
The pull request template asks for a summary, the public types and file formats that moved, the design and any prior art (Unity, Unreal, Godot, Bevy) you adopted or rejected, and how you verified it. Delete sections that do not apply.
- Fork, branch from current
main, and open the PR againstmain. - Describe the behaviour change and point at the tests that pin it.
- A review that asks for a different shape is about the design in
docs/ARCHITECTURE.md, not about taste in isolation. Record a lasting decision there.