Software Design - final project
Anteprima
ESTRATTO DOCUMENTO
3.4.1 Class Car
Each car class has following getters and setters functions and the attributes stated below:
3.4.1.1 Attributes
The attributes of this class are:
• String Colour;
• String Shape;
• Int Steerings, range varies between 10 -100;
• Int Dwheels, could be back-wheel or 4-wheel;
• String Tyretypes: it is either normal, rain or studded.
3.4.1.2 Functions
The functions are the following:
• String getColour();
• String getShape();
• Int getSteerings();
• Int getDwheels();
• String getTyretypes();
• Void setColour();
• Void setShape();
• Void setSteerings();
• Void setDwheels();
• Void setTyretypes().
3.4.2 Class Player
Player class is responsible for the details of each player joining the competition. Each
player object consists of: a unique name, score, car1 and car2 (of data type car class).
Player also has tuneCar()function which sets the steering, drive wheel type and tyre
type for particular car of the player. 16
3.4.2.1 Attributes
• String name;
• Int score;
• Car* car1, e.g. used for free practice race;
• Car* car2, e.g. used for campaign race.
3.4.2.2 Functions
The functions are the following:
• void tuneCar(car* car, int steer, int d_wh, string tytp);
• void printCarSettings();
• void print_competitions();
• void print_score();
• void set_steerings( int st, string car_no);
• void set_dwheels( int dwh, string car_no );
• void set_tyretypes(string tt, string car_no );
• String set_player_name();
• String getName();
• String signUp();
• String signIn();
• int get_steering_car( car* c);
• int get_Dwheels( car* c);
• string get_tyretypes( car* c);
• string get_player_name();
• void set_player_name( string );
• void tunecar();
• car* getCar1();
• car* getCar2();
• virtual void joinCompetition(). 17
3.4.3 Class Track
The track has track_detail structure which keeps track of the track properties.The track
structure is stored in tracks_vector. It also has readconfigfile() function which reads
track properties from the text file.
3.4.3.1 Attributes
• The track structure is as following: <track name>:<difficulty ratio>:<road type>:<ideal
time>:<min players>:<deadline>
• struct track_detail: string name, string diff_ratio, string road_type , string ideal_-
time, string min_player, string deadline.
• vector of track_detail called tracks_;
• int deadline;
• int difficulty_ratio;
• int min_player;
• int ideal_time;
• String trackname;
• String road_type;
• String CompetitionType;
• int IDNumber;
• String RoadType;
3.4.3.2 Functions
The functions are the following:
• void readconfigfile();
• bool find_track_no(string name, unsigned int index);
• void print_tracks();
• int max_tracks().
Configuration file (configuration.txt) for the Track looks like:
Top Gear test track:10:asphalt:650:3:5:
Nurburgring:40:asphalt:1000:4:3:
Neste Oil Rally:20:sand:400:2:5:
Arctic Lapland Rally:35:snow:500:5:2: 18
3.4.4 Class Competition
Each competetion class has structure track_player which keeps the track of which player
is taking part in which track number (competetion). It also has signup function which
signs the player to take participation in particular track. We have print_track_player
virtual function which prints the result of the free practice or race. This is a virtual
function and is implemented further in race or free practice as per their own convenience.
3.4.4.1 Attributes
• A structure to store which player is associated with which track, struct track_-
player: int track_no , player *pl;
• A vector to keep the record which player is associated with which track, vector of
track_player called track_player_details;
• track* tr ;
• int track_time_car1;
• int track_time_car2;
• string tyre_type_1;
• string tyre_type_2.
3.4.4.2 Functions
The functions could be the following:
• virtual void delete_track_player_details(),delete the participants after round ends.;
• virtual void print_track_player( int index ), int returns track_f;
• int trackTimeCar1(),return the track time as calculated in print_track_player
function;
• int trackTimeCar2(),return the track time as calculated in print_track_player
function;
• int size_of_track_player_details();
• int get_track_parameter( int );
• track* getTrack(),return pointer to track;
• string str_player_name( int );
• string getDeadline( int index );
• int get_track_parameter();
• virtual void joinCompetition(). 19
3.4.5 Class Free Practice
This is a subclass of competition and has its own implementation of the print_track_-
player virtual function from the competetion class that it inherits. It calculate the track
time for car1 and car2 of the players. It also has some other private utility functions to
empty the vector temporarily used to store some values.
3.4.5.1 Attributes
• int track_time;
• int track_factor;
• bool alreadyPrinted;
• String player
3.4.5.2 Functions
The functions could be the following:
• void empty_names_vector() , function to empty names vector;
• virtual void delete_track_player_details();
• virtual void print_track_player( int );
• void calctracktime1();
• void calctrackfactor().
• boolean check();
• virtual void joinCompetition().
3.4.6 Class Race
It contains a random function which is used to determine the type of weather (rainy
etc.) and based upon the value of weather, it has its own implementation of the print_-
track_player virtual function from the competition class that it inherits. It also has
some private helper functions. It has a signup function which makes player to sign up
for a particular race.
3.4.6.1 Attributes
• int track_time;
• int track_factor;
• bool alreadyPrinted;
• bool check( string ). 20
3.4.6.2 Functions
The functions could be the following:
• void empty_names_vector() , function to empty names vector;
• virtual void delete_track_player_details();
• virtual void print_track_player( int );
• int random();
• void calctracktime2();
• void calctrackfactor().
• boolean check();
• virtual void joinCompetition();
• virtual void delete_track_player_details();
3.4.7 Class Controller
This acts like manager who is responsible for calling different classes for the games
programmers.
3.4.7.1 Attributes
It has the following attributes:
• player* p[ 3 ], e.g. number of players are three;
• string player_names[3] , e.g. number of players are three;
• string command ;
• track t ;
• int round , variable to update the current round;
• competetion comp .
3.4.7.2 Functions
The class has got the following functions:
• static bool nameAlreadyExistsOrNoName ( string names_array[], string name) :
checks whether user with same name is taking part again or not, if yes, asks for
another player’s name; 21
• int readCommand ( player *p ) : reads the command given by the players. It
reads commands given by players as token of strings and calls appropriate signup,
tunings, tune or other relevant functions. Also calls changePlayer() function which
is called if next command is given;
• void nameAlreadyExistsOrNoName();
• void displayCompetetions();
• void addplayer();
• void changePlayer();
• void display_scores().
3.5 Non-Functional Requirements
State the requirements in the following sections in measurable terms.
3.5.1 Performance
The game is supposed to run on a real time system, for this reason we expect real
time responses (in milliseconds). The product shall be based on online connection (or
offline) and has to be run from a game server (if you decide to play it virtually). The
product shall take initial load time depending on internet connection strength which also
depends on the media from which the product is run. The performance shall depend
upon hardware components of the client.
3.5.2 Reliability and Availability
The system shall provide storage of the database on redundant computers with automatic
switchover. The system shall provide RAID V Disk Stripping on all database storage
disks. The system needs an Internet Service Provider that allows the user to have access
the net.
3.5.3 Security
When a user put his information to logs in the system (or signs up) in it, the password
is not showed. The system shall use HTTPS protocol in the authentication form. The
system shall automatically log out all players after a period of inactivity. The system
shall not leave any cookies on the player’s computer containing the user’s password. The
system shall not leave any cookies on the player’s computer containing any of the user’s
confidential information. 22
3.5.4 Portability
The game could be downloaded on personal computers, smartphones, tablets or any
portable devices, etc. It is supposed to be accessible from every terminal connected to
Internet.
3.6 Design Constraints
There are some memory requirements (the pc where the product is downloaded need to
have enough memory to install the software). It is advisable to have a good GPU with
a dedicated memory (such as NVIDIA). The Internet connection, if the user wants to
play online need to be fast enough. The computers must be connected to the Net if you
want to have online access. Response time for loading the product should take no longer
than five minutes. A general knowledge of basic computer skills is required to use the
product.
3.7 Logical Database Requirements
A database will be used to store some information about the player’s race. Each data
has an own type (such as int, double, etc) and there is a filed identified as primary key
(User Id) that must be unique. The database will contain every information of each user
that plays the game until the player will decide to delete him/herself from the system
(we can say that the database history is guaranteed).
23
4 Analysis Models
In this section of the documentation are listed some models realized for illustrate the
functions and goals of “Car Race Game Manager”.
4.0.1 Sequence Diagrams with Scenarios
Scenario 1 :
A new player signed up in the game, then signed in to play. Player chose his car and
lowers the volume, choose track, choose outfit. Then, player started a campaign race,
finished it and finally viewed the ranking result.
Figure 4.1: Scenario 1
24
Scenario 2 :
An experienced player signed in to play the game. In the setting, Player changed his
car, his outfit and his upgrades. Then, player started a free race, chose the level,
finished it and viewed the ranking result. Player viewed his statistics (and perhaps he
got a new record for that level). Figure 4.2: Scenario 2
25
Scenario 3 :
A player signs in the system but it rejects him because the maximum number of
players is full filled. He can choose to leave out or wait in a queue. The player leaves
out. The system notifies him about the operation done.
Figure 4.3: Scenario 3
26
4.0.2 Sequence diagram: Communcation of CRGM objects
Figure 4.4: Communication of CRGM objects
27
4.1 Activity Diagram
In 4.5 is shown the Activity Diagram:
Figure 4.5: Activity Diagram
As is shown in the picture above, the player, after the registration, will have access to
the “Sign Up” operation (that could not have a response from the server thus it could
be repeated). The second operation is the “Sign In”: the user need to type his/her Id
and password. If they are wrong the same page will be shown again to the player.
After that the access to the game is allowed unless there are some places available for
playing (if not the player will be put in a wait queue until a player will decide to leave
the game). Once the user joined the game he/she can configure the settings and enroll
in a competition (deciding if doing a “free practice”, taking part in a real “race” or
doing both of them). After the competition has been done the ranking will be shown
and the player can choose to exit the game or to play another match.
28
I contenuti di questa pagina costituiscono rielaborazioni personali del Publisher tito1992 di informazioni apprese con la frequenza delle lezioni di Software Engineering e studio autonomo di eventuali libri di riferimento in preparazione dell'esame finale o della tesi. Non devono intendersi come materiale ufficiale dell'università Camerino - Unicam o del prof Culmone Rosario.
Acquista con carta o conto PayPal
Scarica il file tutte le volte che vuoi
Paga con un conto PayPal per usufruire della garanzia Soddisfatto o rimborsato