# jminos

Modern stacker game with every polyominoes from size 1 to 15, made in C++ with [SFML 3](https://www.sfml-dev.org/)!

## Download

// TODO when the game is finished //

This game has been tested on and built for Windows 11 and WSL2 Ubuntu.  
If your OS isn't compactible with either of theses two, you can try [manually building the project](#manual-build).  

## How to play

Choose which pieces you want to play with and stack them up until you either win or top out!  
Make full lines to make them dissapear.  
Use the different spins to kick the pieces in spot you couldn't imagine were attaignable!  
Each gamemode has its own objective, but you can play as you wish.  

You can see and change in-game keybinds in the **SETTINGS** section of the main menu!  
All of in-menu navigation is done with the **arrow keys**, the **Enter key** and the **Escape key**. Theses are unchangeable keybinds.  
You will find more infos about the Rotation System, the scoring system, or the different pieces type in the **INFO** section of the main menu.  

## Features

- Every polyominoes up to pentedecaminoes!
- 7bag with proportionnality for each polyomino size!
- Customizable board size!
- Customizable keybinds!
- 0° rotations!
- AutoRS as the Rotation System!
- IRS, IHS, infinite hold, and other leniency mechanics!
- Very bland interface!! (i'm not a designer)

### Available gamemodes

- SPRINT : clear 40 lines as fast as possible!
- MARATHON : clear 200 lines with increasing gravity!
- ULTRA : scores as much as possible in only 2 minutes!
- MASTER : clear 200 lines at levels higher than maximum gravity!
- ZEN : practice indefinitely in this mode with no gravity!

### Screenshots

Pentedecamino jumpscare
![](./doc/readme/big_piece.png)

Pieces select screen
![](./doc/readme/pieces_selection.png)

AutoRS demonstration
![](./doc/readme/rotations.gif)

0° spins demonstration
![](./doc/readme/rotation_0.gif)

## Manual build

This project uses xmake for compiling, xmake is cross-platform and works in most OS, xmake also automatically install supported librairies.  
To be able to build this project, you need to [have xmake installed](https://xmake.io) and have a compiler with C++20 compatibility.  

### Build the project

``cd jminos``

``xmake``

If you need to change the toolchain (for example using gcc):  
``xmake f --toolchain=gcc``

### Run the project

``xmake run``  

The program will generate the polyomino files for you if you don't have them.
As this is a lengthy process, debug mode limits pieces size to 10.
To switch between debug and release mode:  
``xmake f -m debug``  
``xmake f -m release``

If for some reasons you wanna run the command line version (not updated):  
``xmake build text``  
``xmake run text``

### Package the project

// TODO when the game is finished //

## Benchmarks

### One-sided n-polyominoes

| n | Number | Generation | File storing | File retrieving | File size |
| - | - | - | - | - | - |
| 1 | 1 | 0s 0.005622ms  | 0s 0.750955ms  | 0s 0.014016ms  | 2 bytes |
| 2 | 1 | 0s 0.005758ms  | 0s 0.181323ms  | 0s 0.012256ms  | 3 bytes |
| 3 | 2 | 0s 0.017525ms  | 0s 0.054497ms  | 0s 0.006431ms  | 8 bytes |
| 4 | 7 | 0s 0.050554ms  | 0s 0.067617ms  | 0s 0.010984ms  | 35 bytes |
| 5 | 18 | 0s 0.191971ms  | 0s 0.109905ms  | 0s 0.021234ms  | 108 bytes |
| 6 | 60 | 0s 0.651757ms  | 0s 0.327465ms  | 0s 0.04558ms  | 420 bytes |
| 7 | 196 | 0s 3.38847ms  | 0s 1.94434ms  | 0s 0.258777ms  | 1568 bytes |
| 8 | 704 | 0s 22.7411ms  | 0s 10.0103ms  | 0s 1.34813ms  | 6336 bytes |
| 9 | 2500 | 0s 66.2949ms  | 0s 20.6137ms  | 0s 2.56374ms  | 25000 bytes |
| 10 | 9189 | 0s 194.764ms  | 0s 84.5884ms  | 0s 9.64467ms  | 101079 bytes |
| 11 | 33896 | 0s 759.182ms  | 0s 378.494ms  | 0s 44.1424ms  | 406752 bytes |
| 12 | 126759 | 2s 709.277ms  | 1s 530.34ms  | 0s 155ms  | 1647867 bytes |
| 13 | 476270 | 10s 668.308ms  | 7s 395.512ms  | 0s 765.601ms  | 6667780 bytes |
| 14 | 1802312 | 45s 606.597ms  | 32s 28.7977ms  | 2s 919.653ms  | 27034680 bytes |
| 15 | ~6M | ~5mn  | ~5mn  | ~10s  | ~100 MB |

_File storing includes normalizing and sorting all polyominoes before writing them to the file._  
If you want to know more details about the generation and storage of polyominoes, [check the documentation](/doc/)!  

Run it yourself by typing:  
``xmake build benchmark``  
``xmake run benchmark``

## Credits

Library used: [SFML 3](https://www.sfml-dev.org/).  
Font used: [Press Start](https://www.zone38.net/font/#pressstart).  

Inspired by other modern stacker games such as Techmino, jstris, tetr.io, etc.  
This game isn't affiliated with any of them.  
