Skip to main content
Systems / Rust

Emergent chemistry in a custom Rust physics engine

Real-time 2D particle simulation where 10 fantasy chemical elements interact through bonding, transmutation, fission, energy transfer, and emergent molecule formation. 400+ particles with electromagnetic forces, quadtree spatial partitioning, and procedural world events — all running at 60fps in Rust.

Links Coming Soon
Tech Stack
RustmacroquadQuadtreerandonce_cell
Key Features

01

10-element chemistry system with unique mass, charge, energy, bond limits, and affinity bitmasks

02

Quadtree spatial partitioning for O(n log n) neighbor lookups

03

Bonding system with spring forces (K=300), energy-gated formation, and random instability

04

Transmutation cycle: Ignis -> Plasma -> Nox -> Void -> Cryo -> Aqua -> Terra -> Aether -> Flux -> Volt

05

World events: gravity wells, supernovae, charge surges, element storms, freeze events

06

Molecule formation with mitosis — large diverse molecules bud off new particles

Architecture

Single-threaded Rust game loop with macroquad for rendering. Quadtree rebuilt each frame for spatial queries. Physics system handles electromagnetic forces, elastic collisions, quadratic drag, and pressure. Population regulated via carrying capacity (400), overcrowding energy drain, and age decay. Element stats drift every 10 seconds based on population performance. All events logged to file with spatial filtering.

Screenshot / Demo Coming Soon