You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6d147f4
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+24-21Lines changed: 24 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# AGENTS.md
2
2
3
-
openage is a free-software RTS engine recreating Age of Empires II: `libopenage/` is the C++20 engine, `openage/` the Python package (converter, codegen, nyan integration), glued together by Cython
3
+
openage is a free-software RTS engine recreating Age of Empires II: `libopenage/` is the C++26 engine, `openage/` the Python package (converter, codegen, nyan integration), glued together by Cython
4
4
5
5
## Reference docs
6
6
@@ -11,25 +11,25 @@ Read the docs of the subsystem you touch; link to them instead of duplicating th
-[doc/code/architecture.md](doc/code/architecture.md) — subsystems and data flow, details in its sibling dirs (`event/`, `game_simulation/`, `input/`, `renderer/`, `pathfinding/`, `converter/`)
-[doc/code_style/](doc/code_style/) — C++ by example in [mom.h](doc/code_style/mom.h) and [mom.cpp](doc/code_style/mom.cpp), tabs indent and spaces align; Python is a PEP8 subset
14
+
-[doc/code_style/](doc/code_style/) — C++ by example in [cat.cppm](doc/code_style/cat.cppm) and [cat.cpp](doc/code_style/cat.cpp), tabs indent and spaces align; Python is a PEP8 subset
15
15
-[doc/nyan/](doc/nyan/), [doc/convert/](doc/convert/), [doc/media_convert.md](doc/media_convert.md) — game data and converter
`./configure` creates the build dir in `.bin/`, symlinked as `bin/`; the root `Makefile` forwards there
20
+
`./configure` creates the build dir in `.bin/`, symlinked as `bin/`; the root `justfile` forwards there
21
21
22
22
```sh
23
23
./configure # e.g. --compiler=clang --mode=release --ccache --download-nyan
24
-
make -j$(nproc)# build
25
-
make run # run the game
26
-
make tests # all C++/Python tests and doctests, as CI runs them
27
-
make checkmerge # compliance checks, as CI runs them
28
-
make doc # doxygen → bin/doc/html/index.html
24
+
just build# build everything
25
+
just run # run the game
26
+
just tests # all C++/Python tests and doctests, as CI runs them
27
+
just checkmerge # compliance checks, as CI runs them
28
+
just doc # doxygen → bin/doc/html/index.html
29
29
```
30
30
31
31
- Single test: `bin/run test NAME`, e.g. `openage::curve::tests::container`; `-l` lists all, `-d NAME ARGS` runs a demo, `-b NAME` a benchmark, `-a --have-assets` includes tests needing game assets
32
-
- Checks on changed files only: `make checkuncommited` (sic; vs `HEAD`, new files count once `git add`ed) or `make checkchanged` (vs `origin/master`)
32
+
- Checks on changed files only: `just checkuncommited` (sic; vs `HEAD`, new files count once `git add`ed) or `just checkchanged` (vs `origin/master`)
33
33
-`checkfast`: authors, cppstyle, cython, headerguards, legal, filemodes, textfiles; `checkmerge` adds ruff (lint + format) and ty (type check), run through `uv run` (venv from pyproject.toml/uv.lock); `checkall` adds clang-tidy
34
34
- Memory or threading changes: also run the tests in a build configured with `--sanitize=yes` (ASan+UBSan) or `--sanitize=thread`
35
35
- CI also builds on macOS and Windows ([.github/workflows/](.github/workflows/)): keep code portable
@@ -48,11 +48,12 @@ make doc # doxygen → bin/doc/html/index.html
48
48
49
49
Non-obvious traps; add new ones here, verified and in one line
50
50
51
-
- In-source builds are forbidden and poison the tree; `make cleaninsourcebuild` removes the traces
52
-
- Run Python only via `bin/run ...` or `make run`, never `python3 -m openage` in the source tree: compiled Cython modules and `openage/config.py` live in `bin/`
53
-
- Never edit files in `bin/`, they are generated: `config.*` from `*.in`, `*.gen.{h,cpp}` from `openage/codegen/` and `*.template`, `libopenage``.pxd` files from `pxd:` annotations in C++ headers; codegen trouble: `make cleancodegen`
54
-
- nyan is a separate project: build it and point to it with `-Dnyan_DIR=`, or `./configure --download-nyan`
55
-
- C++20, but the minimum compilers are gcc/clang 10 and MSVC 16.8 (`buildsystem/CheckCompilerFeatures.cmake`): check support before using newer library features like `std::format`
51
+
- In-source builds are forbidden and poison the tree; `just cleaninsourcebuild` removes the traces
52
+
- Run Python only via `bin/run ...` or `just run`, never `python3 -m openage` in the source tree: compiled Cython modules and `openage/config.py` live in `bin/`
53
+
- Never edit files in `bin/`, they are generated: `config.*` from `*.in`, `*.gen.{h,cpp}` from `openage/codegen/` and `*.template`, `libopenage``.pxd` files from `pxd:` annotations in C++ headers; codegen trouble: `just cleancodegen`
54
+
- Reconfigure with `./configure` or `cmake -B .bin/<config>`, never through the symlink (`cmake bin`): the changed build dir path rebuilds everything
55
+
- Put `import`s after the last `#include` of a file (the `cppstyle` check enforces it): GCC rejects textual definitions after an import of the same entities; standard headers are exempt because GCC builds translate them into the `<bits/stdc++.h>` header unit of [StdHeaderUnit.cmake](buildsystem/StdHeaderUnit.cmake)
56
+
- C++26, but the minimum compilers are gcc 16 and clang 21 (`buildsystem/CheckCompilerFeatures.cmake`): check support before using newer library features like `std::format`
56
57
57
58
## Working
58
59
@@ -65,8 +66,8 @@ Non-obvious traps; add new ones here, verified and in one line
65
66
- Keep diffs focused: no drive-by refactors, reformatting, renames or "improvements" outside the task
66
67
- Fail hard: throw/raise on unexpected state instead of skipping, logging and continuing, or returning a default
67
68
- Trust the code over comments and docs; fix stale comments in code you touch
68
-
- Done means it builds, the relevant tests pass and `make checkmerge` is clean; state what you could not verify, e.g. without game assets or GPU
69
-
- Scratch files go to `/tmp`, never into the tree
69
+
- Done means it builds, the relevant tests pass and `just checkmerge` is clean; state what you could not verify, e.g. without game assets or GPU
70
+
- Scratch files go to `/tmp/openage-agent`, never into the tree
70
71
71
72
## Code
72
73
@@ -83,9 +84,10 @@ Non-obvious traps; add new ones here, verified and in one line
83
84
84
85
## C++
85
86
86
-
- Style by example ([mom.h](doc/code_style/mom.h), [mom.cpp](doc/code_style/mom.cpp)): `this->` for members, `{}` initialization, braces on every block, Doxygen API docs in the header, forward declarations in headers, sorted include groups
87
-
- Every `.h` has a `.cpp` that includes it first, even if otherwise empty; header guard `#pragma once`
88
-
- Register new `.cpp` files and directories in the local `CMakeLists.txt` (`add_sources(libopenage ...)`, `add_subdirectory`)
87
+
- Style by example ([cat.cppm](doc/code_style/cat.cppm), [cat.cpp](doc/code_style/cat.cpp)): `this->` for members, `{}` initialization, braces on every block, Doxygen API docs on the exported interface, sorted include groups
88
+
- New code is a C++ module: usually one `.cpp` holding `export module openage.dir.name;` with interface and implementation (like `libopenage/util/color.cpp`); split off a `.cppm` interface unit only when needed; `#include`s go in the global module fragment, `import`s after the module declaration
89
+
- Legacy headers: every `.h` has a `.cpp` that includes it first, even if otherwise empty; header guard `#pragma once`
90
+
- Register new `.cpp` files and directories in the local `CMakeLists.txt` (`add_sources(libopenage ...)`, module units after `MODULE`, `add_subdirectory`)
89
91
- Integer types per [inttypes.md](doc/code_style/inttypes.md)
90
92
- RAII and smart pointers, no owning raw `new`/`delete`
91
93
- Log with `log::log(INFO << ...)`, throw `Error{MSG(err) << ...}` ([exceptions.md](doc/code/exceptions.md)); no `std::cout`/`printf`, no bare `std::` exceptions
@@ -106,7 +108,7 @@ Write tests where they catch real bugs; the right kind depends on the subject:
106
108
- Data structures, algorithms, math, curves, events, pathfinding: unit tests of invariants and edge cases (empty, boundaries, overflow, equal timestamps, queries exactly at, before and after keyframes)
107
109
- Parsers and converter logic: small hand-made inputs; gate tests needing game assets on `has_assets` in the test list
108
110
- Small pure Python functions: doctests, which double as documentation
109
-
- Rendering, GUI, input wiring and other interactive code: usually no automated test; verify with a demo or `make run` and say so
111
+
- Rendering, GUI, input wiring and other interactive code: usually no automated test; verify with a demo or `just run` and say so
110
112
- Performance claims: measure with a benchmark (`bin/run test -b NAME`)
111
113
- Bug fixes: a regression test that fails without the fix, where the subject is testable as above
112
114
- Test observable behavior and contracts, not implementation details; no tests that restate the code or depend on timing, network or user interaction
- Update `doc/` when behavior, interfaces or file formats change
126
+
- Write token-lean docs => write concisely and avoid verbosity
124
127
- Write for the reader, not as a record of decisions or attempts
125
128
- Markdown: one sentence per line
126
129
127
130
## Commits
128
131
129
132
- Message `subsystem: summary`, e.g. `convert: ...`, `renderer: ...`; the body explains what and why, concisely
130
133
- One logical change per commit; squash fixups before review ([contributing.md](doc/contributing.md#rebasing))
131
-
- New source files start with `// Copyright <year> the openage authors. See copying.md for legal info.` (`#` in Python and CMake) and have mode 0644; don't bump years in existing headers
134
+
- New source files start with `// Copyright <year>+ the openage authors. See copying.md for legal info.` (`#` in Python and CMake) and have mode 0644; don't bump years in existing headers
132
135
- Commit authors must be listed in [copying.md](copying.md) (authors check)
133
136
- Never commit generated files, build output, converted assets or scratch files
134
137
- Never push, force-push, open or comment on PRs without explicit consent
0 commit comments