Explore orbital systems, spiral galaxies, quasars, pulsars, black holes, stellar evolution, and controlled cosmic expansion in an interactive Windows desktop application.
Aether is an interactive numerical sandbox built to make gravitational systems understandable, experimentable, and visually compelling.
It combines:
- A high-performance Raylib simulation viewport.
- A structured WPF control panel embedded in the same desktop window.
- A Barnes–Hut quadtree solver for large body counts.
- A Leapfrog integrator designed for more stable orbital motion.
- Procedural generators for planetary systems and multi-galaxy scenes.
- Visual effects for black-hole tides, spaghettification, quasars, pulsars, and stellar evolution.
Project status: Active development — Phases 1, 2, and the foundations of Phase 3 are implemented.
Aether is not intended to be a fully relativistic astrophysics engine. It is an educational and experimental simulation focused on:
- Making gravitational behaviour visible.
- Keeping the physics understandable and extensible.
- Exploring the relationship between numerical models and visual perception.
- Supporting both small orbital experiments and large procedural universes.
| Area | Included |
|---|---|
| Simulation | 2D camera, zoom, panning, pause, adjustable simulation speed |
| Gravity | Barnes–Hut quadtree and legacy naive solver for comparison |
| Integration | Leapfrog kick–drift–kick integration |
| Bodies | Planets, stars, asteroids, black holes, quasars, pulsars |
| Galaxies | Spiral arms, dust, planetary systems, multi-galaxy scenes |
| Black holes | Tidal deformation, shrinking radius, directional tails, pixelation, absorption |
| Stellar evolution | Star aging, radius evolution, pulsar remnants, black-hole remnants |
| Interaction | Spawn, delete, select, replace, inspect and save simulation states |
| Persistence | SQLite snapshots through Dapper and Microsoft.Data.Sqlite |
The first phase creates several separated galaxies with coherent internal structure:
- A moving central quasar.
- Four visible logarithmic spiral arms.
- Stars distributed along the arms.
- Low-mass dust particles that reinforce the silhouette.
- Planetary systems around selected stars.
- Pulsars and compact-object events.
- Optional initial collision geometry.
The generator uses deterministic random seeds so a scene can be reproduced.
The Big Bang-inspired phase begins with already structured galaxies and applies a gentle radial expansion component.
This is intentionally a visual and controllable cosmological model, not a complete relativistic cosmology solver. The goal is to preserve recognizable spiral galaxies while allowing them to separate and evolve instead of exploding into unstructured particles.
The current foundation includes:
- Simulation-speed control from
0.125xto32x. - Stellar age and configurable lifetime.
- Progressive star-radius evolution.
- Massive stars becoming black holes.
- Lower-mass stars becoming pulsars.
- Body spawning and deletion.
- Body replacement between supported types.
- Selection and value inspection through the control panel.
For body
where:
-
$G$ is the project-scale gravitational constant. -
$m_j$ is the source mass. -
$\varepsilon$ softens close encounters and avoids singularities. - Positions and velocities use simulation units rather than SI units.
The total acceleration of a body is the sum of the contributions accepted by the selected solver.
Procedural scene generation uses the circular-orbit approximation:
This produces initial velocities adapted to the dominant mass
The active integrator follows a kick–drift–kick structure:
- Apply half of the acceleration impulse to velocity.
- Advance position using the updated velocity.
- Rebuild the quadtree and recalculate acceleration.
- Apply the remaining half impulse.
Leapfrog is symplectic in its ideal form and generally preserves orbital structure better over long simulations than explicit Euler integration.
The quadtree recursively partitions the world and stores:
- Total mass per node.
- Centre of mass per node.
- A body index in leaf nodes.
A distant node can be approximated as one concentrated mass when:
where
- Smaller
Theta: more accurate, more expensive. - Larger
Theta: faster, more approximate.
The legacy naive solver remains available for performance comparison and validation.
When a body enters a black hole's tidal radius:
- Absorption progress increases.
- The body contracts visually.
- A tail stretches opposite the black hole.
- Pixel fragments appear near the event horizon.
- The body is eventually consumed.
These are artistic 2D approximations inspired by cinematic black-hole imagery. They do not model relativistic ray tracing, accretion-disk radiative transfer, or general relativity.
A QuasarBody extends the black-hole model with:
- A dark central silhouette.
- An elliptical accretion disk.
- Bright disk rings.
- Narrow opposing jets.
A PulsarBody represents a rotating neutron star through:
- A luminous compact core.
- A surrounding halo.
- Two rotating triangular plasma beams.
The application uses one WPF window containing:
- A left control panel for scenes, simulation state, body creation, and inspection.
- A right Raylib viewport dedicated to rendering the universe.
The panel supports:
- Scene selection.
- Pause and resume.
- Simulation speed control.
- Body type, mass, radius, and world-coordinate input.
- Body spawning.
- Body selection by world coordinates.
- Selected-body information.
- Deletion of selected bodies.
Communication between the control layer and the simulation layer uses a local Windows named pipe, keeping UI commands separate from the physics and rendering loop.
Aether_NBody_Simulation.slnx
├── Aether_NBody_Simulation/
│ ├── Program.cs # Raylib loop, rendering, camera, commands
│ ├── PhysicsEngine.cs # Gravity, Leapfrog, lifecycle, tidal effects
│ ├── QuadTreeNode.cs # Barnes–Hut spatial partition
│ ├── Body.cs # Celestial-body hierarchy and state
│ ├── GalaxyBuilder.cs # Procedural scenes and galaxy generators
│ ├── SceneModels.cs # Scene and body-kind definitions
│ ├── SimulationRepository.cs # SQLite persistence
│ ├── ControlPipeServer.cs # Named-pipe command receiver
│ └── SimulationCommand.cs # Shared command format
├── Aether_ControlPanel/
│ ├── MainWindow.xaml # WPF layout and visual style
│ ├── MainWindow.xaml.cs # Controls and Raylib window hosting
│ ├── App.xaml # Theme and shared WPF styles
│ └── App.xaml.cs # WPF application entry point
└── README.md
- C# 12
- .NET 8
- Raylib-cs 8 — real-time 2D rendering.
- WPF — desktop control interface.
- Windows Forms hosting — native Raylib surface embedded into WPF.
- Dapper — lightweight SQL mapping.
- Microsoft.Data.Sqlite — local persistence.
- Parallel.For — parallel Barnes–Hut acceleration queries.
- Windows.
- .NET 8 SDK.
- A graphics driver supporting the Raylib OpenGL backend.
From the repository root:
dotnet build Aether_NBody_Simulation.slnx -c Debug
dotnet run --project Aether_NBody_Simulation.slnxThe standard launch opens the WPF control window with Raylib embedded in the simulation viewport.
Run the legacy embedded Raylib interface:
dotnet run --project Aether_NBody_Simulation/Aether_NBody_Simulation.csproj -- --embedded-uiRun the clean Raylib viewer for external-control development:
dotnet run --project Aether_NBody_Simulation/Aether_NBody_Simulation.csproj -- --external-ui --hostedRun the physics benchmark:
dotnet run --project Aether_NBody_Simulation/Aether_NBody_Simulation.csproj -- --benchmark-quadtreeThe simulation is primarily CPU-bound. The largest costs are:
- Rebuilding the quadtree each physics step.
- Traversing the tree for every body.
- Additional substeps at high simulation speed.
- Rendering large numbers of visible bodies.
The quadtree moves the dominant interaction calculation from the naive all-pairs approach toward approximately
Increasing the simulation speed intentionally increases the amount of simulated time processed per rendered frame, so high multipliers require more CPU work.
- Keep scene generation deterministic with explicit seeds.
- Generate orbital velocities using the same scale law as the physics model.
- Bound the physics timestep for numerical stability.
- Separate simulation, rendering, persistence, and UI transport.
- Prefer explicit and testable generation functions over hidden magic values.
- Treat black-hole effects as a presentation layer driven by physical state.
- Validate performance with repeatable benchmark scenes.
- Full inspector editing for position, velocity, mass, radius, and static state.
- More robust native-host lifecycle and graceful shutdown.
- Compact-object collision and merger events.
- Configurable galaxy-generator forms.
- Multi-body selection and editing.
- More detailed stellar evolution stages.
- Optional cosmological expansion parameters.
- Automated physics regression tests.
- Windows release packaging.
Aether is structured as an experimental and educational project. Contributions are welcome, especially in:
- Numerical stability.
- Profiling and performance.
- Procedural galaxy generation.
- Visualization techniques.
- Automated physics tests.
- UI/UX improvements.
When proposing a change, include the affected model, the expected physical or visual effect, and a reproducible test scene when possible.
No license has been selected yet. Add a license before distributing the project publicly.