A 2d self-landing rocket simulation written in Python.
You need pygame
and pymunk
installed, e.g. using
pip3 install --user pygame
pip3 install --user pymunk
Run
python3 main.py
to start the simulation.
Key | |
---|---|
Up/Down | Throttle control |
Left/Right | Thrust vector control |
Space | Start/Stop engine |
0-9 | Switch stability assist mode (SAS) |
Mouse | add an obstacle |
A | toggle airbrakes |
P | pause |
R | restart the rocket |
T | run landing tests |
- Launch the rocket by hitting Space.
- Play with the arrow keys to control the thrust and guide the rocket anywhere you want.
- If you lose control, use the stability augmentation system (SAS) to regain control:
- 0: SAS off / no stability assist / manual control
- 1: stability assist only, keeps the rocket from spinning
- 2: stability assist + keeps the rocket upright
- 3: keeps the rocket upright and cancels its velocity
- 4: attempts to land the rocket automatically
- If you want to make it more difficult for the rocket, click anywhere to add balls as obstacles