🚀 Orbital Rocket Simulation 🌐 Live Demo: Current Live Demo: https://www.donutthejedi.com/ A realistic 2D physics simulation of orbital mechanics and rocket launches from Earth. Experience the challenge of launching a Falcon 9-like rocket into orbit with accurate physics, atmospheric modeling, and an intelligent closed-loop guidance system. 🌟 Part I think is coolest Rocket Builder with live diagram — The Vehicle…
A realistic 2D physics simulation of orbital mechanics and rocket launches from Earth. Experience the challenge of launching a Falcon 9-like rocket into orbit with accurate physics, atmospheric modeling, and an intelligent closed-loop guidance system.
🌟 Part I think is coolest
Rocket Builder with live diagram — The Vehicle Hangar (builder.html) is a dedicated page where you can tweak stages, payload, and fairing (also linked from Mission Control as BUILD ›). The Basic tab shows an interactive 2D diagram of your rocket: drag segment boundaries to change length and edges to change diameter. COG and CoP at pad are drawn in real time, and starting acceleration turns red if it’s below 1 g (so you know the rocket would crash). Its so amazing to test extreme cases and just play around with your ideas, I havent tested it but it should work with model rockets
Diagram area: A resizable panel (drag the vertical bar to change its width). The rectangle inside scales to fit while keeping aspect ratio. This is a placeholder: a customizable rocket diagram is planned here so you can see and interact with your rocket shape (e.g. drag to resize stages, fuel tanks) to make tuning more intuitive. The feature is not done yet.
Advanced Tab
Stages: Isp (SL/vac), tank length ratio, engine length, engine mass fraction, gimbal (max angle, rate, pivot point)
Global: Fairing jettison altitude, propellant density
Behavior
Reset to default: Restores the Falcon 9-like configuration
Proceed to Launch Pad: Returns to the simulator; your design applies to the next mission start (Manual, Guided, or Orbital). Config is saved in the browser automatically.
All parameters are persisted for the session; the simulation reads from the current config when you launch or spawn
The diagram area in the Basic tab currently shows a simple rectangle that resizes with the panel. The goal is to replace it with an interactive rocket diagram that reflects your parameters (stage lengths, diameters, payload, fairing) and allows intuitive editing—e.g. dragging to adjust stage height or tank size—so building a rocket feels more visual and intuitive. This is not yet implemented.
📁 Project Structure
Rocket/
├── index.html # Main simulator
├── builder.html # Vehicle Hangar — custom rocket builder
├── README.md # This file
├── css/
│ └── styles.css # UI styling
└── js/
├── main.js # Main game loop and menu logic
├── state.js # Game state management
├── physics.js # Atmospheric and physics calculations
├── guidance.js # Closed-loop guidance system
├── orbital.js # Orbital mechanics calculations
├── events.js # Mission event tracking
├── input.js # User input handling
├── renderer.js # Canvas rendering
├── telemetry.js # Telemetry display updates
├── rocketConfig.js # Current rocket config (get/set, builder)
└── constants.js # Physical constants and default configuration
state.js: State management, orbital spawn function
🎓 Educational Value
This simulation is excellent for:
Learning Orbital Mechanics: Understand how orbits work in practice
Rocket Science: See how thrust, gravity, and drag interact
Guidance Systems: Learn how closed-loop guidance works
Atmospheric Physics: Explore how atmosphere affects flight
Mission Planning: Practice orbital maneuvers and burns
🎯 Roadmap
Guidance System
Powered Explicit Guidance (PEG)
Replace the current priority-based guidance with the iterative PEG algorithm used by Space Shuttle and Falcon 9. PEG computes optimal steering commands by solving for the thrust direction that achieves target orbital conditions while minimizing propellant usage.
Implement PEG state estimator (current position, velocity, mass)
Add iterative guidance loop with convergence criteria
Compute time-to-go and required velocity-to-be-gained (Vgo)
Generate pitch/yaw steering commands from PEG output
Advanced tab: Isp, tank ratio, engine length, gimbal, fairing jettison alt, propellant density
Customizable rocket diagram (not yet done): Replace placeholder rectangle with an interactive diagram that reflects your parameters (stage lengths, diameters, payload, fairing) and allows intuitive editing—e.g. drag to resize stage height or tank size—so building a rocket is more visual and intuitive
Telemetry Graphs & Post-Flight Review
Add real-time plotting during flight and comprehensive post-flight analysis.
Real-Time Graphs
Altitude vs time
Velocity vs time (surface velocity + orbital velocity)
Acceleration vs time (with Max-Q marker)
Dynamic pressure vs time
Flight path angle vs time
Apoapsis/Periapsis evolution
Post-Flight Review
Mission summary statistics (max altitude, max velocity, max Q, flight time)
Delta-V breakdown by phase (gravity losses, drag losses, steering losses)
Guidance performance analysis (actual vs commanded pitch)
Propellant usage timeline
Export flight data to CSV/JSON
Replay flight with adjustable playback speed
⚠️ Current Issues
Engine shuts off in manual control
When clicking in and out of UI it can bug
Poor phone formatting
Orbital controls do not appear immediately after entering Orbital mode
Prograde burns do not affect structural stability
After leaving Orbital mode and returning to Manual mode, orbital controls remain visible until launch
🐛 Known Limitations
2D Only: Simplified to 2D plane (no inclination changes)
No Wind/Weather: Atmospheric conditions are standard only
Instant Stage Separation: Real separations have dynamics
No Structural Failure: Max-Q protection exists but no failure modeling
🤝 Contributing
Contributions are welcome! Areas for improvement:
3D orbital mechanics
Additional rocket configurations
Mission scenarios
UI/UX improvements
📝 License
This project is open source. Feel free to use, modify, and distribute.
🙏 Acknowledgments
US Standard Atmosphere 1976: NOAA, NASA, and USAF
Falcon 9 Specifications: Based on publicly available SpaceX data
Orbital Mechanics: Based on classical two-body problem solutions
Notes
The code here is not the same code thats on the website, the rocket launch sim and build are faithful but I do not push all my website code here, I just added a build your own FPA system thats not currently mirrored here
评论