|
| 1 | +# Project Conventions |
| 2 | + |
| 3 | +## Tech Stack |
| 4 | +- **Language**: C++17, compiled with GCC/clang via AMBuild |
| 5 | +- **Platform**: Linux (TF2 dedicated server), Source Engine (SDK 2013) |
| 6 | +- **Build system**: AMBuild (Valve's meta-build system) |
| 7 | +- **Plugin model**: SourceMod extension (.so), loaded at server start via meta-mod |
| 8 | + |
| 9 | +## Architecture |
| 10 | +- `rcbot2/` — main bot plugin code |
| 11 | +- `rcbot/` — legacy bot base (being migrated away from) |
| 12 | +- `botutil/` — schedule tasks and utilities (shared across bot types) |
| 13 | +- `sm_ext/` — SourceMod extension glue |
| 14 | +- Navigation: dual-backend — waypoint navigator (`CWaypointNavigator`) and navmesh navigator (`CNavMeshNavigator`), both implementing `IBotNavigator`. The active navigator is chosen per-frame via `rcbot_use_navmesh` ConVar. |
| 15 | + |
| 16 | +## Naming Conventions |
| 17 | +- Classes: `C` prefix (e.g., `CBot`, `CNavMeshNavigator`) |
| 18 | +- Members: `m_` prefix (e.g., `m_pBot`, `m_route`) |
| 19 | +- Pointers: `p` prefix (e.g., `pBot`, `pAcc`) |
| 20 | +- Globals: `g_` prefix (e.g., `g_pNavMeshAccessor`) |
| 21 | +- ConVars: `rcbot_` prefix, snake_case (e.g., `rcbot_debug_navmesh`) |
| 22 | +- Booleans: `b` prefix (e.g., `bFound`, `m_bReady`) |
| 23 | + |
| 24 | +## Patterns |
| 25 | +- Raw pointer-based graph (no smart pointers in navmesh code) |
| 26 | +- `CBot::setMoveTo()` is the sole output for locomotion — the navigator writes to it |
| 27 | +- `engine->Time()` for all time comparisons (not system time) |
| 28 | +- `fprintf(stderr, ...)` for debug logging, gated by debug CVars |
| 29 | +- `ifdef` guards for game-specific code (`#if SOURCE_ENGINE == SE_TF2`) |
| 30 | + |
| 31 | +## Map Lifecycle |
| 32 | +- Plugin load → `CNavMeshAccessor::init()` (sigscan once) |
| 33 | +- Map start → lazy `scanGrid()` on first `getNearestArea()` |
| 34 | +- Map end → `invalidate()` clears all cached areas |
| 35 | +- No persistence between maps |
0 commit comments