catswarm

1000 procedural cats swarming your desktop. They chase your mouse, play together, nap in clusters, and keep their personal space.

View on GitHub
catswarm - 1000 cats on your desktop
1000+
Cats
1
Draw Call
60
FPS
0
Allocs / Frame

What the cats do

👁

Transparent Overlay

Cats render on top of everything via DirectComposition. Fully click-through -- they never block your work.

🖱

Mouse Chasing

Curious cats notice your cursor and chase it. The more curious the personality, the more likely the chase.

🎮

Playing Together

Idle cats near each other start playing -- hovering and jittering around their partner with playful energy.

💤

Nap Clusters

Lazy cats join sleeping neighbors to form cozy nap piles. The lazier the cat, the more it naps.

💨

Chase & Flee

Energetic cats chase others. Skittish targets flee at high speed. It's a whole ecosystem.

🧠

Unique Personalities

Each cat has laziness, energy, curiosity, and skittishness traits that shape all their decisions.

Under the hood

Data-oriented design. GPU-driven rendering. Zero allocations in the hot path.

Language Rust
Rendering wgpu 27 (DX12)
Transparency DirectComposition
ECS hecs 0.10
Math glam (SIMD)
Spatial Hash Grid (128px)

How it works

The overlay is a borderless always-on-top window with WS_EX_TOOLWINDOW style. Transparency comes from wgpu's DxgiFromVisual swapchain mode combined with PreMultiplied alpha compositing via DirectComposition. Each frame clears to fully transparent and draws all cats with premultiplied alpha blending.

All 1000+ cats are drawn in a single instanced draw call. Each cat is a procedural signed distance field (SDF) with 3 poses -- sitting, walking, and sleeping -- evaluated entirely in the fragment shader. The CPU uploads a 24-byte-per-cat instance buffer each frame.

Simulation runs at a fixed 60Hz timestep with interpolated rendering. A spatial hash grid (128px cells, 1024 buckets) enables O(1) neighbor queries. Cat-to-cat interactions use a two-phase read-then-write pattern with a snapshot cache -- all neighbor lookups are pure array indexing with zero ECS overhead in the hot path.

Try it

git clone https://github.com/TrentSterling/catswarm
cd catswarm
cargo run --release
Requires Windows 10/11 with DX12 GPU and Rust toolchain. Press ESC to quit.