In my previous post I outlined three projects that I could possibly complete for my Senior Project this semester. Of those three projects, I have now honed in on the one I feel the most attached to: the Triple Triad remake.
Before I move further with the implementation of the program, I will be exploring the topic further and expanding on my previous post.
As a reminder, I will be using the Unity Game Creation Engine to create this project, as it gives me the full freedom of creating my own assets from scratch, and the writing of my own code to support the project.
To make this project much more manageable, I am going to split it into three main phases, or milestones: Object and UI Creation, Coding Gameplay, and AI creation/ Final Debugging. These three steps do not need to be completed in any specific order, but each of them is required for a complete working game that can mimic its predecessor.
Object and UI Creation
The first part of this project will revolve around me creating all the assets that I will need for the program. This step includes the creation of the game board, the playable card objects, and the user interface (UI).
When making the game board I will be expecting to make use of a matrix to keep track of each of the playable locations in the game. In this case I will be using a 3 by 3 matrix that will contain the XYZ coordinate values of an object that will reside within each element of the matrix. These objects will be used to track the availability of that specific location, and will also compare the values of the card taking residence in that space (if any) to the other cards cardinally surrounding it.
The playable card objects will be created to be held in a hand of five cards by the player, and will be visible to the player at all times during the game. What makes these objects special is that they will have 4 cardinal values (1 for each direction) that will define their “power” in that specific direction. When a player plays a card that has more power than an opposing card in any direction, then those opposing cards will fall into the current players control.
Finally the user interface of the program will have a few elements to it, but I would like to keep it as minimal as possible due to the nature of the project. This part of the creation process includes the addition of counters that will keep track of how many cards each player owns on the game board, a cursor to allow the player characters to select which card to play and where to play it, and an opening menu so the player can choose whether they would like to play against an AI opponent or a friend.
The amount of time that I estimate this section of the project taking is a total of 3-4 weeks.
In this section of the project I will be hammering out exactly what players can do during their turn, what happens when they play cards on their turn, and will keep track of which cards belong to which player on the game board.
The player turn consists of two separate actions. First the player must choose a card from their hand, and second the player will place that card on one of the nine possible spots on the game board. Once the player has completed these two actions, their turn will immediately end, and the same process will be mirrored for the second player. When both players have completed their respective turns, a round will have passed and the turn order resets to the first player.
When a card is played from a players hand onto the game board, a series of comparison functions will be activated to see if the player wins any cards. These comparison functions are simply comparing each of the possible cards opposing cardinal values, and if the card currently being played has a higher value than any of the opposing values they will win those cards.
Once during each players turn, a function will access the current state of card ownership on the game board. In other words, the function will analyze how many cards each player owns and send that data to the UI to be displayed to the player(s).
I expect this section of the project to take some time, and I am uncertain how long it will exactly take. Just to give it a number, I can estimate this section to take anywhere from 5-6 weeks.
AI Creation / Final Debugging
This is the portion of the project that will be the most difficult for me to complete. I have no prior knowledge in creating AI for gaming programs such as this. However, after doing some research into two similar projects, I am sure that creating a complex AI for the player to play against will be possible.
The first of these two projects is from GitHub user Mnylen who based his Triple Triad recreation project on the negamax algorithm. I have never encountered this algorithm before so I decided to look it up on StackOverflow. If I implemented this algorithm I would be using a tree data structure in order to explore all possible moves on the game board given the cards in the AI’s hand. After exploring all possible moves, the AI will determine the “best” move and execute it. I do see one problem with this though, if the AI will always make the best move, then can the player ever win? If I were to base my program on the negamax algorithm I will have to create exceptions to the base algorithm in order to give the player a chance at winning.
The second project I found is from Visadb’s GitHub repository in which he created a bot to play triple triad for the player that would never lose, given that the chance to win was inherently possible. What I like about the algorithm that Visadb uses, is that he created it to be used only in this special circumstance of playing triple triad. It helps boost my confidence in the fact that if I needed to I could create my own algorithm to suit my programs needs. I don’t want to make the game impossible for the player to win, but rather give them a chance to outwit a very crafty AI system.
In addition to coding an AI for my game, I will also be using the remainder of the approximately 6-7 weeks left in my project to complete any final debugging and add any special flare that I would like to the program before calling it “finished”.
The more time I put into planning this project, the more I find possibly hang ups and roadblocks. To be completely honest, I am unsure as to how the AI system is going to work for me, if it will work at all. However, if half of a week of research can ease my thoughts on most of this process, then I am sure that as soon as I hit that roadblock I will find a way through it. I cannot wait to get started coding, the more I think about it the more excited I get.