TooTic2Tac Development and Design

Project Description

I started this project on the Godot Engine. It's a popular engine that has rapidly been growing in versatility and favorability. I like the engine because it has a more intuitive interface for me and the built in GD Script is more or less python with a wrapper on it. I also like the engine because it is completely open source and the developers plegde to keep it that way.

I had never used the engine before so I wanted to choose a rather basic game to start with. Hence, tictactoe. I had been playing a small two player mobile game a while ago when I got the inspiration. Why not take simple (and lack luster) board games from history and spice them up. Make them wacky or whatever. I thought about other random minigame like games I'd played as a kid and really liked. Some of the first elements I knew I wanted were 1: Minigames, 2: Random Events, and 3: an AI to play against since I won't always have someone to play with.

Alpha Beta Pruning AI Win
Fig.1 Alpha Beta Pruning AI Win.

AI - α β Pruning

After the basic construction of a TicTacToe board was applied, the first of the other 3 goals I set out to do was inncorporate an AI. Researching search tree methods for table top game playing, I settled on using Alpha Beta Pruning to teach my AI how to play my game. I gave the AI a score for the best locations it could go in a 3x3 or 4x4 or 5x5 board as I made my game so it could randomly expand up or down to a 3x3 or 5x5 board. It would way its options by sum positive values to places that put multiple O's in a line. It would sum negative values if multiple X's were in a line. It would look at all possible futures where O's and X's could be placed according to the current layout of the board given the player's last move, then sum all negative and positive values for potential options together until it found the most optimal playing position. It worked well enough to be a formidable opponent I think. It is a little predictable now having played against it for hours, but I think it's just the right amount of smart for casual play. It's evaluation funciton is not perfect, but does a fair enough job, that with the other random elements of gameplay, it can still gain an edge on the player if they aren't watching closely.


Expanding and Shrinking
Fig.2 Expanding and Shrinking.

Dynamic Board Sizing

The TicTacToe board starts as a 3x3 with the users able to tap any spot to place an X or O on their turn. Randomly as the players choose squares, events can occur. The most basic event is board sizing and resizing. With 3x3 being the minimum board size, the board can expand to 4x4. Then the players are expected to make a "4 in a row" connection in order to win. The same can happen again expanding to 5x5 where "5 in a row" are needed to win. The direciton of the expansion is also random. It always expands a row and column by one integer but that can be in any direction. The expanding factor adds an exponential number more potential spaces to the board. Thus, it can become quite daunting on the player with the chance of winning rather slim if the other player can easily block your goal row with so many options in the row. That's why the board can also shrink after expanding. The board can return to 4 or 3 dimensions in any random direction. It ignores what is already on the board and arbitraily selects a direction. If players have pieces in a row that would win after shrinking, the game is over and a win is given. Animations were made to indicate the location of expansion or shrinkage and buttons were named and placed in the the spots or removed respectivley.


Bomb used in Top Right Corner
Fig.3 Bomb used in Top Right Corner.



Bombs

Another random event is the unveiling of a bomb under a tile. As the players tap, there is the random chance a bombe may be given to the opposing player. The bombs, as suggested by the + on their face, blow all X's or O's in rows orthogonal to the bomb's placement. It may only be placed on the player's turn, takes up the turn action of the player, and can only be placed on empty squares. In other words, the bombs can't be placed on top of exisiting X's or O' meaing it can't be thrown out without discression just to prevent an enemies win. There is a good chance it will destroy some of the placing player's own symbols. Making the bombs was probably the most fun part of the development process. I made sure to record unique noises for all parts of the game. I made nosies for expanding and shrinking, but the bombs take the cake. It sounds just as it needed to in order to remind me of making explosion noises as a kid. Players can obtain unlimited bombs during the game, but after a winner or draw has been made, the bombs are discarded. The AI will randomly place a bomb if it has one on any potential random turn it has.

Rock Paper Scissors

The first minigame happens to also be a random event. In this minigame we play basic rock paper scissors, except there's a catch. There's a good chance the items that look like a typical rock paper or pair of scissors may look like on of the others. For example there are scissors that are designed to look like they are carved out of stone. The algorithm I wrote for the game, ensures each player gets a set of exactly one rock, one paper, and one pair of scissors, but there may be overlapping apperances. There may be what clearly is a piece of paper, but also a piece of paper that looks like it is folded into scissors. In this case the scissors paper look alike is scissors, because the paper is clearly paper. There would also be no other scissors option and the 3rd object by default would then be a rock. Confused? Good. That's the point. It makes more sense when you've played it once or twice. The game appears in place of a bomb or expansion/shrinking event happening. It oppens in a separate window with a fun parallax background. The AI will randomly choose one of its 3 objects, and may at any random moment choose a different object during the window of selection.

Expanding and Shrinking
Fig.4 Rock Paper Scisors Example.

Drawing Straws

The final minigame happens at the start of the game or after a tie occured in the last game. In this minigame two sticks are displayed to the users moving in the screen at different rates. The two sticks are different sizes, and one is always darker than the other. Either stick could be larger than the other. A random user is given the chance to pick a stick and then the sticks are pulled out and shown to the users with their sizes displayed. The winner is highlighted in white and gets to go first at the start of the TicTacToe game. If the AI is playing agains the player, than the player always gets to pick the stick.

Expanding and Shrinking
Fig.5 Drawing Straws.




































Back to Top