Fly your drone around the city and deliver all the packages! Beware: crashing into the buildings is easier than you think!
Computer Graphics course - MSc Computer Science and Engineering @ Polimi.
Vulkan and CMake are required.
- Clone the repository;
- Open a terminal and run the following commands:
cd drone-delivery
cmake .
make
./drone-delivery
If you're using a modern code editor, when opening the project folder it should be automatically recognised as a CMake project. In that case you can skip step number 2: just press the "run" button and you're good to go!
Plane flight is simulated using a simple physics engine. The plane is controlled using WASD and arrow keys to control throttle, roll, pitch and yaw. The physics engine implements:
- kinematic particle equations for linear quantities;
- quaternion-based rotation (without storing rotation speed) + damped Roll-Yaw-Pitch (RYP) inputs;
- parabolic and logarithmic implementations of aerodynamic wing to simulate lift.
Package-dropping is implemented in a similar way, but disregards rotations and lift.
Collision detection is vertex & height based. First, if the plane's height is below 0, a GROUND collision is detected. Otherwise, we find the vertex mesh with the highest y among those within a certain circular x, z radius from the plane. If its height is greater than the plane's, a MESH collision is detected.
Collision reaction depends on the type of collision that was detected. In case of GROUND collision, the plane is simply kept above ground and its yaw is preserved, while all other rotations are zeroed. In case of MESH collision, the plane is "bounced" back in the opposite direction of its speed.
The camera allows for two modes: the classic follow camera and a stationary camera on the landing strip, pointed to the plane. The camera is damped during each of the two states and during the switch, creating a smooth transition between the two.
A total of 5 custom pipelines exist, each implementing a different vertex-fragment shader couple. Complete list of the pipelines:
- Overlay: splash screens and text/symbol overlay during game;
- Metallic: plane and arrow;
- Opaque: city blocks;
- Emit: roads with lampposts;
- Animation: propellers.
Some pipelines implement instanced-rendering to draw more instances of the same model in different positions without needing to store a different model for each. This is how the road tiles or the packages on the overlay are rendered.