This project is an implementation of the classic Snake Game using only the OpenGL library. It was developed as part of the BracU CSE423 lab projects for Spring 2023. The unique requirement for this project was to create the game solely using PyOpenGL and the included OpenGL libraries, without utilizing any other libraries like PyGame.
To run the Snake Game on your system, follow these steps:
-
Create a Python project in a virtual environment (venv) using your preferred development environment, such as PyCharm, for a smoother setup process.
-
Install the necessary libraries within the virtual environment by following these steps:
- Open the terminal inside the virtual environment.
- Check your Python version by running the following command:
py -V
- Visit the following link to download the required Python Extension Packages for Windows - Christoph Gohlke (Click here)
- Download the following files from the website:
PyOpenGL‑3.1.6‑cp3x‑cp3x‑win_amd64.whl
ReplacePyOpenGL_accelerate‑3.1.6‑cp3x‑cp3x‑win_amd64.whl
cp3xwith your version of Python. For example, if your Python version is 3.10, the filenames should be:PyOpenGL‑3.1.6‑cp310‑cp310‑win_amd64.whl
Note thatPyOpenGL_accelerate‑3.1.6‑cp310‑cp310‑win_amd64.whl
cp3xis replaced bycp310to match your Python version. Now Install these libraries usingpippip install PyOpenGL‑3.1.6‑cp3x‑cp3x‑win_amd64.whl
pip install PyOpenGL_accelerate‑3.1.6‑cp3x‑cp3x‑win_amd64.whl
-
Download the
snake.pyscript and place it in the same folder as your project. -
Run the game and enjoy playing!
- Use the arrow keys (up, down, left, right) or the keyboard keys (W, A, S, D) to control the snake's movement.
- The objective is to eat the food (represented by squares blocks and circles) to grow longer.
- Avoid colliding with your own body, as it will result in game over.
Enjoy the classic Snake Game experience brought to you through the power of OpenGL! GG ! Enjoy the OG game!!
This project is licensed under the MIT License.