Search This Blog

Wednesday, June 27, 2012

Carrom Challenge



Carrom Challenge






Carrom Challenge
Ata Ullah Kirmani

Overview    

This report is part of the Final Year Project submission in which the detail of project is provided along with technical specification of project. In Phase 1 the study is conducted for product development in the proposed area. In the ongoing section the purpose of project is discussed and the requirements collected to build the functional system.

Objective
The objective of this project is to build an online version of popular board game named ‘Carrom’. The game should have significant presence of AI/computer-controlled characters, and to make the game more competitive it should also have some social features in it.


Project Background
Carrom is a popular board game played in various parts of the part, and it is more popular in South Asian countries like Pakistan, India and Bangladesh.
But despite of its popularity, a proper digital version of this game was lacking, some attempts were made by different groups but there were various problems with them on various fronts, like graphics, game play, AI players and social features. Carrom challenge tries to cover them all,

Technology
The game is built on flash using actionscript 3.0. There are several opensource 3rd party APIs used in game, like box2d is used for handling physics and Tweener for animations. The game uses facebook API for enabling social features. On sserver dise Java servlets are used and mysql is used for database.



Game Introduction
The digital version allows users to play with AI characters, and there are 3 different modes available to play. The first is Challenge mode which is pretty much the basic, more traditional, version of carrom. users are given a random “challenger” that appears to be a non-player character to face off against. Taking turns, shooting from the opposite sides of the board, each player attempts to win with the basic carrom rules. However, in order to win, one must not only sink their nine discs, but also, the red queen before their last.

The other two modes are the variations of the main challenge mode. These consist of the Time Lapse and Century Game. The former is a more urgent and faster-paced version of Challenge, with the obvious difference being a time limit (exceeding which equals a lose). The latter, on the other hand, is the polar opposite, with the objective being to earn 100 points. The mode earns its name as each disk of your color only earns 5 points, the other player’s color is worth 3, and every time you miss, you loose 2.


Game Features
·         There are different 3 modes of carrom are available
·         User can select different boards, there are 5 different boards, which have different style of discs, and have different frictions.
·         Interactive gameplay, and provides an easier way to user to apply force and direction to the striker.
·         Game also provides an introductory animation for ‘how to play’.
·         Facebook integration, so that users can share their scores.
·         Artificially intelligent opponents




Core Functionality

Following are the main functional areas of the game.
  1. AI Management
  2. Game Physics
  3. Turn Management/Carrom Rules
  4. Board Selection Management
  5. Game-Play
  6. Score publishing
  7. Server-side Management


1.     AI Management

The game allows the users to play with AI players,  an AI player upon its turn selects the best disc to shoot to, takes the aim and apply the appropriate force, to sink the disc, these are main steps, and  the description of each of the step

Prioritize the Discs
In this step the AI class lists all of the available discs, which could be shot, and assigns a value to each disc, based upon their position and distance with the nearest pocket, the lower the value, the higher the priority, the queen disc has a higher priority, but when it combines with the distance with the nearest pocket, any other disc can get a higher priority

Select the Best Disc To shot
The system starts with the highest priority disc and finds out to any obstacles in its way from various positions, if it finds major obstacles then it ignores the disc, and jumps to the next disc of lesser priority. This process requires  some memory consumptions, so it is made a little lenient, it can be made more accurate, but in that case it will require some more time for computation.
For the discs which are placed behind the striker, the system divides the path into two parts, in order to take a reversal shot, in this case the striker will first hit to the bottom boundary, and then go to the targeted disc with the resultant speed.

Take the aim
The system has finalized a disc, now it will find out the angle, there are two types of shots which the system can take, first one is a direct shot, in which system finds out the angle between the striker and the targeted disc, so that the disc will go into the targeted pocket, the system considers the bottom 2 pots only in direct shot.
And in second type of shots, the system tries to shot the disc into the upper two pockets, and since the striker can't be moved in reverse direction, so it has to shot the striker at the bottom, so that it bounces back towards the disc placed behind the striker, for this it divides the angle computation process into two parts, first it finds out the angle to pot the disc directly without any reversal technique and then find out the projection of its path segment at the bottom boundary of the carrom board.

Applying Force
Now the system has the angle, the targeted disc, the targeted pocket and the strikers position, so the only thing it needs to find out is the force, which will be applied on the striker, so that the disc gets pot into the pocket. The force shouldn't have to be low enough that the striker couldn't reach the targeted disc, or the targeted disc couldn't reach to the targeted pocket and shouldn't have to be high enough that the disc strikes back and couldn't sink into the pocket due to high force. The value of force depends upon the distance between the striker and disc, the distance between disc and pot and friction.


2.     Game Physics

Game uses box2d physics engine for managing the collision detection and collision response, box2d is highly efficient and opensource physics engine, and it has been used in various popular games like 'angry birds', 'tiny wings'



3.     Turn Management/Carrom Rules

CarromRules is a class which is used in managing the turns between the user and AI in all 3 modes.  This class has a property named ‘gameMode’, in which 2 types of modes can be assigned i.e.  tournament or ‘points game’
AbstractMode is the base class, for defining the rules of each mode, mainly there are 2 modes i.e. ‘Challenge mode’ and ‘Points Game’; ‘time lapse’ has same rules of the ‘challenge mode’ except of an additional element of time.
The rules for ‘challenge mode’ are defined in the class ‘Tournament.as’ and the rules for century mode are defined in ‘PointsGame.as’ class, both classes are extended from ‘AbstractMode.as’
Both classes override the result function which is called by ‘game.as’ when the turn is completed, this function has all the logic of the specific modes.







4.     Board Selection Management

The game supports 4 variations of carrom boards, each board has a different layout, and has different style of discs. The board selection screen comes after user selected the mode, here a visual representation of board is shown, and upon the selection the theme of discs get aligned with the board. BoardSelection.as manages the whole process, and upon the selection of the board, it passes the data of the selected board to the ‘game.as’


5.     GamePlay

The game starts with the splash screen, clicking on it, will proceed the user to the mode selection screen. Here user can select a mode from 3 different modes, ‘Challenge’, ‘Time Lapse’ and ‘Century Mode’, upon the selection of the mode, the next screen will show the list  of available boards. After the selection of the board the game starts up.

Game Screen

This screen shows a carrom board, along-with a striker and 19 discs, the discs are of 2 colors except the disc for queen which is of red color. The 'game screen' starts with the list of opponents, and highlights the the selected opponent, after which a message bubble appears, in which the information regarding that specific mode is shown.
The striker moves with the cursor, the user has to put it anywhere on the black parallel lines towards the bottom of the board, clicking on anywhere else highlights the specific area, the striker also becomes semi-transparent when it is moved elsewhere. In order to shoot, all users need do is click on their side of the board to place the striker and drag in the opposite direction to determine power. The game will give the user a ghosted visual of where the shot will go and after that, it’s release and pray.

Highscores

The game shows the high-scores at the bottom of the screen, it shows the score of the user's friends on facebook. The scoreboard contains the profile picture of the user's friends, and their total score, rolling mouse over this, will show their score in all 3 modes.


6.     Score Publishing

At the end of each level, the game allows the users to publish their score on their Facebook wall, the publishing content includes user's name, an image that represents the specific mode and user's score.



7.     Server Side Management

Java is used for server side development, a couple of servlets are used for client-server communication.
There are 2 servlets used in the project, CarromService.java and FBLogin.java. FBLogin.java calls by the Facebook, which in return loads the game's swf file, sets the javascript functions in html, which could be called from the game's swf file for publishing the data on the users facebook wall.
CarromService is used for saving and retrieving the scores from database, the flash application calls service using post, the service if needed sends the data in Jason format, the data is then parsed by flash.
















EXTERNAL INTERFACE REQUIREMENT

Operating Environment

1.     Software Requirements

·                     Flash Player 10.0 or above
·                     Modern Internet Browser

2.     Browser Compatibility

·                     Microsoft Internet Explorer – Version 7.0+
·                     Mozilla Firefox – Version 3.0+

3.     Screen Resolution

·                     The web application will be optimized for the 800 x 600 screen resolution.

4.     Server Requirements

·                     Tomcat 6.0

5.     Hardware Requirements

·                     Minimum Hardware recommended by Adobe Flash player 10.0













Use Case Diagram










Activity Diagram – Rules of 'Challenge Mode'




Activity Diagram – Decision making of AI character

Class Diagram

USE CASE SPECIFICATION

1.     Progress to Game Screen


<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Use Case ID:
1
Use Case Name:
Progress to game screen
Created By:
Ata Ullah kirmani
Last Updated By:
-
Date Created:
29-Apr-2012
Date Last Updated:
-
Actors:
User
Description:
Before the  users actually start playing the game, there are several options appear, which appear in several screens, so that users can select mode, boards and can see the description of each mode.
Preconditions:
The game must have to be loaded completely.
Post conditions:
The game gets started and users can take their turn
Normal Flow:
1.0 Starting up the game
1.      Splash screen appears, clicking on it, takes the user to the modes selection screen
2.      Mode selection screen shows 3 different modes, rolling mouse over these buttons shows the description of that particular mode.
3.      Selected mode is stored and now the list of boards is appeared.
4.      Game loads the selected board and applies the rule of selected mode.
Alternative Flows::
1.0.A.1 Starting up the game
1.      Same as 1 to 2 of Normal Flow.
2.      User clicks on ‘how to play’, button.
3.      ‘How to play’ screen appears, it describes the game-play through animations.
4.      Clicking on cross button let the user go back to mode selection page.
5.      Same as 3 to 4 of Normal Flow.
Frequency of Use:
All Users
Special Requirements:
-
Assumptions:
-
Notes and Issues:
-



2.     Taking turn


Use Case ID:
2
Use Case Name:
Taking Turn
Created By:
Ata Ullah kirmani
Last Updated By:
-
Date Created:
29-Apr-2012
Date Last Updated:
-
Actors:
User
Description:
Once the game screen initialized, the users can start the game by clicking on their side of the board to place the striker and drag in the opposite direction to determine power
Preconditions:
User should be on the game screen, and it should have to be user’s turn
Post conditions:
The user applied the desired force to the striker into the specified direction
Normal Flow:

2.0 Taking turn

1.      Place the striker anywhere on the black parallel lines towards the bottom of the board
2.      Drag the striker in opposite direction, an arrow appears which determines the direction and force.
3.      Releasing the mouse will apply the desired force in desired direction to the striker.
Alternative Flows::
2.0.A.1 Taking turn
1.      Same as 1 to 2 of ‘Normal flow’.
2.      Drag the cursor back to the striker, now releasing the mouse will make the striker free again, an now the striker moves with mouse, and user can place it at some different location
3.      Same as 1 to 3 of ‘Normal flow’.
Frequency of Use:
All Users
Special Requirements:
-
Assumptions:
-
Notes and Issues:
-





3.     Publishing score


Use Case ID:
3
Use Case Name:
Progress to game screen
Created By:
Ata Ullah kirmani
Last Updated By:
-
Date Created:
29-Apr-2012
Date Last Updated:
-
Actors:
User
Description:
Once a level gets finished, users can publish their score on their Facebook wall
Preconditions:
The current level which the user is playing, should have to be finished, and the user has won it.
Post conditions:
The Facebook publishing form will appear, showing the user’s score and the image of the medal that the user has earned.
Normal Flow:

3.0 Publishing score

1.      Once the level finished, a popup appears, allowing the users to publish their score on their facebook wall.
2.      If the user clicks on share button, the information of the score and the mode will be send to the Facebook javascript Api.
3.      The Facebook publishing form appears, where user can also type their custom message. Clicking on the share button will call the callback function of javascript, which in return calls the flash function set as callback.
4.      Upon receiving the message from javascript flash application will proceed to the next level
Exceptions::

3.0.A.1 Publishing score

If the user clicked on the skip button, the new level starts immediately, and the Facebook form for publishing wouldn’t appear.
Frequency of Use:
All Users
Special Requirements:
-
Assumptions:
-
Notes and Issues:
-










Splash Screen


Mode selection Screen


How to Play Screen




<><>
Board Selection Screen




<><>
AI Players List




<><>
Game Default Screen






<><>
User Taking Turn




<><>
Striker Hits The discs




<><>

AI Player Taking Turn








<><>
Queen Win Animation




<><>
Win Screen




<><>
Awards and Medals for sharing on wall



0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More