Now that we have created a game model, as well as some 3D assets to display, we can tie them together and have something to interact with. We will create a couple more scripts, one to serve as the view component on the board and one to serve as the game controller. By the end of this lesson, you should be able to play a sample single player experience of Tic Tac Toe.
C#
Turn Based Multiplayer – Part 2
In this lesson we will write the code for the TicTacToe game model itself. This is just an abstract implementation that by itself isn’t playable, and doesn’t actually display anything. It simply has the idea of what the game is, what the rules are, and how to win, etc.
Turn Based Multiplayer – Part 1
In this project, we will be using Unity’s new networking libraries to make a turn-based multiplayer game. I chose a very simple game, TicTacToe, so that I woudn’t be too distracted by much beyond the architecture I would need to achieve my goal. It is my first attempt to implement networking with Unity, so I am very open to feedback. If the general response is positive, then I may take it a bit further and try to make a Hearthstone sytle card game.
Table View – Completed (Part 6 of 6)
It’s finally time to see how everything works together. In this post we will review the “Table View’s” code. This complex component will utilize the TableViewCell, Spacer, Flow, and Container elements we have already discussed to complete a very flexible component which accomplishes every goal I set out to achieve.
Table View – Container (Part 5 of 6)
The final “variable” implementation of our TableView helps to finish tying everything together. It breaks the four possible flows down into two categories: “Horizontal” or “Vertical”. You can think of this as a “Container”, because it causes the “Content” of the “ScrollRect” to adjust its size as necessary to fit all of the cells we have loaded. In addition, this script is responsible for deciding what kind of Flow to use based on the settings of the “Content” itself.
Table View – Flows (Part 4 of 6)
Just like we broke down the logic for determining the size and relative position of cells, we can also break down the logic for their flow. Should they be arranged from top-to-bottom, or bottom-to-top? How about right-to-left or left-to-right? In this lesson we will create a new interface so that we can easily support any of these options.
Table View – Spacers (Part 3 of 6)
Making a scrolling list of cells isn’t that hard. Making a list that only creates as many cells as is necessary for display is slightly harder. Using a single component which can elegantly handle variations like whether or not the cell size can change or what direction the scrolling will occur, is pretty advanced. The best way to approach this kind of challenge is to break it down into manageable pieces.
Table View – Cells (Part 2 of 6)
A lot of the hard work performed by a table view is related to the reuse of its cells. We will need a component that will help ease the process of positioning those cells once they have been added to the table view. It will also need a way to animate into and out of the table view.
Table View – Intro (Part 1 of 6)
I’ve been hard at work creating a prototype for what I hope will be my next blog project – a networked multiplayer card game like Hearthstone. Creating enough menus to build and manage decks has resulted in the need to make a bunch of table views (scrolling lists of items whether cards, heroes, decks, etc). Although Unity has some pretty nice new tools for UI, there are still improvements I felt compelled to address.
Poolers (Part 4 of 4)
Sometimes you want to be able to refer to specific items in your collection by a key. The key could still be an index, but might be a scenario where your collection doesn’t include all of the indices – perhaps it didn’t start at zero or skips items. Alternatively you might want to map an item to something else, like a string of text. These are the kinds of cases where a Dictionary makes more sense than a List. Our final pooler and demo will be based on this use case.