Skip to content

SaifDevAI/Snake-Game-Assembly-Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retro Assembly Language Snake Game

A classic, retro-style "Snake" console game written in x86 Assembly Language (MASM 32-bit). The game runs in protected mode using the Irvine32 library and standard Win32 console APIs.


🚀 Key Features

1. Dynamic Speed Progression

  • Automatic Acceleration: The game starts at a comfortable speed delay of 150 ms.
  • Dynamic Progression: Every 5 points earned, the game speed automatically increases by 10 ms to raise the stakes.
  • Speed Cap: The speed is capped at 50 ms to keep the gameplay fast but responsive and fair.

2. Golden Coin & Speed Boost System

  • Regular Coin (80% Spawn Rate):
    • Represented as a green *.
    • Worth 1 point.
    • Audio cue: A quick, crisp 1000 Hz beep.
  • Golden Coin (20% Spawn Rate):
    • Represented as a flashing yellow $.
    • Worth 3 points and grows the snake by 3 units sequentially.
    • Audio cue: A double ascending beep (1500 Hz and 2000 Hz).
    • 2x Speed Boost: Eating a golden coin grants a 10-second speed multiplier (boost), reducing input delay by half. The active speed value displays on the scoreboard in real-time.

3. Session High Score Tracker

  • Real-time Record Updates: The scoreboard displays your current score and the highest score achieved during the current session.
  • Personal Best Display: If you beat the current high score, the record updates instantly on the screen and is shown prominently on the Game Over screen.

4. Retro Audio Feedback

  • Synthesized 8-bit sound effects using the Win32 Beep API for game events:
    • Regular Coin: Single high beep.
    • Golden Coin: Dual rapid ascending beeps.
    • Game Over: A long, low-pitched warning drone (250 Hz for 500 ms).

🎮 Controls

Ensure Caps Lock is disabled before playing:

Key Action
W Move Up
A Move Left
S Move Down
D Move Right
Enter Pause the Game (Press movement key to resume)
X Quit the Game at any time

🛠️ Build & Installation

This project is configured to build on modern systems using Visual Studio 2022 and the Irvine32 library.

Prerequisites

  1. Visual Studio 2022 (with "Desktop development with C++" workload installed).
  2. Irvine32 Library: The library files should be placed at C:\Irvine\irvine.

Project Configuration Details

The Visual Studio solution and project files have been pre-configured with the following settings:

  • Target SDK Version: 10.0.26100.0 (Windows 10/11 SDK).
  • Platform Toolset: v145 (Visual Studio 2022 build tools).
  • Safeseh Image Generation: Set to false (/SAFESEH:NO) to prevent link-time errors with legacy assembly libraries.
  • Irvine Paths: Pre-configured MASM include paths and linker search directories pointing to C:\Irvine\irvine.

Compiling and Running

  1. Open the solution file main.asm/main.asm.sln in Visual Studio 2022.
  2. Select Release and x86 configurations.
  3. Right-click the solution in Solution Explorer and select Rebuild.
  4. Run the compiled executable SnakeGame.exe generated in the root folder.

About

A retro x86 Assembly (MASM 32-bit) Snake game featuring dynamic speed progression, a golden coin system with a 2x speed boost, session high scores, and synthesized retro audio feedback via the Win32 Beep API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors