I started this project nearly 9 months ago planned to finish in a month, but because of my laziness dragged till now and finally I completed the development now. Very big thanks to my friend Sridhar for his awesome idea of extended Tic Tac Toe game. At first I never thought it would be much fun, but I started doing it because it seemed simple from development point of view. But when I play the game now with any of my friend, I feel the game addictive.
This is an extended version of Tic Tac Toe game with a board size of 9×9. The player scores a point on placing his sign in 4 consecutive tiles. The game can be played with another human player or with AI. At the end of the game based on player’s score and timing a Badge is awarded which can be shared to Facebook / Twitter. This game also supports HTML5 offline mode, thus requiring no internet connection to play after first run.
Tic Tac Toe Extended – Screenshot
* Uses Canvas Tag to draw the game board and player marks.
* supports Offline mode
* uses CSS media queries to scale to different screen sizes.
* Playable on all devices from Desktop, Tablet to mobile devices (with minimum resolution of 320×480)
* GameManager: Handles high level game flow and handles UI controls and their events(using jQuery).
* InputManager: manages game specific input.
* GameState: holds the state of the game from game tile array, scores, clicked tile, elapsed time, player names, etc.,
* GameLogic: core game logics like score calculation, checking for win/lose condition, AI.
* GameBoard: updates and draws the gameboard using an array of BoardTile objects.
* BoardTile: handles a single tile in the board, updates and draws them.
* FBWrapper: connects to facebook and shares the game status.
* TwitterWrapper: connects to twitter and shares the game status.
The challenging part of this project is the AI. At first, I tried implementing some tricky AI which will track all your moves and it either go full defense mode, in which it tries to block tiles making hard for the player to score or go in full attack mode, in which the AI only concentrated on getting score for itself. But implementing those logics proved hard for me.
So I fell back to brute force algorithm which scans the whole board in 8 directions(top to bottom and reverse, left to right and reverse, top left to bottom right and reverse, top right to bottom left and reverse). While scanning cell by cell, it adds up a temporary variable for same consecutive non blank tile it passes. That is if the first nonblank tile is the AI tile itself, and 4 such tile are placed adjancently, then it increases the score of 5th non blank tile by 4.
This same logic is repeated for all rows, columns and diagonals in both directions and a weight-age score is given for each and every cell in the process. In the end, the cell with high weight-age will be marking during the AI’s next move.
The scoring system is very simple, there is a rank calculated based on which the player is given a badge. Higher rank is given as the difference between player’s score and opponent’s score is high and the rank value is lowered as the player spends more time than the opponent.
Offline Mode and Media Queries:
This is the first time for me to try with this technologies. They were very simple but very useful powerful technologies.
Overall, I learned a hell lot from this project including Audio API and many others mentioned above. From my next project, I well try to implement all the things that I learned. And I am thinking of supporting IE from my next project onwards. Hope IE wont be so stubborn in supporting modern web standards.
Oops… I started this blog almost half a year ago and totally forgot to post after that. Nevertheless, I am working on open source projects all these times, which I will write more about, on the following posts.
This post is about the Spirocanvas web application, that I have been developing for the past one month. This application lets user to draw amazing spirographs and allows them to be shared to their friends on social networks. Technically, this project is based on the brand new <canvas> element, that is the part of HTML5 specification and I started this project mainly to learn HTML5.
This app let you draw cool spirographs with a single click. Tapping on Random button at the bottom draws cool looking randomly generated spirographs. You can control exactly how the graph should be drawn using the controls at the left side. Each graph is drawn in a separate layer. These layers can be reordered, deleted using the layers panel at the right.
Update – Jan, 2012:
The development is over and the project is not hosted at http://www.gethugames.in/spirocanvas/. The app still needs some polish at many things. It looks much like a prototype than a complete product. But I am not going to spend more time with this now, as I am trying out new things (especially games) now. But will come back and give final touches to spirocanvas soon.
I, sometimes used to think about open source software and my idea about open source is its good, noble, but I never believed open source software could ever succeed and replace proprietary systems.
Few weeks back, in my office, I had the opportunity to work in GNUstep, but only for a short period. After that I began showing interest in Open Source and spent some time in reading about open source softwares and their milestones. Then, my idea about open source changed dramatically. Mainly because, I realized that the software I had been using for years, which is killing my processor now in home, which found pulsars, which found the greatest prime numbers, which decoded the Enigma message, which first proved that mass distributed computing is feasible, is nothing but a open source software. I am talking about BOINC.
Open Source in Gaming:
Next, Immediately came to my mind is whats the state of open source in Gaming Industry and found this list and was overwhelmed on seeing whats already had been done. So, I decided to contribute and also make use of the open source community for both my career development and for the sake of community.
VERY FEW open source projects proved something like this is possible, but still it has a very long way to go. So, keep the following quote in mind when you think about opensource:
“Ask not what open source software can do for you, but what YOU can do for open source software.”
I started this blog to support open source. Here, I am going to give out sources of all my works till date, which I have been keeping secretly for many years. I think my friend Jyothiswaroop will get a heart attack, if he read this post. I wont allow him to just glance through my code and he also does the same with me. Though we were very eager to see each others work till school days.
My works include small programs that I did in my labs to mini application that I developed in school days and college days, to quench my problem solving thirst. I might also give source of the animation works I did, if my friends who worked with me agree. But dont expect me to give out the source of games that I develop in office; I will post only my personal works.
Please use this for educational purposes and dont commercialize it :)<
I wont put any downloads directly on this blog(actually, blogger wont let me do it). I will be uploading the projects either in code.google.com(for large projects) and Scribd.com(for small programs) and will be publishing the download links here. But, this blog will act as an official page for all the projects hosted outside.