CodegridThursday, 4th October 2018 ◆ Formal or vulgar record (8) Chip-8 Game jams
Codegrid was a game I entered into a game jam back in 2015. It's a programming game in which you write your programs in a 2d grid.
You can play it here.
Playing the game
You have 10 registers down the left-hand side, each of which can hold a number. On the right-hand side you have your program. In each cell you can place one of 13 different operations. Execution starts at the top left and follows the instructions that you place. When the execution dot leaves the screen, the program terminates. Here's an example program which copies the first register into the last register:
The operations you have at your disposal are:
- Arrows — these change the direction the execution dot moves in
- Conditional arrows — these change the direction the execution dot moves in if the current register is non-zero
- Plus/minus — these increment/decrement the value of the current register by 1
- Prev/next — these change the pointer to point the previous or next register
- Jump — this jumps to pointer to the marked register, and marks the initial register
There are 5 levels of increasing difficulty: Copy, Addition, Subtraction, Multiplication, Modulo. I completed the first four levels, but was unable to do the last myself; I just put it in because I think it's good practice to assume other people will be better at your game than you are. I wasn't even sure if it was possible, but I was over the moon when someone came up with a solution! Admittedly, I have absolutely no idea how it works.
I found it quite fun to try and build programs with the limited space available. In some ways, playing this game was a bit like making the game...
Making the game
The game is written in Chip-8, an assembly-style language used by consoles of old. I've never used a language like it before, but it was such good fun. The entire program has to fit in 3.5kB – that includes sprites, data and instructions. You have 16 registers to use (and an extra memory index register). Writing all the game code with these restrictions is really fun.
You can write over your own program if needed. Usually this will be for images or variables, but the door is open for self-modifying code too.
I recommend having a play around in Octo, an online Chip-8 intepreter. It's super fun!
You can see a video discussing all the entries here.