Block Puzzle — Starting the Project
The first game idea that came to me was inspired by an YouTube video I saw of Mitch Koko programming a game in Flutter from scratch. The game was a Tetris, programmed in bulk without a lot of care for structure and tests. But that goes against most of the lessons I have collected over the years. I like structure and tests. I believe they allow me to go faster, but before that a small detour.
Even though there is nothing stopping you from doing a game similar to Tetris, I do know that there is a strong copyright around it and that you will get into trouble if you ever publish your game to the store. Since I am doing this for the learning experience, I hope I do not get into trouble for just developing the game, since I will not be publishing it.
How will I test this?
One of the things that always crosses my mind when starting any development is: how will I test what I am doing? I always do this, no matter if I am starting a new project or changing an existing one. Since this is, for all intents and purposes, a board game, I can simply extract that game logic and use the Humble Object pattern for the UI.
The goal is to have all the game logic in an object that does not depend on any UI parts. It should also make it possible to do crazy things, like having a text version of the game. Maybe that is something you would like to see. If so, reach out!

Game Logic
The idea is pretty simple: the game will provide a simple interface where its users can set the game up (size of the board and initial state), provide actions to the game (movement, rotation and timer ticks) and issue events (line completed and game over).
This means that for my tests, I can set up the board as I wish, issue the actions that I want, and assert that the board is in the state that I expect it to be. This should simplify the development of the game logic, since I do not have to worry about the UI.
What language should I use?
Another question is: what language should I use to build the game? I could use the language I have used the most in my professional career: Java. But that would defeat the purpose of learning new things. It would also make the game harder to deploy on multiple platforms. I have developed toy applications and proof-of-concepts using Flutter in the past. Since Flutter now has support for Web using Web Assembly, that seems to be a good alternative. This way I will also update a little on my basic Flutter knowledge.
Lets start with an empty project
The next step is to set up the project. My goal is to develop step by step, in the open on GitHub. I will be applying tags along the way so that it is easy for you to follow along, even I am already working on the next step.
The first step is to create an empty Flutter project. It is as simple as running:
flutter createThis will give you a counter application, with some tests out of the box (you can see the code that comes out in the tag 000_InitialProject). To run the sample test provided, you can simply run:
flutter testNext Step
That is it for now. The next step is to start writing some unit tests and developing our game engine. We will be making most of the engine without touching the UI. Let’s see where this takes us.
Articles in the series: