An nbody gravity simulator that adopts a client-server architecture to separate the mathematical processing load from the graphical rendering. The calculation of gravitational interactions between celestial bodies is processed remotely on a server, while the client consumes this data via RPC (Remote Procedure Call) to render the simulation in real-time using OpenGL.
- N-Body Simulation: Accurate calculation of gravitational forces and state updates (positions/velocities) for multiple planets.
- Distributed Architecture: Efficient client-server communication using RPC, allowing the physics simulation to run on dedicated hardware.
- Graphical Rendering: Smooth, real-time 3D visualization using the OpenGL pipeline.
- Synchronization: Latency handling and frame updates to keep the visual output synced with the server's calculations.
The project is divided into two main components:
- Server (Physics Engine): Responsible for all the heavy lifting. It calculates the mutual gravitational attraction between all celestial bodies on every simulation tick and updates their state vectors (position, mass, and velocity).
- Client (Renderer): An OpenGL graphical application. It makes periodic requests to the server via RPC to fetch the updated state of the celestial bodies and draws them on the screen.