Tic-Tac-Toe 64

Tic-Tac-Toe 64 is a homebrew game for the Nintendo 64 by me (N64 Squid). It’s my first full game for the system and a port of the Tic-Tac-Toe in C that I made a year earlier. As the name implies, it is a game of Tic-Tac-Toe (aka Noughts and Crosses, or Xs and Os) that you can play on the Nintendo 64.

You can get the ROM from its download page by using the password noughtsandcrosses, or through the releases page on Gitlab. You can also find the source code there.


Last year, I took it upon myself to start learning the C programming language, so I started with thinking about a simple game that could run in the terminal. I skipped past some of the common ideas like a text adventure game or Hangman and went for Tic-Tac-Toe instead.

The idea that I had was that I wanted to make a game that used dynamically allocated memory on the heap, so a board with a variable size would be great for this. So I came up with the idea to make it a bit unique by adding board sizes from 2×2 to 9×9 as well as an AI opponent that you can play against.

That’s the basic reasoning behind it, but you can really just find out more on the main page about the PC version.

N64 version

The project remained finished for quite some time until I recently started working on my series of Libdragon tutorials. While writing the section on the Libdragon console, I was thinking of what is the minimal viable game that could be made with the fewest libdragon modules, and the answer was one that just used the controller for input and console for output.

Out comes this game that I had stored away for a while to the rescue, begging to have a Nintendo 64 port made for it. Since the logic sections of the game were already written, all that was needed was to change the game flow and the user interface.


The sub-functions (check_win, bot_turn and draw_board) remain mostly intact, they provide the same sort of functionality that the original version did. Where things really start to differ are in the main function.

After initialising a bunch of variables (which are fairly self-explanatory), we get started on the main loop. In every frame, we go through this process:

  1. Get the controller input.
  2. Add the logo at the top of every frame buffer
  3. Check the stage in which we are at.
    1. Title screen
      • Wait for the player to press A.
    2. Player select screen
      • Wait for up/down to be pressed to change the player count.
      • Wait for the player to press A.
    3. Stage size screen
      • Wait for up/down to be pressed to change the size.
      • Loop between 2 and 9 to prevent overflows.
      • Wait for the player to press A.
    4. Game screen
      • Determine which controller port to read from (in case P2 isn’t plugged in in a 2-player game).
      • Use the D-pad to change the cursor’s position.
      • Use the A button to place a token if the slot isn’t occupied.
        • Check if all moves have been used. If so:
        • On a 2-player game, switch players
        • On a 1-player game, let the bot play
      • Draw the game board and descriptive text to the frame buffer
      • Check for winners
        • If there’s a winner or the board is full, announce the results
        • Wait for the Start button to be pressed to reset the game
  4. Print the frame buffer

Tic-Tac-Toe 64 style and gameplay

Tic-Tac-Toe 64 is a very basic game, so there isn’t much to it’s style. I gave it a green-on-black text colour so that it has a bit of a matrix-y feel to it.

The gameplay is pretty much that of regular Tic Tac Toe. Your objective is to fill a row, column or diagonal with your token, and prevent your opponent from doing the same.

You can choose from a range of board sizes from 2×2 to 9×9.

  • 2×2 is trivial since the first player always wins.
  • 3×3 is the standard size and also the most interesting to play.
  • 4×4 to 9×9 are also trivial since it’s very easy to block, but very hard to complete a row. So to add some complexity to these games, players can place multiple tokens per turn depending on the board size.

Just like the PC version, it is impossible to win a 3×3 map against the AI, you can only tie against it. There is one exception though, can you find it? 😉

Review and conclusion

I didn’t make Tic-Tac-Toe 64 with the intention of being a masterpiece, but rather to have it be a stepping stone in the process of learning to make games for the Nintendo 64 using Libdragon.

That said, it is a fairly complete game. I don’t think there’s much to add to Tic-Tac-Toe 64 in terms of features except for maybe a graphical user interface, but that would defeat the point of it being a purely text-based game for the N64.

When writing the original PC version, I came up with some additional ideas like having multiple AI players or winning with fewer than a full row to make larger boards more fair. However, this might be a bit too much for such a simple concept. Besides, I think it works fine as it is.


Subscribe to the mailing list

Follow N64 Squid

  • RSS Feed
  • YouTube

Random featured posts