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.
10-element chemistry system with unique mass, charge, energy, bond limits, and affinity bitmasks
Quadtree spatial partitioning for O(n log n) neighbor lookups
Bonding system with spring forces (K=300), energy-gated formation, and random instability
Transmutation cycle: Ignis -> Plasma -> Nox -> Void -> Cryo -> Aqua -> Terra -> Aether -> Flux -> Volt
World events: gravity wells, supernovae, charge surges, element storms, freeze events
Molecule formation with mitosis — large diverse molecules bud off new particles
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.