Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
layarmmo-database [2012/11/09 12:16]
matthewleach Some more instructions added.
layarmmo-database [2012/11/18 13:18] (current)
matthewleach Added descriptions of tables, and SQL - need to check primary key
Line 14: Line 14:
 === Creating Tables === === Creating Tables ===
  
-phpMyAdmin is a great interface for working with your database, so hopefully you have it installed on your server. ​ If you return to cpanel, then you should be able to find the icon to click on.+phpMyAdmin is a great interface for working with your database, so hopefully you have it installed on your server. ​ If you return to cpanel, then you should be able to find the icon to click on (it's the third icon from the left in the picture at the top of this page).
  
 Depending on how your server is setup, clicking on the icon may automatically take you into phpMyAdmin as the administrative user.  If you are presented with a login screen, then use the database username and password that you just created. Depending on how your server is setup, clicking on the icon may automatically take you into phpMyAdmin as the administrative user.  If you are presented with a login screen, then use the database username and password that you just created.
  
 We are going to start with 3 tables: ​ We are going to start with 3 tables: ​
-  ​user details - the people using your game + 
 +  ​player ​details - the people using your game 
 + 
 +^Field ​   ^Description ​                          ^ 
 +|id       |A unique number assigned to the player| 
 +|ref      |The unique ID of the player'​s device ​ | 
 +|st       ​|Player'​s current strength ​            | 
 +|t        |Player'​s current toughness ​           | 
 +|hp       ​|Player'​s current hitpoints (health) ​  | 
 + 
 + 
   * monster details - the types of monsters in your game   * monster details - the types of monsters in your game
 +
 +^Field ​   ^Description ​                              ^
 +|id       |A unique number assigned to the monster ​  |
 +|type     ​|Number that matches an ID in the bestiary |
 +|st       ​|Monster'​s current strength ​               |
 +|t        |Monster'​s current toughness ​              |
 +|hp       ​|Monster'​s current hitpoints (health) ​     |
 +|lat      |Monster'​s current latitude (location) ​    |
 +|lon      |Monster'​s current longitude (location) ​   |
 +
   * spawned monsters - details for each monster that actually exists in your game   * spawned monsters - details for each monster that actually exists in your game
 +
 +^Field ​   ^Description ​                             ^
 +|id       |A unique number assigned to monster type |
 +|name     |The species name of this monster type    |
 +|desc     |A description of the monster (optional) ​ |
 +|image ​   |The URL for an image of the monster ​     |
 +|st       ​|Monster'​s initial strength ​              |
 +|t        |Monster'​s initial toughness ​             |
 +|hp       ​|Monster'​s initial hitpoints (health) ​    |
 +
 +When you first go into PHPMyAdmin, you will probably see the name of your database listed in the column on the left.  Click on it.  Then click on the SQL tab, copy and paste the text below into the largest text box, and click on the Go button.
 +
 +<​code>​
 +CREATE TABLE `player` (
 +        `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, ​
 +        `ref` VARCHAR(50) NOT NULL, 
 +        `st` TINYINT, UNSIGNED NOT NULL, 
 +        `t` TINYINT UNSIGNED NOT NULL, 
 +        `hp` TINYINT UNSIGNED NOT NULL);
 +
 +CREATE TABLE `monster` (
 +        `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,​
 +        `type` INT UNSIGNED NOT NULL,
 +        `st` TINYINT, UNSIGNED NOT NULL,
 +        `t` TINYINT, UNSIGNED NOT NULL,
 +        `hp` TINYINT, UNSIGNED NOT NULL,
 +        `lat` FLOAT NOT NULL,
 +        `lon` FLOAT NOT NULL);
 +        ​
 +CREATE TABLE `bestiary` (
 +        `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,​
 +        `name` VAHCHAR(30) NOT NULL,
 +        `desc` VARCHAR(140),​
 +        `image` VARCHAR(60) NOT NULL,
 +        `st` TINYINT, UNSIGNED NOT NULL,
 +        `t` TINYINT, UNSIGNED NOT NULL,
 +        `hp` TINYINT, UNSIGNED NOT NULL);
 +</​code>​
   ​   ​
 === Creating a Database Connection File === === Creating a Database Connection File ===