Skip to content

Thiyaga1586/SerpenTech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ Serpentech

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.


๐Ÿš€ Game Modes

  1. Classic Mode
    Play the traditional snake game with a twist โ€” experience dynamic boosters, persistent high scores, and enhanced gameplay responsiveness.

  2. TimeStreak Mode
    A high-speed challenge mode! Rack up the most points in a limited time using boosters and precision control.

  3. Multiplayer Mode (Same system)
    Two players compete on the same screen in real-time snake action.

  4. VS Computer Mode
    Battle against a computer-controlled snake that uses a shortest path algorithm to grab fruits before you do!


๐Ÿงช Power Boosters

Power-ups randomly spawn in Classic and TimeStreak modes to supercharge gameplay:

Booster Name Effect Description
2x_booster Speed Booster Doubles the snake's speed temporarily.
slow_downer Slow Downer Halves the snake's speed to offer better control.
point_doubler Double Point Earn 2x points per fruit collected for a short duration.
length_shortener Length Reducer Instantly reduces snake length by 3 segments, maintaining minimum length 4.

โš ๏ธ Power boosters despawn if you didn't collect it in a short span of time.


๐Ÿ“Š Scoreboard Support

  • Persistent high score files are maintained for:
    • Classic Mode
    • TimeStreak Mode
  • Scores are automatically saved, loaded, and displayed in-game.

๐Ÿ’ช Controls

VS Computer / TimeStreak / Classic

  • W โ†’ Move Up
  • A โ†’ Move Left
  • S โ†’ Move Down
  • D โ†’ Move Right

Multiplayer Mode

  • Player 1:

    • W, A, S, D for movement
  • Player 2:

    • Arrow Keys (โ†‘ โ† โ†“ โ†’) for movement

๐Ÿ—ƒ๏ธ Screenshots

Enter Name Screen Menu Screen Classic Mode
image image image

|

TimeAttack Mode VS Computer Mode Multiplayer Mode
image image image

|


๐Ÿงฉ Special Game Rules

๐ŸŽฎ Multiplayer Mode Rules

  • Dual Snake Control: Two snakes are controlled by separate sets of keys:

    • Player 1: W, A, S, D
    • Player 2: โ†‘, โ†“, โ†, โ†’
  • 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.

๐Ÿค– VS Computer Mode Rules

  • Single Player + AI: Player uses W, A, S, D to 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 AIThink function.
    • AI avoids collision with the player while approaching food.
  • Game Over Display:

    • Message displays the winner and prompts return to main menu with ENTER.

๐Ÿ› ๏ธ Setup & Compilation

๐Ÿ“… Prerequisites (Only if building from source)

  • C compiler (gcc, clang, etc.)
  • raylib library
  • Git
  • (Optional) CMake

โš ๏ธ If you're using the prebuilt .exe on Windows, you can skip installing these.


Windows Users

๐Ÿ› ๏ธ Option 1: Using MSYS2 (Recommended)

  1. Install MSYS2

  2. Open the MSYS2 terminal and run:

    pacman -Syu
    pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-raylib
  3. 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

๐Ÿ› ๏ธ Option 2: Manual Setup

๐Ÿ› ๏ธ Option 3: Ready to Play (Pre-compiled EXE)

If you are on Windows and prefer not to compile the source code yourself:

  1. Visit the Releases section of this repository.
  2. Download the latest Serpentech.exe build.
  3. Double-click to run โ€” no installation required.
  4. 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!


Linux

# 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

MacOS

  1. Install Homebrew
  2. Install raylib:
brew install raylib
  1. 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.


๐Ÿ“– License

This project is licensed under the MIT License. See the LICENSE file for more info.

๐Ÿ’ก Credits


๐Ÿ”— Links


Enjoy the game and feel free to contribute. ๐Ÿš€

About

Serpentech is a feature-rich Snake game developed in C using the Raylib graphics library, offering a modern twist on the classic arcade experience. It includes four distinct gameplay modes: Classic, Multiplayer, Versus Computer (powered by a shortest-path algorithm), and Timestreak mode for time-based challenges.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages