Difference between revisions of "Design Document Server Side Overview"
(→The Box Table: mediumtext) |
(→The Game Table: mediumtext) |
||
Line 122: | Line 122: | ||
|- | |- | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.0382in;"| json_text | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.0382in;"| json_text | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.0382in;"| | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.0382in;"| MediumText | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.0382in;"| Yes | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.0382in;"| Yes | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.0382in;"| NULL | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.0382in;"| NULL | ||
|} | |} | ||
=== The Game Player Table=== | === The Game Player Table=== | ||
Revision as of 15:29, 8 July 2013
The server side of the BOARD18 application will use a minimalist approach. In other words, anything that can be done on the client side, will be done on the client side. This philosophy limits the server mostly to data base access and game logging tasks. The server side of the BOARD18 application will also provide conflict resolution for multi thread database accesses.
Data Base
BOARD 18 uses MySQL for its data management. A single database, with a data base name of BOARD18, is used. The database consists of four tables:
- The Box Table
- The Game Table
- The Game Player Table
- The Players Table
The Box Table
Each row in the table named “box” contains a game box. The table layout is shown below. The json_text field contains a stringified JSON game box object as described in section 5.2.1.
Column | Type | Null | Default |
box_id | Int (11) | No | |
bname | Varchar (25) | No | |
version | Varchar (25) | Yes | NULL |
create_date | Timestamp | Yes | NULL |
activity_date | Timestamp | No | CURRENT_TIMESTAMP |
author | Varchar (25) | No | |
json_text | MediumText | Yes | NULL |
The Game Table
The “game” table contains a row for each game that is being tracked by BOARD18. The table layout is shown below. The json_text field contains a stringified JSON game session object as described in section 5.2.2.
Column | Type | Null | Default |
game_id | Int (11) | No | |
gname | Varchar (25) | No | |
start_date | Timestamp | Yes | NULL |
activity_date | Timestamp | No | CURRENT_TIMESTAMP |
update_counter | Int (11) | No | 0 |
last_updater | Varchar (16) | No | 0 |
box_id | Int (11) | No | |
json_text | MediumText | Yes | NULL |
The Game Player Table
The “game_player” table contains a row for each player of each active game that is being tracked by BOARD18. The table layout is shown below. This table is the link between players and the game sessions that they are playing.
Column | Type | Null | Default |
game_id | Int (11) | No | |
player_id | Int (11) | No | |
status | Varchar (10) | No | 'New' |
The Players Table
The “players” table contains a row for each player that has a login ID in BOARD18. The table layout is shown below. This table is used to control player access to the application.
Column | Type | Null | Default |
player_id | Int (11) | No | |
firstname | Varchar (25) | No | |
lastname | Varchar (25) | Yes | NULL |
Varchar (25) | Yes | NULL | |
login | Varchar (16) | No | |
passwd | Varchar (64) | No | |
create-date | Timestamp | No | CURRENT_TIMESTAMP |
level | Varchar (10) | No | player |
Logic
Most of the server side processing for BOARD18 is done in stand alone PHP programs that are executed from the web pages via AJAX calls. These programs are listed here with brief descriptions.
- createGame.phpCreates a new row in the game table and adds a row in the game_player table for each player in the game.
- gameBox.php Returns a game box in JSON format.
- gameSession.php Returns game activity information in JSON format.
- logout.php Logs the current user out of BOARD18.
- myGameList.php Returns a list of the games that a player is playing.
- newUser.php Creates a new row in the players table.
- updateGame.php Loads game status updates into the database.
- validateUser.phpLogs the current user in to BOARD18.
In addition the auth.php program is included at the front of every php program that is listed above and of every php enabled page. This module checks that the session is signed on and redirects control to access-denied.html if it is not.
Finally the config.php module is included at the front of every php program and php enabled page that accesses the board18 database. It contains information used to locate and access the database.