In this post we will begin the first real step of the project as we create the game screen – this will consist of a simple text field for user input and a scrollable text view showing the history of messages throughout the game. I will go in-depth on the description of code for the view controller as well as the manager object that records the message history. When we complete this lesson, you should be able to type messages into the text field and see them get appended to the log of messages in the text view.
Author: admin
Zork – Intro
I have recently needed to learn Swift at work, so I decided to come up with a new game project to help inspire me. Since I am not using Unity, I wanted something light on art and I decided to look at old text based adventure games, like Zork, and found that it actually held quite a few interesting challenges. Simultaneously I have been intrigued by an architecture pattern called Entity Component System (ECS) which I have really wanted to dabble with for awhile now. Although I am new to both Swift and the ECS pattern, I feel that the results are worth sharing!
Partial Class State Machine
You’ve probably been told before not to re-invent the wheel, but when it comes to my own code I couldn’t disagree more. I love re-inventing the wheel because it helps you understand why things are designed the way they are, and occasionally allows you to make something better. I’m currently “thinking out loud” about a whole new approach to the way I implement state machines that can provide functionality I had been wanting but not thought was possible – until now.
Turn Based Multiplayer – Part 5
We’re on the home stretch for this mini-project! It’s finally time to modify the Game Controller so that input is dependent on the players joined in our match, and to make sure that moves made by one player are seen by the other.
Turn Based Multiplayer – Part 4
Networking in Unity is a large and probably confusing topic, so this lesson is designed to help introduce some of the basic requirements that will be needed to complete our muliplayer game. We will create a few specialized assets and scripts and make use of new classes and tags you may not have seen before. By the time we are done, you should understand how to get two players joined in a match, as well as determine who is who.
Turn Based Multiplayer – Part 3
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.
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.