Tic Tac Toe Evo

Store link

Tic Tac Toe Evolution

The story

Was the year 2012 when I started learning the Android SDK. My goal was always the same: to develop video games. So also thanks to the help provided by the book Beginning Android Games by Mario Zechner I decided to venture into the realization of a new project.

At that time I wasn’t too much busy with my work commitments so I spent all my spare time on this activity. Like my previous experiences it gratified me enormously. I was free to design every aspect of my game that is so exciting every time!

Thus I developed the basic idea of a game based on the classic Tic Tac Toe. It is a very simple game where two players placing their distinctive symbol on a 3×3 board, trying to line up 3 of them in a row, column or diagonal.

Ok sure, it wasn’t me the man who invented the Tic Tac Toe game and there were thousands of similar games on the store. I didn’t care much about this. What interested me most was to gain experience, express my creativity and extend somehow the original game (mainly permitting to play on boards greater than the classic 3×3).

I wanted to understand how the Play Store world works and take the first steps in the marketing field. Let’s say this project was merely an experiment.

The realization committed me for a few weeks, since I didn’t have full Android expertise and I studied while working on the project. In addition to this, however, I wanted to give the game a particular characterization (or theme) with a futuristic flavor. For this I used Bryce 7 to create the setting and the elements of the menus.

That part was made up of ray-traced – and consequently – static elements. But I wanted to preserve a certain continuity between the menus and the game aspect.

At a distance of time I can sincerely claim that I failed in this intent (and this problem was also criticized by some). There is a substantial difference in terms of graphics quality between the menus section and the actual game.

On the other hand this has happened for some reasons. First of all I wrote the whole code from scratch, without using any graphic engine, but only the raw interface to the OpenGL API offered by the Android SDK. Further I had no skills in the most advanced OpengGL ES features like shaders, etc.

In addition to this, I spent much more time than I expected initially for the realization of the AI against which the players would have had to compete.

The AI that I imagined should have an adjustable “computing power” so that it could offer different levels of difficulty. I wanted to go further with an algorithm that could play on boards larger than the classic 3×3. But I’ll talk about this later.

Because I was in a hurry to see my game published on the store I made another mistake. It is true that the user can play against the computer and complete all the games he wants, but the application is lacking of several features.

There is no scoring system, there is no way for the player to keep track of his progresses not even the possibility of interacting with social media.

To make things worse I didn’t even have any ideas about the “business model” to use. That’s why I published on the store, following a frequently used strategy, two versions of the same game: a “lite” version, cut off by some features (it was possible to play only on the 3×3 board), and a “complete” one at a cost of 0.79 euros.

The “lite” version saw a few hundred downloads, while a few copies were actually purchased… After some time I gave up and removed the game from the store. And this was my third mistake…

Was it a failure then?

I still like the graphics I created, the high-quality background music composed by my brother Marco Pesci and also the game mechanics.

I’m sure I could have done better if I had faced the project with more patience, farsightedness and some more expertise… but I don’t consider it a failure, indeed I am fond of this work and proud of what I managed to do.

The game


When the game starts, after displaying my logo, the user is taken to the introductory screen when the background music is played

The screen with the logo
The introductory screen

after few seconds the application automatically switches to the main menu. This offers the possibility to access further three sub-sections: the credits section, the options and the screen to start a new game.

The main menu

The Info submenu

This section consists of a simple static screen showing the names and references of the authors (my brother and I). Nothing else.

With the “Back” command you can return to the main menu.

The Info screen

The Options submenu

Since the options for the actual game are contained in the next section, here only the commands to activate / deactivate background music or sound effects have found a place.

The Options screen

The Start submenu

Selecting “Start” gives access to the heart of the app itself, which offers a certain range of game options.

The Start screen

At the left and right ends there are the symbols that will distinguish each of the two players on the board. In particular, a green X is represented on the left, and a red circle on the right.

The presence of these symbols on this screen is justified by the fact that they identify the type of player who will participate in the match. The app supports 5 different types of players:

  • Human player – represented by a human head – which requires input from a real player via the device touch.
  • Randomic Artificial player – represented by a gaming dice – is a kind of degenerate player. It only makes random moves can appear pretty useless, but it represents a basic level that young children could appreciate.
  • Weak artificial player – represented by a pocket calculator
  • Mid-level artificial player – represented by a notebook
  • Strong artificial player – Represented by something that looks like a server’s case.

Consequently, by tapping on the images just above the player symbols, you set who should play against whom and from which symbol will be represented.

It should be noted that the game supports all the possible combinations of the 5 types of players. Therefore it is possible to start a game where a real player is represented by the symbol X against the computer with the circle symbol, and vice versa.

Human player against mid-level artificial player

You can select two human players and let the game be played by two people on the same device.

Here we chose to play human against human

You can even select two artificial players and watch them fight each other for the victory.

Here two artificial players will play

The original game does not provide any rules for defining which of the two players will have to make the first move. For this reason there is a selector in the current screen that has three states:

  • The X starts first
  • The circle starts first
  • The player who can make the first move will be chosen randomly.

This selector consists of the image placed under the word “1st” in the middle at the top of the screen. The random selection mode, of the player, is represented by a yellow question mark, while the other states are indicated by a symbol identical to the one representing the player.

A board is shown in the center of the screen. This is the board type selector. Players can compete on 3×3, 4×4 and 5×5 boards. In the first two the number of elements that must be aligned to win corresponds to the size of the board, while on the last one you can decide if the players’ goal is to align 4 or 5 symbols.

The 3×3 board is selected
The 5×5 board is selected with victory denoted by 4 aligned symbols
The 4×4 board is selected
The 5×5 board is selected with victory denoted by 5 aligned symbols

The gameplay

By tapping on the “Start” command, the player is projected onto the game area screen. Here are some indicators visible; the symbols of the two players at the top, while at the bottom on the right there is a button to pause the game.

Depending on which of the two players must make the move, their symbol will be highlighted, while the other will become slightly transparent.

The game screen, with the X symbol highlighted representing the player that must make the next move.

The game is conducted by placing its symbol in turn on the board until one of the following conditions is verified:

  • One of the players manages to place the expected number of symbols in a row
  • The entire board is filled without either of them reaching the victory condition. In this case you go to a draw.
The image takes up a game that ended in a draw

Then the game ends and the player is asked if he wants to play a new game or return to the main menu.

The player is asked if he wants to play a new game or return to the main menu

At any time during a game, the player can press the pause button at the bottom right. An overlay menu will appear with the commands to: continue the paused game, start again from the beginning or return to the main menu.

The AI

I started from the observation that a possible brute force search could quickly find solutions to every situation. This is because as the research deepens, more and more squares on the board are occupied, consequently the number of possible further moves decreases.

I therefore imagined that by adjusting the level of depth that the algorithm could reach, I could have varied the level of correctness (or rather of strength) of his answers.

My hypothesis turns out to be obviously correct but … on the devices of that time (I owned a Samsung Galaxy Note I) when I was playing on the 5×5 board the waiting time for answers from the AI was excessive. It not took hours to find an answer, but they represented unacceptable wait times for any player.

With some difficulty I introduced a system for pruning the tracks that the algorithm was forced to follow, which drastically decreased response times.

Moreover the algorithm provided the same answer if placed in front of the same arrangement of symbols on the board. To overcome this problem and make the AI less predictable, I managed to randomly select one of the answers found, sorted in a list by their strength, instead of always taking the best ever.

Leave a Reply

Your email address will not be published. Required fields are marked *