Skip to content

A simple Space Shooter game coded and designed in C++ language in Console Mode.

License

Notifications You must be signed in to change notification settings

Zer0-Bug/ArcadeSpaceShooter_Console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Space Shooter: High-Speed Console Engine

C++ Windows API Pthreads ANSI Escapes License

A high-performance CLI-based Space Shooter implemented in C++. Utilizing Pthreads for asynchronous input processing and ANSI escape sequences for flicker-free terminal rendering, this engine delivers a smooth arcade experience directly within the system console.

° ° ° °



Technical Architecture

The game engine is designed for maximum efficiency in a text-buffered environment, featuring a dual-thread execution model:

  1. Multithreaded Input (Pthreads): Decouples the user input (getch) from the main game loop, ensuring that the game physics and rendering continue to execute without waiting for keyboard hits.
  2. ANSI Render Pipeline: Uses a character buffer (buff[5000]) to build entire frames in memory before flushing them to the console using escape sequences (\e[1;1H), eliminating common terminal flicker.
  3. Collision Engine: Implements precise hit-box logic (HitTest) based on character coordinate intersections between the 3-line player craft and enemy entities.
  4. Hardware Optimization: Utilizes SetConsoleCursorInfo via the Windows API to hide the flickering hardware cursor, providing a clean graphical interface.


Project Structure

ArcadeSpaceShooter_Console/
├── LICENSE                                   # MIT License
├── README.md                                 # Project documentation
│
├── consoleMode/                              # Core Source & Project Files
│   ├── main.cpp                              # Multi-threaded Engine Logic
│   ├── SpaceShooter.cbp                      # Code::Blocks Project
│   └── bin/Debug/                            # Compiled binaries
│
└── Screenshots/                              # CLI Visual Preview Gallery
    ├── consoleMode_v1.png
    ├── consoleMode_v2.png
    └── ...


Game Mechanics

  • ASCII Entity Modeling: Detailed multi-character sprite designs for both the player shuttle and enemy cruisers.
  • Asynchronous Movement: Silky-smooth vertical transition and high-speed projectile firing.
  • Infinite Challenge: Procedural enemy spawning with randomized vertical positioning.
  • Performance Controls: Configurable FIRERATE and SPEED variables for manual difficulty calibration.
  • Hit-Box Precision: Accurate detection across multiple character lines.

Player Controls

Action Key
Ascend W
Descend S
Fire Projectile Space
Quit Game Q


Technical Specifications

Component Specification
Language C++ (ISO Standard)
Threading POSIX Threads (pthread.h)
Terminal Rendering ANSI Escape Sequences
Viewport 34 x 19 Character Matrix
OS Target Windows Console (WinAPI optimized)


Deployment & Installation

1. Repository Acquisition

git clone https://github.com/Zer0-Bug/ArcadeSpaceShooter_Console.git
cd ArcadeSpaceShooter_Console

2. Compilation

The project supports compilation via any standard C++ compiler with thread support (e.g., MinGW/GCC).

Via CLI (GCC):

g++ consoleMode/main.cpp -o space-shooter -lpthread

Via Code::Blocks:

  1. Open consoleMode/SpaceShooter.cbp.
  2. Ensure the pthreads library is linked in Build Options.
  3. Build and run (F9).

3. Execution

Simply run the compiled binary to start the game loop:

./space-shooter


Contribution

Contributions are always appreciated. Open-source projects grow through collaboration, and any improvement—whether a bug fix, new feature, documentation update, or suggestion—is valuable.

To contribute, please follow the steps below:

  1. Fork the repository.
  2. Create a new branch for your change:
    git checkout -b feature/your-feature-name
  3. Commit your changes with a clear and descriptive message:
    git commit -m "Add: brief description of the change"
  4. Push your branch to your fork:
    git push origin feature/your-feature-name
  5. Open a Pull Request describing the changes made.

All contributions are reviewed before being merged. Please ensure that your changes follow the existing code style and include relevant documentation or tests where applicable.

Email × LinkedIn


Releases

No releases published

Packages

No packages published

Languages