docs: correct AGENTS.md per review (frame flow, debug aids, host-specific notes)
linux / build (push) Canceled after 0s
linux / build (push) Canceled after 0s
This commit is contained in:
@@ -56,7 +56,8 @@ Practical consequence:
|
||||
* Accepted PR shapes (README): features that exist in at least one GTA, game/UI/UX
|
||||
bug fixes (original-behaviour fixes behind `FIX_BUGS`), platform-specific or
|
||||
unreversed code, accuracy/understandability improvements, new skeletons or
|
||||
compatibility layers, maintainability work.
|
||||
compatibility layers, translation fixes for languages the original game
|
||||
supported, maintainability work.
|
||||
|
||||
Config switches live in `src/core/config.h`. `MASTER` implies `FINAL`; `MASTER`
|
||||
builds drop the debug menu and version text. `VALIDATE_SAVE_SIZE` and `DEBUGMENU`
|
||||
@@ -74,9 +75,9 @@ Quoted/derived from `CODING_STYLE.md` (read the whole file — it is short):
|
||||
no braces around single statements, function return type on its own line.
|
||||
The two accepted shapes are shown at the top of `CODING_STYLE.md`; anything
|
||||
closer to Allman/Whitesmiths is "heavily discouraged".
|
||||
* **Types:** `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `float`, `bool`
|
||||
(typedef'd in `src/core/common.h`; `src/extras/re3_inttypes.h` adds the `PRI*`
|
||||
printf macros for them).
|
||||
* **Types:** `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32` (typedef'd in
|
||||
`src/core/common.h`; `src/extras/re3_inttypes.h` adds the `PRI*` printf macros
|
||||
for them), plus the builtins `float` and `bool`.
|
||||
* "don't use types like `__int16`, we have `int16` for that"
|
||||
* "don't use `unsigned`, we have typedefs for that"
|
||||
* "don't use `char` for anything but actual characters, use `int8`, `uint8` or `bool`"
|
||||
@@ -119,19 +120,24 @@ commit. Warnings are fine; a non-zero exit is not.
|
||||
|
||||
The reference environment is a podman container `re3dev`
|
||||
(`docker.io/library/ubuntu:24.04`, gcc 13.3, cmake 3.28, ninja 1.11). Create it
|
||||
once:
|
||||
once, from the repository root:
|
||||
|
||||
```sh
|
||||
podman run -dit --name re3dev --security-opt label=disable \
|
||||
-v /var/home/jchroback/Projects/re3:/src:ro \
|
||||
-v "$PWD:/src:ro" \
|
||||
docker.io/library/ubuntu:24.04 sleep infinity
|
||||
|
||||
podman exec re3dev sh -c 'apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential cmake ninja-build pkg-config git ca-certificates libglfw3-dev libopenal-dev libsndfile1-dev libmpg123-dev libgl-dev'
|
||||
```
|
||||
|
||||
`--security-opt label=disable` is required on this host: SELinux is `Enforcing`, and
|
||||
a plain `:ro` bind mount otherwise fails to be readable by the container. The source
|
||||
mount is read-only on purpose — builds go to a directory inside the container.
|
||||
The source mount is read-only on purpose — builds go to a directory inside the
|
||||
container.
|
||||
|
||||
**Host-specific note (keep it in `AGENTS.local.md`, not here):**
|
||||
`--security-opt label=disable` is needed on the reference host because SELinux is
|
||||
`Enforcing` there and a plain `:ro` bind mount is otherwise not readable from
|
||||
inside the container. On a host without SELinux (or with it permissive) the flag
|
||||
can be omitted; it does not affect the build itself.
|
||||
|
||||
Configure and build (the same two commands are the whole gate):
|
||||
|
||||
@@ -146,11 +152,11 @@ podman exec re3dev cmake -S /src -B /build -G Ninja \
|
||||
podman exec re3dev cmake --build /build --parallel 12
|
||||
```
|
||||
|
||||
Expected on this machine (verified): configure succeeds and prints
|
||||
`Building re3 GIT SHA1: <hash of HEAD>`; build compiles **296 Ninja targets**,
|
||||
prints many `-Wmaybe-uninitialized`-style warnings, exits **0** in roughly
|
||||
**20 s** on 12 cores, and produces `/build/src/re3`, a **~24 MiB (25 MB) ELF64
|
||||
executable**.
|
||||
Expected on the reference host, measured at the time of writing (not a permanent
|
||||
contract): configure succeeds and prints `Building re3 GIT SHA1: <40-char hash of
|
||||
HEAD>`; build compiles ~296 Ninja targets, prints many `-Wmaybe-uninitialized`-style
|
||||
warnings, exits **0** in roughly **20 s** on 12 cores, and produces `/build/src/re3`,
|
||||
a **~24 MiB (25 MB) ELF64 executable**.
|
||||
|
||||
To prove a clean tree still builds (and to avoid stale objects), use a fresh
|
||||
build directory, e.g. `-B /build-verify`, then build it.
|
||||
@@ -173,8 +179,9 @@ the Miles SDK). `LIBRW_GL3_GFXLIB` accepts `GLFW` or `SDL2`, but `SDL2` is only
|
||||
librw option — re3 itself has no SDL skeleton in `src/skel/`.
|
||||
|
||||
Prerequisites: clone with `--recursive` (librw/ogg/opus/opusfile are submodules) and
|
||||
keep `.git` available — CMake calls `get_git_head_revision()` and embeds the short
|
||||
SHA via `configure_file`.
|
||||
keep `.git` available — CMake calls `get_git_head_revision()` and embeds the **full
|
||||
40-character** hash via `configure_file` (`cmake/GetGitRevisionDescription.cmake`);
|
||||
only the premake path (`printHash.sh`, `git rev-parse --short`) uses the short hash.
|
||||
|
||||
### 3.3 Running the game (not part of the gate)
|
||||
|
||||
@@ -213,10 +220,10 @@ Source subsystems (`src/`):
|
||||
|
||||
| Dir | Contents |
|
||||
|---|---|
|
||||
| `core/` | entry/state machine and frame (`main.cpp`), `CGame`, `CTimer`, frontend/menus, streaming, `CFileMgr`/`CFileLoader`, pads and control mapping, profiles, stats, zones, world, `config.h` constants |
|
||||
| `core/` | per-frame/event dispatch and game logic (`main.cpp`: `Idle`, `FrontendIdle`, `RenderScene`, `Render2dStuff`, …), `CGame`, `CTimer`, frontend/menus, streaming, `CFileMgr`/`CFileLoader`, pads and control mapping, profiles, stats, zones, world, `config.h` constants |
|
||||
| `control/` | mission-script VM (`Script*.cpp`), car/ped AI control (`CarCtrl`, `CarAI`, `PathFind`), pickups, garages, phones, replay, records, road blocks, traffic lights, scene edit |
|
||||
| `entities/` | `CEntity`/`CPhysical` base hierarchy |
|
||||
| `peds/` | `CPed`, `CPlayerPed`, civilians/cops/emergency, population, ped AI/combat/IK routes |
|
||||
| `peds/` | `CPed`, `CPlayerPed`, civilians/cops/emergency, population, ped AI/combat/IK/routes |
|
||||
| `vehicles/` | `CAutomobile`, `CBoat`, `CBike`, `CHeli`, `CPlane`, `CTrain`, car generators, damage/handling |
|
||||
| `audio/` | `DMAudio`/`AudioManager` front end, `sampman_oal.cpp` + `oal/` (OpenAL backend), `sampman_miles.cpp`, `eax/`, music/radio (`MusicManager`, `PolRadio`) |
|
||||
| `renderer/` | `CRenderer`, `CHud`, `CSprite2d`, particles, weather, water, timecycle, coronas, shadows, skidmarks, glass, clouds, credits, point lights, motion blur |
|
||||
@@ -236,6 +243,10 @@ Source subsystems (`src/`):
|
||||
|
||||
Platform facts verified in-tree:
|
||||
|
||||
* The process entry point and game-state switch are in the platform layer:
|
||||
`main()` in `src/skel/glfw/glfw.cpp`, `WinMain` in `src/skel/win/win.cpp`.
|
||||
`src/core/main.cpp` implements the frame callbacks those shells dispatch to
|
||||
(`Idle`, `FrontendIdle`, `RenderScene`, `Render2dStuff`, …).
|
||||
* Linux runs the **glfw** skeleton: `src/skel/glfw/glfw.cpp` owns `main()`, creates
|
||||
the window, maps GLFW keysyms to `RsKeyCodes`, and runs the game-state loop.
|
||||
* `src/skel/win/` is Windows-only (`WinMain`, win32 resources).
|
||||
@@ -255,21 +266,29 @@ loop around an inner loop that ends on `RsGlobal.quit`,
|
||||
1. `glfwPollEvents()` (window/input events; key mapping is done by the GLFW
|
||||
callbacks installed earlier).
|
||||
2. If the window is not foreground, nothing is ticked (the app idles).
|
||||
3. Otherwise a small state machine on `gGameState` runs:
|
||||
3. Otherwise a small state machine on `gGameState` runs. On a default PC build
|
||||
(`NO_MOVIES` is defined in `src/core/config.h`, `PS2_MENU` is not) the flow is:
|
||||
|
||||
```
|
||||
GS_START_UP → GS_INIT_ONCE → GS_INIT_LOGO_MPEG → GS_LOGO_MPEG
|
||||
→ GS_INIT_INTRO_MPEG → GS_INTRO_MPEG (movies; NO_MOVIES skips)
|
||||
→ GS_INIT_PLAYING_GAME | GS_INIT_FRONTEND → GS_FRONTEND
|
||||
→ GS_PLAYING_GAME
|
||||
```
|
||||
```
|
||||
GS_START_UP → GS_INIT_ONCE → GS_INIT_FRONTEND → GS_FRONTEND
|
||||
→ GS_INIT_PLAYING_GAME → GS_PLAYING_GAME
|
||||
```
|
||||
|
||||
* `GS_FRONTEND` calls `RsEventHandler(rsFRONTENDIDLE, nil)` every iteration, and
|
||||
transitions to `GS_INIT_PLAYING_GAME` once the menu wants to start/load a game.
|
||||
The movie states (`GS_INIT_LOGO_MPEG`, `GS_LOGO_MPEG`, `GS_INIT_INTRO_MPEG`,
|
||||
`GS_INTRO_MPEG`) are only entered when `NO_MOVIES` is off, and the
|
||||
movie-playback calls in the glfw skeleton are commented out, so they merely
|
||||
advance; `eGameState` (`src/skel/crossplatform.h`) declares `GS_INIT_ONCE`
|
||||
*after* `GS_INTRO_MPEG`, which is where `GS_INTRO_MPEG`'s `++gGameState` lands.
|
||||
`GS_INIT_ONCE` selects `GS_INIT_PLAYING_GAME` only under `PS2_MENU`; the PC
|
||||
path selects `GS_INIT_FRONTEND`.
|
||||
|
||||
* `GS_FRONTEND` calls `RsEventHandler(rsFRONTENDIDLE, nil)` each iteration **only
|
||||
when the window is not iconified** (`!WindowIconified`), and transitions to
|
||||
`GS_INIT_PLAYING_GAME` once the menu wants to start/load a game.
|
||||
* `GS_INIT_PLAYING_GAME` runs `InitialiseGame()` (`CGame::Initialise("DATA\\GTA3.DAT")`)
|
||||
then sets `GS_PLAYING_GAME`.
|
||||
* `GS_PLAYING_GAME` calls `RsEventHandler(rsIDLE, (void*)TRUE)` **only if the
|
||||
frame limiter is off or `1000/maxFPS` ms have elapsed since the last frame**
|
||||
* `GS_PLAYING_GAME` calls `RsEventHandler(rsIDLE, (void*)TRUE)` **only** if the
|
||||
frame limiter is off or `1000/maxFPS` ms have elapsed since the last frame
|
||||
(`CTimer::GetCurrentTimeInCycles()` / `GetCyclesPerMillisecond()`).
|
||||
* `resizeCB()` calls `RsEventHandler(rsIDLE, TRUE)` directly when the window is
|
||||
resized during play, i.e. `Idle()` can be entered outside the normal pacing.
|
||||
@@ -311,8 +330,8 @@ GS_START_UP → GS_INIT_ONCE → GS_INIT_LOGO_MPEG → GS_LOGO_MPEG
|
||||
`CWaterLevel::RenderWater()`, `CRenderer::RenderFadingInEntities()`,
|
||||
`CRenderer::RenderVehiclesButNotBoats()`, `CWeather::RenderRainStreaks()`.
|
||||
5. `RenderDebugShit()`, `RenderEffects()` (glass, water cannons, special FX,
|
||||
shadows, skidmarks, antennas, rubbish, coronas, particles, weapon effects,
|
||||
point lights, moving things, first-person vehicle).
|
||||
shadows, skidmarks, antennas, rubbish, coronas, particles, pac-man pickups,
|
||||
weapon effects, point lights, moving things, first-person vehicle).
|
||||
6. Optional screen droplets (`SCREEN_DROPLETS`) then
|
||||
`TheCamera.RenderMotionBlur()`.
|
||||
7. **`Render2dStuff()`**: replay, pickup text, widescreen borders, radio name,
|
||||
@@ -337,8 +356,15 @@ GS_START_UP → GS_INIT_ONCE → GS_INIT_LOGO_MPEG → GS_LOGO_MPEG
|
||||
* **Ctrl+B** toggles the free/debug camera (`IMPROVED_CAMERA`, handled in
|
||||
`CCamera::Process` via `CTRLJUSTDOWN('B')` in `src/core/Camera.cpp`; sets
|
||||
`CCam::MODE_DEBUG`).
|
||||
* `src/core/Debug.cpp` draws collision lines, path data and script debug lines in
|
||||
non-`FINAL` builds; `TIMEBARS` (`gbShowTimebars`) prints per-phase timings.
|
||||
* Debug overlays are drawn by `RenderDebugShit()` in `src/core/main.cpp`. It always
|
||||
calls `CTheScripts::RenderTheScriptDebugLines()`; in non-`FINAL` builds it also
|
||||
calls `CRenderer::RenderCollisionLines()` when `gbShowCollisionLines` is set
|
||||
(flag defined in `src/renderer/Renderer.cpp`, toggled from the debug menu),
|
||||
`ThePaths.DisplayPathData()` (`CPathFind::DisplayPathData`,
|
||||
`src/control/PathFind.cpp`) and `CDebug::DrawLines()`. `src/core/Debug.cpp`
|
||||
provides only that generic text/line buffer (`CDebug::AddLine`/`DrawLines`), not
|
||||
the collision or path drawing. `TIMEBARS` (`gbShowTimebars`) prints per-phase
|
||||
timings.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user