ludic/ns-pool.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
2.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pool — Ludic</title>
<meta name="description" content="Entity-pool statistics.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Pool</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Pool</h1></div>
<p class="ns-blurb">Entity-pool statistics. Ludic's ECS is already pool-based: the allocator recycles freed entity slots through a freelist (a <a href="../structure/kw-model"><code>despawn</code></a>ed slot is reused by the next <code>spawn</code> before any new slot is taken), and component storage is fixed per-entity arrays — so spawning and despawning many entities per frame does no per-spawn heap allocation and cannot fragment. <a href="pool-live"><code>Pool.live</code></a> / <a href="pool-free"><code>Pool.free</code></a> / <a href="pool-reserved"><code>Pool.reserved</code></a> / <a href="pool-capacity"><code>Pool.capacity</code></a> read those counters so a bullet-hell or horde game can watch reuse and budget against the cap.</p>
<div class="ns-methods"><a class="ns-method" href="pool-live.html"><code class="nm-sig">Pool.live() -&gt; int</code><span class="nm-tip">How many entities are currently alive.</span></a><a class="ns-method" href="pool-free.html"><code class="nm-sig">Pool.free() -&gt; int</code><span class="nm-tip">How many freed slots are waiting to be reused.</span></a><a class="ns-method" href="pool-reserved.html"><code class="nm-sig">Pool.reserved() -&gt; int</code><span class="nm-tip">High-water: how many slots have ever been allocated.</span></a><a class="ns-method" href="pool-capacity.html"><code class="nm-sig">Pool.capacity() -&gt; int</code><span class="nm-tip">The maximum number of entities.</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>