Serpentech is a modern, feature-rich Snake Game written in C using the powerful Raylib graphics library.
Designed with flexibility and gameplay diversity, Serpentech offers multiple game modes, power boosters, and scoreboard persistence โ all in a lightweight and fast application. Whether you're playing solo, competing with friends, or challenging an AI-driven opponent, Serpentech delivers a polished and engaging arcade experience.
-
Classic Mode
Play the traditional snake game with a twist โ experience dynamic boosters, persistent high scores, and enhanced gameplay responsiveness. -
TimeStreak Mode
A high-speed challenge mode! Rack up the most points in a limited time using boosters and precision control. -
Multiplayer Mode (Same system)
Two players compete on the same screen in real-time snake action. -
VS Computer Mode
Battle against a computer-controlled snake that uses a shortest path algorithm to grab fruits before you do!
Power-ups randomly spawn in Classic and TimeStreak modes to supercharge gameplay:
โ ๏ธ Power boosters despawn if you didn't collect it in a short span of time.
- Persistent high score files are maintained for:
- Classic Mode
- TimeStreak Mode
- Scores are automatically saved, loaded, and displayed in-game.
Wโ Move UpAโ Move LeftSโ Move DownDโ Move Right
-
Player 1:
W,A,S,Dfor movement
-
Player 2:
- Arrow Keys (โ โ โ โ) for movement
| Enter Name Screen | Menu Screen | Classic Mode |
|---|---|---|
![]() |
![]() |
![]() |
|
| TimeAttack Mode | VS Computer Mode | Multiplayer Mode |
|---|---|---|
![]() |
![]() |
![]() |
|
-
Dual Snake Control: Two snakes are controlled by separate sets of keys:
- Player 1:
W,A,S,D - Player 2:
โ,โ,โ,โ
- Player 1:
-
Collision Detection:
- If a snake hits its own tail or the game border, the opponent wins.
- If both snakes collide head-on, the score is compared to decide the winner.
-
Fruits: Multiple fruits are placed on the board simultaneously, and each snake can consume them independently.
-
Food Interaction:
- Eating food adds score and increases length.
- Each fruit is initialized with awareness of other fruits to avoid overlap.
-
Winning Condition:
- First snake to cause the other to crash wins.
- If time ends or a collision occurs simultaneously, the highest score wins.
-
Single Player + AI: Player uses
W,A,S,Dto move. The AI snake uses a simple strategy to approach food. -
Collision Logic:
- If either the player or the AI hits their own tail, the other wins.
- If both collide, the scores are compared to determine the winner.
-
Food Competition:
- Both player and AI compete for a shared fruit.
- The one who reaches the fruit first gets the point.
-
AI Behavior:
- AI determines direction each frame using the
AIThinkfunction. - AI avoids collision with the player while approaching food.
- AI determines direction each frame using the
-
Game Over Display:
- Message displays the winner and prompts return to main menu with
ENTER.
- Message displays the winner and prompts return to main menu with
- C compiler (
gcc,clang, etc.) - raylib library
- Git
- (Optional) CMake
โ ๏ธ If you're using the prebuilt.exeon Windows, you can skip installing these.
-
Install MSYS2
-
Open the MSYS2 terminal and run:
pacman -Syu pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-raylib
-
Clone and compile:
git clone https://github.com/Thiyaga1586/Serpentech.git cd Serpentech gcc -o Serpentech.exe main.c -lraylib -lopengl32 -lgdi32 -lwinmm ./Serpentech.exe
- Download the Raylib Windows Installer
- Use IDEs like Code::Blocks or Visual Studio with Raylib linked properly
- Follow Raylib Windows Setup Guide
If you are on Windows and prefer not to compile the source code yourself:
- Visit the Releases section of this repository.
- Download the latest Serpentech.exe build.
- Double-click to run โ no installation required.
- All game data, assets, and embedded highscore files are included and ready to go.
โ No compiler setup needed โ No additional dependencies โ All four modes and power boosters fully functional โ Highscore persistence works out of the box
Enjoy the game instantly with a plug-and-play experience!
# Install raylib
sudo apt install libraylib-dev # Debian/Ubuntu
# Compile and run
git clone https://github.com/Thiyaga1586/Serpentech.git
cd Serpentech
gcc -o Serpentech main.c -lraylib -lm -ldl -lpthread -lGL
./Serpentech- Install Homebrew
- Install raylib:
brew install raylib- Clone and compile:
git clone https://github.com/Thiyaga1586/Serpentech.git
cd Serpentech
gcc -o Serpentech main.c -lraylib -lm -framework OpenGL -framework Cocoa -framework IOKit
./Serpentech
โ ๏ธ MacOS/Linux users must build from source for now. Prebuilt binaries are not cross-platform.
This project is licensed under the MIT License. See the LICENSE file for more info.
- Developed by Thiyaga1586
- Built using raylib
Enjoy the game and feel free to contribute. ๐









