A web-based interactive space flight simulator that teaches orbital mechanics and physics through gameplay. This project was created for the SpaceHacks competition.
The Space Flight Simulator allows users to experiment with spacecraft navigation in a physics-accurate environment. By controlling a virtual spacecraft, users can learn about orbital mechanics, gravitational forces, and Newtonian physics through direct interaction and guided missions.
This project addresses the "Orbital Navigation & Flight Path Optimization" and "Space Exploration Visualizer" tracks of the SpaceHacks competition.
- Real-time physics simulation based on Newtonian mechanics and gravitational forces
- Interactive spacecraft controls (W/A/S keyboard inputs)
- Realistic orbital mechanics
- Educational content explaining physics principles as you play
- Mission-based objectives to guide learning
- Visual representation of spacecraft trajectory and celestial bodies
- Heads-up display showing relevant flight data
-
Open the
index.htmlfile in a modern web browser, or visit the GitHub Pages deployment. -
Click "Start Simulation" to begin.
-
Use the following controls:
W: Accelerate (fire main engines)A: Rotate spacecraft leftD: Rotate spacecraft rightF: Toggle camera follow mode+: Zoom in-: Zoom outR: Reset simulation
-
Try to complete the mission objectives displayed in the control panel.
-
Click on the Physics Info panel to learn more about the current physics principle being demonstrated.
This simulator demonstrates several key physics concepts:
- Newton's Laws of Motion: Experience how objects remain in motion unless acted upon by forces.
- Orbital Mechanics: Learn to achieve and maintain stable orbits around celestial bodies.
- Gravitational Forces: Observe how gravity affects your spacecraft based on distance and mass.
- Conservation of Momentum: See how changes in velocity affect your spacecraft's trajectory.
- Fuel Management: Experience the limitations of real-world spacecraft operations.
This project is built using:
- HTML5 for structure
- CSS3 for styling
- JavaScript for physics calculations and rendering
- Canvas API for visualization
The physics engine implements:
- Vector-based force calculations
- Gravitational force simulation
- Numerical integration for solving equations of motion
- Collision detection
To run this project locally:
- Clone the repository
- Open
index.htmlin a web browser - No build steps or dependencies required
- Additional spacecraft options with different characteristics
- More celestial bodies and complex mission scenarios
- Multiplayer capabilities
- Mobile device support through touch controls
- Additional educational content and guided tutorials
This project is released under the MIT License - see the LICENSE file for details.