A recreation of the 1980s Japanese puzzle game "Sokoban" for the terminal using a rendering system that utilises ANSI escape codes. Made for a first year university module.
2 months
The player has to select a level before they can start playing. They do this using the level screen shown in Figure 1.0. Green dots show levels the player has completed, the blue dot shows the most recent level the player unlock, and the red dots are levels that are locked.
The players progress through the levels is saved so that the amount of levels they have completed is the same the next time they open up the game.
Coming into this project, I knew that ANSI escape sequences were likely what I needed. These are sequences that when are interpreted by the terminal as commands rather than text and can be used to control the cursor location, font color, or font styling just to name a few. The sequence shown in Figure 1.0 is the one I used to draw pixels onto the terminal.
The sequence shown in Figure 1.0 allows me to set the background of any text character output to the terminal. This means that if I output a space (" ") then it only shows the background color. I found that the font used in the windows terminal means that spaces are two times as high as they are wide so if I output two spaces with the sequence I get a single coloured pixel.
The first problem I ran into was that with the larger scenes I wanted to draw, I was getting very visible tearing as the terminal took a significant amount of time to redraw all the pixels. This is clearly shown in Figure 1.1 with the character. There was one obvious solution for this, just don't redraw whats already there. If a pixel hasnt changed since last draw then just ignore it.
This project write-up is still being worked on, sorry for the inconvinience.