Innovating on Tetris
Tags: unity3d, programming, gamedev, architecture
Published: 2022-06-09 15:17:36

While I am in the games industry, my day job has me in the #DevOps and #SRE world. I wanted to get back to my #GameDev roots, and decided to jump headfirst into a new game prototype: Build Tetris, then _innovate_. 

The following is an _in media res_ snapshot of the planning around my Innovating on Tetris project. Hopefully there is something to learn on how I've approached this project to help you achieve your goals on your gamedev journey.

You can follow along with the open repo [here](https://github.com/JerkyTreats/tetris).

## Step One: Build Tetris

We all know it. Pretty dope stuff.

Uses [SRS](https://tetris.fandom.com/wiki/SRS) rotation, the rotation system users didn't realize they want. Handles wallkicks.

Basically an exact copy of the (amazing) [YouTube tutorial](https://www.youtube.com/watch?v=ODLzYI4d-J8) by [Zigurous](https://github.com/zigurous/). This includes their assets and copypasta `tetromino` data.

There are some nice advantages of taking an existing game and innovating on top of it. It gets you a first milestone _very_ quickly- a couple hours to get Tetris working (thanks to the tutorial). 

From that starting point, I can really start thinking about my goals for the remainder of the project. 

## Step 2: Define Goals

There are a bunch of different goals I'm working on for this prototype. Maximum learning and experimentation is top-of-mind, all the while pushing to become a better developer.

### Design Goals

_Detailed Design requirements in [Blog/multiboard_tetris_design.md](https://github.com/JerkyTreats/tetris/blob/main/Blog/multiboard_tetris_design.md)_
- Stitch multiple boards together.
- After clearing arbitrary amount of lines from current board, move to the next board.
- Complete all boards to complete game.

### Programming Goals

For this project I'll be dusting off Unity3d for the first time in over 4 years (coincidentally my kid is 4... funny how that works). 

The nice thing about choosing a well established casual game with tons of tutorials, is it allows you rediscover all those Unity basics- GameObjects and Components and Monobehaviours. 

From there I can start playing with different features and think critically about the code I'm writing. 

#### Large Goals

* Unity UI **DONE** 
* Data Serialization **DONE**
* Gameplay Manager **DONE**
* Better Input Systems 
* Complete Multiboard Tetris feature requirements

#### Small
- Score/Reward
- Scaling Speed on line(s) cleared.

### Completed Goals

- Complete Tetris Tutorial
- Dynamic Border
- Dynamic Background Grid
- Add proper new piece queue (A bag containing each piece randomly chosen until every piece chosen, then create new bag). "Real" Tetris shouldn't be full random Piece selection.
- Dynamic Camera
- Multiple Boards
- Board Editor mode
- Gameplay Manager

## Known Bugs

- ~~Ghost piece shouldn't search from bottom up, it should start from top and search down.~~
  - If the `I` piece is the first to spawn, its Ghost will be placed in an incorrect position.
  - The ghost for `I` in general seems a bit messed up. I think its because its the only piece that is one size high.