Ludic's ECS is already pool-based — the allocator recycles freed entity slots through a freelist (L_alloc pops @L_freen before growing @L_entc), and component storage is fixed per-entity arrays, so spawn/despawn churn (bullet-hell/horde) does no per-spawn heap allocation and cannot fragment. Expose that with a Pool.* namespace so a game can watch reuse: Pool.live (alive now), Pool.free (recycled slots waiting), Pool.reserved (high-water — stays flat across a steady spawn/despawn loop, proving reuse not reallocation), Pool.capacity (the fixed cap). Zero-cost inline reads of the existing counters. Example pool.ludic proves the key property: after despawn+respawn, Pool.reserved() stays 3 (freed slot reused) — prints 0 0 3 3 0 2 1 3 0 3 1. 4 docs pages. Full suite 118/0, goldens byte-identical, fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 lines
425 B
Markdown
14 lines
425 B
Markdown
---
|
|
id: pool-capacity
|
|
name: Pool.capacity
|
|
category: pool
|
|
kind: namespace-method
|
|
tokens: Pool.capacity
|
|
sig: Pool.capacity() -> int
|
|
tip: The maximum number of entities.
|
|
order: 4
|
|
ns: Pool
|
|
member: capacity
|
|
---
|
|
|
|
Returns the maximum number of live entities (the fixed entity-array size). Budget spawns against it — a horde/bullet-hell game keeps <a href="pool-live"><code>Pool.live</code></a> under <code>Pool.capacity()</code>.
|