This repository contains the source code and the .blend models for the school project due for the Computer Graphics class at Politecnico di Torino.
The project required the development of a game in C++ and OpenGL and a rendering of a scene in Blender, from modeling to texturing to lighting.
Both the game and the rendering are set in China.
The game is an endless runner where Long, the Chinese dragon, has to fly over the Great Wall trying to collect coins and ying-yang medals while avoiding obstacles.
It is written in C++ and OpenGL. The models are managed with the Assimp library and textured with DevIL.
In order to have an endless runner, the Great Wall is made of pre-built blocks that are dynamically concatenated at runtime and are shifted below the dragon, which actually does not move. Each block is described by a configuration file containing the coordinates of each element (coin, ying-yang medal, lantern, flag, tower, etc) that has to be positioned on or over the wall. As soon as a block has been used, i.e. it goes out of the screen, it is destroyed in order not to waste memory.
The dragon's body is made of spheres between the head and the tail, each representing a health point. Every time the dragon collides with an obstacle, a sphere is lost and the body becomes shorter. Once the dragon hits another obstacle having only its head and tail left, the game is over.
In order to avoid having an extremely long dragon, the speed of the game increases in order to reach a high level of difficulty and increase the chances of losing health points.
Main Menu | Game level |
- ↑ and ↓ for moving Long up and down
- Collect coins for earning score points
- Collect ying-yang medals for earning health points
The rendering is inspired by a scene of Po's Dad's restaurant in Kung Fu Panda. As a requirement, the scene had to contain Cycles materials, particle systems (bamboo branches and panda's fur), fluids (water), cloths (flag on the bench) and armatures (panda's bones).
Bamboo particles | Detail for the panda |