Snake Game
A downloadable game for Windows
In Snake, the player controls a snake moving around the game board. Using the arrow keys, the objective is to navigate the snake to eat randomly spawning apples, which cause it to grow with each bite. As the snake grows longer, maneuvering becomes more challenging. The game ends if the snake's head collides with its own body or the board's edge.
This game was created as part of my parallel programming class, and it marks my first attempt at developing a game in just two weeks. The game is built using C/C++ and utilizes the Allegro 4.4.2 library, which utilizes DirectX and OpenGL for rendering, along with the Pthreads library to handle multithreading on Windows.
The game uses multithreading to enhance performance and responsiveness. Separate threads handle key tasks: spawning the apple in random locations, processing keyboard inputs, and instantly ending the game if the ESC key is pressed. Meanwhile, the main thread manages the core game loop in the play_game()
function, ensuring smooth gameplay flow.
Background music for the game was generously provided by Pixabay, and sound effects like the apple crunch are sourced from Freesound, while the end game sound is also from Pixabay.
Though a few bugs remain—such as the music restarting when switching screens and occasional crashes on exit—this project showcases a fully functional game framework. It’s been a valuable step in my game development journey, highlighting the core elements needed to create a complete game.
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.