Welcome to the Boxing Game project for the course IS F311: Computer Graphics (BITS Pilani)! This project is a 3D boxing game developed using the Cogra framework. The game features realistic boxing mechanics, player animations, and an immersive environment.
- Boxing mechanics
- Player animations
- Immersive 2D environment
The following dependencies are required to run the project:
- GLUT
- Assimp
- libpng
- OpenGL
To install and run the project, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/boxing-game-cogra.git
-
Navigate to the project directory:
cd boxing-game-cogra
-
Install the required dependencies on Ubuntu:
sudo apt-get update sudo apt-get install freeglut3-dev libassimp-dev libpng-dev
-
Build and run the program using
make # compile the program ./boxing-game-cogra # to run the program make run # directly compile and run
- Use the WASD keys to move the camera.
- Select a player by clicking 1 or 2
- Punch the other player by clicking P on your keyboard
During the development of this project, we conducted extensive research on how to render model objects using the Assimp library. Initially, we attempted to use FBX files, which already contain animations. However, this approach proved to be out of the scope of this project and was overly complicated, leading to several hours of wasted effort.
Ultimately, we decided to simplify our approach and focus on rendering static models without pre-defined animations. This allowed us to streamline the development process and achieve our project goals more efficiently.
Our final approach uses the following techniques:
-
Model Loading and Processing
- We use Assimp to load .obj model files
- Models are triangulated during loading for consistent rendering
- Each model is divided into hierarchical nodes representing body parts
-
Animation System
- Instead of using pre-baked animations, we implemented a custom joint-based rotation system
- Key body parts (arms, legs, torso) are controlled through specific pivot points
- Transformations are applied using a combination of translation and rotation matrices
-
Rendering Pipeline
- OpenGL's matrix stack is used to manage transformations
- Each body part is rendered with custom colors for visual distinction
- Depth testing is enabled to handle proper 3D rendering
# partName shape posX posY posZ scaleX scaleY scaleZ colorR colorG colorB