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

@@ -6,7 +6,7 @@ everything else passes around. The JSON accessors are the valuable part of this
their status semantics are what every asset loader in the library is written against, and
they are documented nowhere else.
## Collision helpers
## Rectangle overlap helpers
Three functions, all axis-aligned, all in `util.h`:
@@ -84,7 +84,7 @@ tall thin character is exactly that shape. The header carried a `@note` describi
than a fix.
It is four comparisons now, `r1.x <= r2.x + r2.w && r2.x <= r1.x + r1.w` on both axes.
`<=` rather than `<` because [`akgl_collide_point_rectangle`](#collision-helpers) is
`<=` rather than `<` because [`akgl_collide_point_rectangle`](#rectangle-overlap-helpers) is
inclusive on all four edges and these two have always agreed: touching counts.
**If you are upgrading from 0.7.x, two answers change.** The cross now reports `true`, which
@@ -92,10 +92,13 @@ is the point. And because the comparison no longer round-trips through `akgl_Poi
members, overlaps and gaps smaller than a pixel are now seen rather than truncated away — so
a pickup test that was accidentally forgiving by up to a pixel is no longer forgiving.
This is separate from the fact that **nothing in the library calls these during a frame.**
`akgl_physics_simulate` never calls `collide`, and `akgl_physics_arcade_collide` raises
`AKERR_API` — see [Chapter 14](14-physics.md). Collision detection is yours to run, and these
are the helpers for running it.
**The library runs its own collision now** — see [Chapter 15](15-collision.md) — and it does
not use these. `akgl_collision_test` works in centres and half-extents, answers with a normal
and a depth rather than a boolean, and handles circles and capsules as well as boxes.
These stay because a game-level overlap question is not always a physics question: a
minimap marker, a UI hit test, "is the cursor over this". For anything that should push or be
pushed, use a collision shape.
## Path resolution
@@ -408,7 +411,7 @@ typedef struct
`data` is a plain `char[]`, so `str->data` goes anywhere a `char *` does. `refcount` belongs
to the heap layer — [Chapter 5](05-the-heap.md) — and **`akgl_heap_next_string` is the one
acquire function that takes the reference for you**, unlike the other four pools.
acquire function that takes the reference for you**, unlike the other seven pools.
Two functions operate on the contents: