Skip to content

Latest commit

 

History

History
107 lines (97 loc) · 3.57 KB

README.md

File metadata and controls

107 lines (97 loc) · 3.57 KB

cliArcade

Play retro games in your linux terminal.

Whats new?

there's hundreds of similar projects out there but what makes this one unique feature is the ability to choose from 6 different rendering resolutions.

video demos

[!TIP] If the output doesn't look right it is probably because of the font your terminal is using, use one of these recommended terminal emulators instead: kitty, wizterm, foot.

vid
Snake
vid
Oscillators
vid
Manual Entry
vid
Replicator
How does it work?

I was inspired by the unicode implementation of braille characters, So I followed a similar approach and made a lookup array to index into:

auto lookupArray = L" ▘▝▀▖▌▞▛▗▚▐▜▄▙▟█";
for (int i = 0, h = height(); i < h; i += 2){
   printBuffer.emplace_back(L"");
   for (int j = 0, w = width(); j < w; j += 2)
      printBuffer.back() += lookupArray[
         rawBuffer[i][j]
         | rawBuffer[i][j + 1]     << 1
         | rawBuffer[i + 1][j]     << 2
         | rawBuffer[i + 1][j + 1] << 3
      ];
}
Project File Structure

[!NOTE] The entire project results in a single object file because this project is small and the compile time is not an issue.

cliArcade
 ├─README.md
 ├─main.cpp
 ├─terminal.cpp          // Utilities for interacting with the terminal.
 ├─baseMenu.cpp          // A base class for creating a selection menu.
 ├─mainMenu.cpp          // A menu for choosing the game.
 ├─resolutionMenu.cpp    // A menu for choosing the resolution.
 ├─games.h               // Included games.
 └─games
    ├─snake
    │  └─snake.cpp
    └─gameOfLife
       ├─gameOfLife.cpp
       ├─patternMenu.cpp // A menu to choose pattern importing method.
       ├─fileMenu.cpp    // A file filter and picker.
       ├─formatMenu.cpp  // A menu for choosing the input format.
       ├─decode.cpp      // Methods for decoding pattern formats.
       └─pattern_files/
Build Instructions


1- Download the source code:

wget https://github.com/3m4r5/cliArcade/archive/refs/heads/main.zip

2- unzip the downloaded file:

unzip main.zip

and optionally remove the compressed archive:

rm main.zip

3- cd into the main directory:

cd cliArcade-main/

4- compile:

g++ main.cpp -o cliArcade

or

clang++ main.cpp -o cliArcade

5- run the executable:

./cliArcade
Roadmap

Here's several improvements that could be made:

  • Support more platforms (windows, macos).

  • Add more games like tetris or pacman.

  • Support more file formats:

  • .cells

  • .rle

  • life 1.05

  • life 1.06

  • apgcode

  • .mc

  • .mcl

  • .plf

  • .l

  • .rule

  • store neighbors count for each cell.

  • Add support for color theming using ansii escape codes.

  • Utilize the gpu for parallelization.