Document collision, and correct what it made false elsewhere

The new chapter 15 covers the opt-in setup, where resolution runs in the step
and why it runs after the move, shapes and the z-extrusion trap, the asymmetric
masks and the defaults that matter more than the mechanism, tiles as a source
rather than proxies, the response hook and the three ways it is easy to write
wrongly, sensors, the four queries, both partitioners, and what is still not
implemented.

Collision falsified claims in eight other chapters. The physics chapter said
"There is no collision detection, at all" and that collide always raises
AKERR_API; actors had six behaviour hooks; the heap had five pools and four
non-claiming acquires; the status band held five codes; and the design
philosophy had exactly two pluggable subsystems. The appendix gains a
collision.h status section, the three new pool ceilings and a table of the
collision constants that are deliberately not in a public header.

Also fixes chapter labels the renumbering commit left pointing at their old
numbers -- "18. Utilities" linked to 19-utilities.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KzBDV2fqgnUAcqCKqKvc71
This commit is contained in:
2026-08-02 07:25:52 -04:00
parent bace818998
commit 35a58670d0
11 changed files with 368 additions and 74 deletions

View File

@@ -95,29 +95,30 @@ akerr_ErrorContext *scratch_path(char *root, char *name)
**If the pool has no layer for your type, add one.** A new kind of runtime object gets a new
array, a `next`, and a `release`, in `heap.h` and `src/heap.c`. It does not get an
allocator. [Chapter 5](05-the-heap.md) covers the layers, the reference-count asymmetry
between `akgl_heap_next_string` and the other four, and what the ceilings cost you.
between `akgl_heap_next_string` and the other seven, and what the ceilings cost you.
## Variation lives in a backend, not in a branch
There are exactly two pluggable subsystems, and both have the same shape: **a struct of
There are exactly three pluggable subsystems, and all have the same shape: **a struct of
function pointers, plus an initializer that populates it.**
```text
akgl_RenderBackend akgl_PhysicsBackend
+--------------------+ +--------------------+
| sdl_renderer | | simulate |
| shutdown | | gravity |
| frame_start | | collide |
| frame_end | | move |
| draw_texture | | drag_x/y/z |
| draw_mesh | | gravity_x/y/z |
| draw_world | | max_timestep |
+--------------------+ +--------------------+
^ ^
| populated by | populated by
akgl_render_2d_bind akgl_physics_init_null
akgl_render_2d_init akgl_physics_init_arcade
(chosen by akgl_physics_factory)
akgl_RenderBackend akgl_PhysicsBackend akgl_Partitioner
+--------------------+ +--------------------+ +-----------------+
| sdl_renderer | | simulate | | reset |
| shutdown | | gravity | | insert |
| frame_start | | collide | | remove |
| frame_end | | move | | move |
| draw_texture | | drag_x/y/z | | query |
| draw_mesh | | gravity_x/y/z | | each_pair |
| draw_world | | max_timestep | | state |
+--------------------+ | collision | +-----------------+
^ +--------------------+ ^
| populated by ^ | populated by
akgl_render_2d_bind | populated by akgl_partitioner_init_grid
akgl_render_2d_init akgl_physics_init_null akgl_partitioner_init_bsp
akgl_physics_init_arcade (akgl_partitioner_factory)
(akgl_physics_factory)
```
The shipped physics initializers are five assignments and nothing else: