WARNING: Some technical programming stuff ahead.
A quick spoiler before we go on, despite this being the second log, the game has been released and is working. But yes, there will be a third log, read on to find out the reasoning.
Anyway, hello people of Earth! It’s the second progress log for Tic Tac Head, my fifth entry for OneGameAMonth, a community that encourages people to create a game every month. Check out the first log here, or check out the logs for my other entries here.
As I have said in the previous log, Tic Tac Head is an online, multiplayer Tic Tac Toe game for your Android devices. It’s nothing revolutionary or ground breaking, but it’s a good exercise for learning about how to build a multiplayer game. And truth be told, I did learn all the hassles about building a multplayer experience.
So, how did my endeavour go? Did it end well?
To save you all from reading this wall of text even further, let me just say upfront that the ending is a happy one. Well, sort of 😉
Don’t rush now, let’s do this chronologically. The last time I did say that the game can already be played and the player can win or lose. So I continued from that point and built all the missing pieces like the friend list, multiple games, and even some sort of bot that player can play against. And while I was doing all that, the server app was slowly getting into shape as well.
Keep in mind that while building those features, I didn’t connect the app to the server at all. I simply simulated internet connection by having some game process running in a different thread with 1 second delay. Looking back, that was a really good decision. I managed to build an app that is structured for the internet, so I don’t need to change a lot of stuff later. Or so I thought.
So yeah, I left all the internet stuff to the last day. I spent the first part of that day setting up the connection to Google Cloud Endpoints, and fortunately, once I got it functioning, it just worked beautifully . However, the data I got from the server have a different structure from the ones I used in the app, so we spent the second part of the last day hacking things to make the game works.
In the end, with around 30 minutes to spare, we managed to get a working game where 2 players can play Tic-Tac-Toe back and forth. At that point, I simply uploaded the game and called it a day.
The game uses a lot of interesting technologies, which unfortunately wouldn’t be written in this post. But let me highlight just one them, shown above, which is the Account Picker.
As you can see, with the Android Account Picker player can choose a Gmail account (or Hotmail) associated with the phone and use it as the login alias. The original idea behind this is that we don’t want players to create yet another account to play the game. We also don’t want to deal with the hassle of keeping another social network session and token data, so we simply use those emails as the login ID for the players.
The development is not all bright and sunny though, one thing that really annoys me is the amount of loading indicator needed to be displayed. Getting a game needs a loading indicator, waiting for opponent’s move needs an indicator, sending a move needs an indicator, etc etc. Seriously, writing “if (isLoading()) showLoading() else showGame()” all over the place really complicated the codebase, and writing to a messy source code is the total opposite of fun.
The pain of building an internet-connected game doesn’t stop at that unfortunately. There’s also the problem that being connected added various possible cases to the app that I need to anticipate. For example, I had to starting thinking abouse cases when a request failed, or when the device got disconnected, or when the request is finished but the user isn’t viewing the app.
All those cases added further to the complexity of the app, and coupled with the last minute hacking we did, it made the game codebase one hell of a mess.
Messy or not, the game works. See it in action for yourself in the Vine capture below.
So now it’s all done, where’s the game link?
Unfortunately, the game isn’t ready for public consumption yet. Like I said earlier, there are a lot of cases that I have to think about, and I haven’t tested them all. For instance, I don’t think right now (as the time this post is being written) players can receive a challenge from a player who is not stored on their player list. And I’m sure there are other non-functioning cases like this, so I decided to withhold the game until it’s fully functional.
That said, I have put the game somewhere on the internet. If you’re smart and creative enough, you should be able to find it 😉
(apparently someone already found it before I even posted this log 😄)
All that is the reason why I decided to have another progress log for this game. I planned to keep working on this for a bit more since I wanted to ensure the game is fully functional before making it available to more people. That said, right now I’m aiming to clean up and refactor the whose codebase so it will be easier for me to fix stuff.
And since I left out all the technology stack used from this post, I think I’ll include that in the next log. So stay tuned, people!