Rocket Landing Simulator

Assignment Overview

Overview

In 2018, SpaceX's Falcon 9 rocket became the first space launch vehicle that was capable of taking off from the Earth, reaching orbit, and autonomously landing on either the land or sea (check out this link, it's amazing!). In this assignment, you will develop a rocket landing simulator using the pythonGraph library. This assignment will help you comprehend the significance of SpaceX's achievement, and gain a deeper appreciation for the amount of software that needed to be written (and tested) for this "pipe dream" to become reality.

In your simulation, a rocket will start off on the left side of the screen and take off. After the rocket has climbed to a predefined altitude, it will turn towards the right and hand over control to the player (and eventually, an AI of your design). The player will then have to control the rocket's thrusters using the arrow keys in order to make sure it safely lands on a randomly positioned boat in the ocean. Each time the simulation ends (either by the rocket landing on the boat or crashing into the ocean/ground), your program will evaluate the player/AI's performance using criteria such as fuel consumption, softness of landing, etc., and assign him/her a score. The simulation will then automatically reset itself to the same exact configuration and allow the player/AI to try again.

Here is an example of the game. Yours will look different!


Be warned! This programming assignment is significantly more challenging than the ones you have worked on thus far. Not only will you be producing a game, but you will also design and implement an AI that can automatically land the rocket on the boat. You will also be working with a special graphics library (pythonGraph) that will allow you to quickly draw the game. PythonGraph is designed to be simple and easy to learn, but there is still a learning curve.

To help you manage this complexity, we have created a series of Gate Checks that will walk you through each major step in the program. To be clear: there are lots of small problems that you will need to solve as you work on this assignment. It is our hope, however, that these Gate Checks will allow you to tackle this problem in an incremental fashion.

Supporting Resources

To get started on this assignment, download the starter pack. The Starter Pack contains:

Functional Requirements

To receive full credit, your program must satisfy the following functional requirements:

  1. Graphics Window - the pythonGraph window...
  2. Simulation Initialization - when the simulator starts, your program...
  3. Graphics - during the simulation, your program...
  4. Player Controls - during the landing phase, the simulator...
  5. Animation - the simulator...
  6. Artificial Intelligence - your program...
  7. Programming Standards - your program...

Gate Checks

To prevent you from trying to tackle the assignment all at once, we will be requiring you to complete and turn in this assignment in 4 phases.

Gate Check #1: Simulation Setup

Number of Lines of Code: Approximately 50

In this gate check, you will set up the game's starting state. You will randomly generate the rocket and landing boat's starting (x, y) coordinates, and create a random landscape (land & water). You will then implement the basic drawing functions in order to show the game within the graphics window.

When you have completed this gate check, you will be able to see the initial game (although it will not be animated).


Gate Check #2: Animation

Number of Lines of Code: Approximately 60

In this gate check, you will animate the game. You will write the code to make the boat move, and animate the rocket during the Boost and Landing phases.

When you have completed this gate check, you will see the rocket boost from the launch pad, travel upwards, and begin moving towards the landing boat. Since we have not yet implemented thrusters or player controls, the rocket will end up crashing into the ground or flying of the screen). This is fine! We will tackle this problem in the following gate check.


Gate Check #3: Player Controls

Number of Lines of Code: Approximately 40

In this gate check, you will implement player controls. Your code will allow the user to move the rocket by pressing the arrow keys. You will also implement a basic heads up display (HUD) in order to track basic performance stats (e.g., fuel consumed, time in flight, etc.). Finally, your code will detect when the rocket 1) hits the ground, 2) goes off the horizontal edges of the screen, or 3) lands on the boat. It will then display a simple "success" or "failure" message before resetting the simulation for the next round.

When you have completed this gate check, you should have a fully playable rocket landing simulator.


Gate Check #4: Artificial Intelligence

Number of Lines of Code: At least 50 (varies depending on your strategy)

In this gate check, you will develop a (simple) Artificial Intelligence that can land the rocket on the boat without human assistance. Your code will track the rocket's location in relation to the boat, and fire the appropriate thrusters.

To receive full credit, you must be able to write a set of rules (i.e., an expert system) that can get the rocket to land on the boat "most of the time." Alternatively, you can write an AI that can "learn" how to land on the rocket by trying different (i.e., random) strategies.